ezuikit.js 1.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627
  1. 'use strict';
  2. function _typeof(obj) {
  3. "@babel/helpers - typeof";
  4. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  5. return typeof obj;
  6. } : function (obj) {
  7. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  8. }, _typeof(obj);
  9. }
  10. function _classCallCheck$1(instance, Constructor) {
  11. if (!(instance instanceof Constructor)) {
  12. throw new TypeError("Cannot call a class as a function");
  13. }
  14. }
  15. function _defineProperties(target, props) {
  16. for (var i = 0; i < props.length; i++) {
  17. var descriptor = props[i];
  18. descriptor.enumerable = descriptor.enumerable || false;
  19. descriptor.configurable = true;
  20. if ("value" in descriptor) descriptor.writable = true;
  21. Object.defineProperty(target, descriptor.key, descriptor);
  22. }
  23. }
  24. function _createClass$1(Constructor, protoProps, staticProps) {
  25. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  26. if (staticProps) _defineProperties(Constructor, staticProps);
  27. Object.defineProperty(Constructor, "prototype", {
  28. writable: false
  29. });
  30. return Constructor;
  31. }
  32. function _defineProperty(obj, key, value) {
  33. if (key in obj) {
  34. Object.defineProperty(obj, key, {
  35. value: value,
  36. enumerable: true,
  37. configurable: true,
  38. writable: true
  39. });
  40. } else {
  41. obj[key] = value;
  42. }
  43. return obj;
  44. }
  45. var Core = /*#__PURE__*/function () {
  46. function Core(x, y) {
  47. _classCallCheck$1(this, Core);
  48. this.coreX = x;
  49. this.coreY = y;
  50. }
  51. _createClass$1(Core, [{
  52. key: "toString",
  53. value: function toString() {
  54. return "".concat(this.coreX, "-").concat(this.coreY);
  55. }
  56. }]);
  57. return Core;
  58. }();
  59. // eslint-disable-next-line no-extend-native
  60. Date.prototype.Format = function (fmt) {
  61. var o = {
  62. "M+": this.getMonth() + 1,
  63. "d+": this.getDate(),
  64. "h+": this.getHours(),
  65. "m+": this.getMinutes(),
  66. "s+": this.getSeconds(),
  67. "q+": Math.floor((this.getMonth() + 3) / 3),
  68. "S": this.getMilliseconds()
  69. };
  70. if (/(y+)/.test(fmt)) {
  71. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  72. }
  73. for (var k in o) {
  74. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  75. }
  76. return fmt;
  77. };
  78. // 加载js
  79. var addJs = function addJs(filepath, callback, isReadyFun) {
  80. var headerScript = document.getElementsByTagName('head')[0].getElementsByTagName("script");
  81. var isReady = false;
  82. if (isReadyFun) {
  83. isReady = isReadyFun();
  84. } else {
  85. for (var i = 0; i < headerScript.length; i++) {
  86. if (headerScript[i].getAttribute("src") == filepath) {
  87. isReady = true;
  88. callback();
  89. }
  90. }
  91. }
  92. if (!isReady) {
  93. var oJs = document.createElement("script");
  94. oJs.setAttribute("src", filepath);
  95. oJs.setAttribute("crossorigin", true);
  96. oJs.onload = callback;
  97. document.getElementsByTagName("head")[0].appendChild(oJs);
  98. } else {
  99. callback();
  100. }
  101. };
  102. var addCss = function addCss(filepath, callback) {
  103. var headerLink = document.getElementsByTagName('head')[0].getElementsByTagName("link");
  104. var isReady = false;
  105. for (var i = 0; i < headerLink.length; i++) {
  106. if (headerLink[i].getAttribute("href") == filepath) {
  107. isReady = true;
  108. }
  109. }
  110. if (!isReady) {
  111. var oJs = document.createElement('link');
  112. oJs.rel = 'stylesheet';
  113. oJs.type = 'text/css';
  114. oJs.href = filepath;
  115. oJs.onload = callback;
  116. document.getElementsByTagName("head")[0].appendChild(oJs);
  117. }
  118. };
  119. var isPromise = function isPromise(obj) {
  120. return !!obj && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  121. };
  122. var getQueryString = function getQueryString(name, url) {
  123. var r = new RegExp("(\\?|#|&)" + name + "=(.*?)(#|&|$)");
  124. var m = (url || window.location.href).match(r);
  125. return decodeURIComponent(m ? m[2] : '');
  126. };
  127. var insertAfter$1 = function insertAfter(newElement, targetElement) {
  128. var parent = targetElement.parentNode;
  129. if (parent.lastChild == targetElement) {
  130. parent.appendChild(newElement);
  131. } else {
  132. parent.insertBefore(newElement, targetElement.nextSibling);
  133. }
  134. };
  135. var requestFullScreen = function requestFullScreen(element) {
  136. console.log("requestFullScreen", document.getElementById(element));
  137. var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
  138. if (requestMethod) {
  139. requestMethod.call(element);
  140. } else if (typeof window.ActiveXObject !== "undefined") {
  141. var wscript = new window.ActiveXObject("WScript.Shell");
  142. if (wscript !== null) {
  143. wscript.SendKeys("{F11}");
  144. }
  145. }
  146. };
  147. var requestMobileFullScreen = function requestMobileFullScreen(element) {
  148. var width = document.documentElement.clientWidth;
  149. var height = document.documentElement.clientHeight;
  150. var wrapper = element;
  151. var style = "";
  152. style += "width:" + height + "px;"; // 注意旋转后的宽高切换
  153. style += "height:" + width + "px;";
  154. style += "-webkit-transform: rotate(90.001deg); transform: rotate(90.001deg);";
  155. // 注意旋转中点的处理
  156. style += "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  157. style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  158. style += 'position: fixed;top: 0;left: 0;z-index:10';
  159. wrapper.style.cssText = style;
  160. };
  161. var requestFullScreenPromise = function requestFullScreenPromise(element) {
  162. requestFullScreen(element);
  163. var promise = new Promise(function (resolve, reject) {
  164. var timeInterval = setInterval(function () {
  165. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  166. if (isFullScreen) {
  167. clearInterval(timeInterval);
  168. return resolve(true);
  169. }
  170. }, 100);
  171. var timeOut = setTimeout(function () {
  172. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  173. if (!isFullScreen) {
  174. reject(false);
  175. }
  176. clearTimeout(timeOut);
  177. }, 2000);
  178. });
  179. return promise;
  180. };
  181. var cancelMobileFullScreen = function cancelMobileFullScreen(element, width, height) {
  182. var style = "";
  183. style += "width:" + width + "px;";
  184. style += "height:" + height + "px;";
  185. style += "-webkit-transform: none; transform: none;";
  186. style += "-webkit-transform-origin: 0 0;";
  187. style += "transform-origin: 0 0;";
  188. element.style.cssText = style;
  189. };
  190. var cancelFullScreen = function cancelFullScreen() {
  191. if (document.exitFullscreen) {
  192. document.exitFullscreen();
  193. } else if (document.webkitCancelFullScreen) {
  194. document.webkitCancelFullScreen();
  195. } else if (document.mozCancelFullScreen) {
  196. document.mozCancelFullScreen();
  197. }
  198. };
  199. var cancelFullScreenPromise = function cancelFullScreenPromise(element) {
  200. cancelFullScreen();
  201. var promise = new Promise(function (resolve, reject) {
  202. var timeInterval = setInterval(function () {
  203. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  204. if (!isFullScreen) {
  205. clearInterval(timeInterval);
  206. return resolve(true);
  207. }
  208. }, 50);
  209. var timeOut = setTimeout(function () {
  210. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  211. if (isFullScreen) {
  212. reject(false);
  213. }
  214. clearTimeout(timeOut);
  215. }, 2000);
  216. });
  217. return promise;
  218. };
  219. var matchEzopenUrl = function matchEzopenUrl(ezopenUrl) {
  220. var deviceSerial = ezopenUrl.split("/")[3];
  221. var channelNo = ezopenUrl.split("/")[4].split(".")[0];
  222. var validCode = ezopenUrl.split("/")[2].split("@").length === 2 ? ezopenUrl.split("/")[2].split("@")[0] : "";
  223. var hd = ezopenUrl.indexOf('.hd') !== -1;
  224. var type = ezopenUrl.split("/")[4].split(".")[ezopenUrl.split("/")[4].split(".").length - 1].split("?")[0];
  225. if (type === 'rec' && ezopenUrl.indexOf(".cloud.rec") !== -1) {
  226. type = 'cloud.rec';
  227. }
  228. return {
  229. deviceSerial: deviceSerial,
  230. channelNo: channelNo,
  231. validCode: validCode,
  232. hd: hd,
  233. type: type
  234. };
  235. };
  236. function isJSON(str) {
  237. if (typeof str === 'string') {
  238. try {
  239. var obj = JSON.parse(str);
  240. if (_typeof(obj) === 'object' && obj) {
  241. return true;
  242. }
  243. return false;
  244. } catch (e) {
  245. return false;
  246. }
  247. }
  248. console.log('It is not a string!');
  249. }
  250. var request = function request(url, method, params, header, success, error) {
  251. var _url = url;
  252. var http_request = new XMLHttpRequest();
  253. http_request.onreadystatechange = function () {
  254. if (http_request.readyState == 4) {
  255. if (http_request.status == 200) {
  256. if (isJSON(http_request.responseText)) {
  257. var _data = JSON.parse(http_request.responseText);
  258. success(_data);
  259. } else {
  260. success(http_request.responseText);
  261. }
  262. }
  263. }
  264. };
  265. http_request.open(method, _url, true);
  266. // http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  267. var data = new FormData();
  268. for (var i in params) {
  269. data.append(i, params[i]);
  270. }
  271. http_request.send(data);
  272. };
  273. var HLS = /*#__PURE__*/function () {
  274. function HLS(videoId, url) {
  275. var _this = this;
  276. _classCallCheck$1(this, HLS);
  277. addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js", function () {
  278. console.log("加载hls.min.js成功", window.Hls);
  279. console.log("isSupportHls", window.Hls.isSupported());
  280. if (window.Hls.isSupported()) {
  281. _this.initHLS(videoId, url);
  282. }
  283. }, function () {
  284. return !!window.Hls;
  285. });
  286. }
  287. _createClass$1(HLS, [{
  288. key: "toString",
  289. value: function toString() {
  290. return "hls ".concat(this.coreX, "-").concat(this.coreY);
  291. }
  292. }, {
  293. key: "initHLS",
  294. value: function initHLS(videoId, hlsUrl) {
  295. var video = document.getElementById(videoId);
  296. var hls = new window.Hls({
  297. defaultAudioCodec: 'mp4a.40.2'
  298. }); // 萤石设备默认使用 AAC LC 音频编码
  299. hls.loadSource(hlsUrl);
  300. hls.attachMedia(video);
  301. hls.on(window.Hls.Events.MANIFEST_PARSED, function () {
  302. video.play();
  303. });
  304. hls.on(window.Hls.Events.ERROR, function (event, data) {
  305. if (data.fatal) {
  306. switch (data.type) {
  307. case window.Hls.ErrorTypes.NETWORK_ERROR:
  308. // try to recover network error
  309. console.log("fatal network error encountered, try to recover");
  310. hls.startLoad();
  311. break;
  312. case window.Hls.ErrorTypes.MEDIA_ERROR:
  313. console.log("fatal media error encountered, try to recover");
  314. hls.recoverMediaError();
  315. break;
  316. default:
  317. // cannot recover
  318. hls.destroy();
  319. break;
  320. }
  321. }
  322. });
  323. this.hls = hls;
  324. this.video = video;
  325. this.hlsUrl = hlsUrl;
  326. }
  327. }, {
  328. key: "play",
  329. value: function play() {
  330. console.log("执行hls播放", this.video);
  331. this.hls.startLoad();
  332. // this.video.src = this.hlsUrl;
  333. this.video.play();
  334. }
  335. }, {
  336. key: "stop",
  337. value: function stop() {
  338. // 通过暂停停止播放
  339. // this.video.pause();
  340. // this.video.src = "";
  341. this.video.pause();
  342. // 停止取流
  343. this.hls.stopLoad();
  344. // this.hls.destroy();
  345. }
  346. }]);
  347. return HLS;
  348. }();
  349. var FLV = /*#__PURE__*/function () {
  350. function FLV(videoId, url) {
  351. var _this = this;
  352. _classCallCheck$1(this, FLV);
  353. addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/flv.min.js", function () {
  354. console.log("加载flv.min.js成功", window.flvjs);
  355. console.log("isSupportFlv", window.flvjs.isSupported());
  356. if (window.flvjs.isSupported()) {
  357. _this.initFLV(videoId, url);
  358. }
  359. });
  360. }
  361. _createClass$1(FLV, [{
  362. key: "toString",
  363. value: function toString() {
  364. return "Flv ".concat(this.coreX, "-").concat(this.coreY);
  365. }
  366. }, {
  367. key: "initFLV",
  368. value: function initFLV(videoId, flvUrl) {
  369. var video = document.getElementById(videoId);
  370. var hasControls = video.getAttribute('controls');
  371. if (!hasControls) {
  372. video.setAttribute('controls', true);
  373. }
  374. var flvPlayer = window.flvjs.createPlayer({
  375. type: 'flv',
  376. url: flvUrl,
  377. isLive: true
  378. }, {
  379. enableStashBuffer: true,
  380. stashInitialSize: 128,
  381. enableWorker: true
  382. });
  383. flvPlayer.attachMediaElement(video);
  384. flvPlayer.load();
  385. flvPlayer.play();
  386. this.flvUrl = flvUrl;
  387. this.flv = flvPlayer;
  388. this.video = video;
  389. }
  390. }, {
  391. key: "play",
  392. value: function play() {
  393. console.log("执行flv播放", this.video);
  394. this.video.play();
  395. }
  396. }, {
  397. key: "stop",
  398. value: function stop() {
  399. // 通过暂停停止播放
  400. // this.video.pause();
  401. // this.video.src = "";
  402. this.video.pause();
  403. // 停止取流
  404. this.flv.unload();
  405. // this.hls.destroy();
  406. }
  407. }]);
  408. return FLV;
  409. }();
  410. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  411. function createCommonjsModule(fn, module) {
  412. return module = { exports: {} }, fn(module, module.exports), module.exports;
  413. }
  414. var lodash = createCommonjsModule(function (module, exports) {
  415. (function(){/** Used as a safe reference for `undefined` in pre-ES5 environments. */var undefined$1;/** Used as the semantic version number. */var VERSION='4.17.21';/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Error message constants. */var CORE_ERROR_TEXT='Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',FUNC_ERROR_TEXT='Expected a function',INVALID_TEMPL_VAR_ERROR_TEXT='Invalid `variable` option passed into `_.template`';/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as the maximum memoize cache size. */var MAX_MEMOIZE_SIZE=500;/** Used as the internal argument placeholder. */var PLACEHOLDER='__lodash_placeholder__';/** Used to compose bitmasks for cloning. */var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;/** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;/** Used to compose bitmasks for function metadata. */var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;/** Used as default options for `_.truncate`. */var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION='...';/** Used to detect hot functions by number of calls within a span of milliseconds. */var HOT_COUNT=800,HOT_SPAN=16;/** Used to indicate the type of lazy iteratees. */var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;/** Used as references for various `Number` constants. */var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e+308,NAN=0/0;/** Used as references for the maximum length and index of an array. */var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;/** Used to associate wrap methods with their bit flags. */var wrapFlags=[['ary',WRAP_ARY_FLAG],['bind',WRAP_BIND_FLAG],['bindKey',WRAP_BIND_KEY_FLAG],['curry',WRAP_CURRY_FLAG],['curryRight',WRAP_CURRY_RIGHT_FLAG],['flip',WRAP_FLIP_FLAG],['partial',WRAP_PARTIAL_FLAG],['partialRight',WRAP_PARTIAL_RIGHT_FLAG],['rearg',WRAP_REARG_FLAG]];/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',asyncTag='[object AsyncFunction]',boolTag='[object Boolean]',dateTag='[object Date]',domExcTag='[object DOMException]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',nullTag='[object Null]',objectTag='[object Object]',promiseTag='[object Promise]',proxyTag='[object Proxy]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',undefinedTag='[object Undefined]',weakMapTag='[object WeakMap]',weakSetTag='[object WeakSet]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[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]';/** Used to match empty string literals in compiled template source. */var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;/** Used to match HTML entities and HTML characters. */var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);/** Used to match template delimiters. */var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;/** Used to match property names within property paths. */var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;/**
  416. * Used to match `RegExp`
  417. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  418. */var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);/** Used to match leading whitespace. */var reTrimStart=/^\s+/;/** Used to match a single whitespace character. */var reWhitespace=/\s/;/** Used to match wrap detail comments. */var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;/** Used to match words composed of alphanumeric characters. */var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;/**
  419. * Used to validate the `validate` option in `_.template` variable.
  420. *
  421. * Forbids characters which could potentially change the meaning of the function argument definition:
  422. * - "()," (modification of function parameters)
  423. * - "=" (default value)
  424. * - "[]{}" (destructuring of function parameters)
  425. * - "/" (beginning of a comment)
  426. * - whitespace
  427. */var reForbiddenIdentifierChars=/[()=,{}\[\]\/\s]/;/** Used to match backslashes in property paths. */var reEscapeChar=/\\(\\)?/g;/**
  428. * Used to match
  429. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  430. */var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;/** Used to match `RegExp` flags from their coerced string values. */var reFlags=/\w*$/;/** Used to detect bad signed hexadecimal string values. */var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;/** Used to detect binary string values. */var reIsBinary=/^0b[01]+$/i;/** Used to detect host constructors (Safari). */var reIsHostCtor=/^\[object .+?Constructor\]$/;/** Used to detect octal string values. */var reIsOctal=/^0o[0-7]+$/i;/** Used to detect unsigned integer values. */var reIsUint=/^(?:0|[1-9]\d*)$/;/** Used to match Latin Unicode letters (excluding mathematical operators). */var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;/** Used to ensure capturing order of template delimiters. */var reNoMatch=/($^)/;/** Used to match unescaped characters in compiled string literals. */var reUnescapedString=/['\n\r\u2028\u2029\\]/g;/** Used to compose unicode character classes. */var rsAstralRange='\\ud800-\\udfff',rsComboMarksRange='\\u0300-\\u036f',reComboHalfMarksRange='\\ufe20-\\ufe2f',rsComboSymbolsRange='\\u20d0-\\u20ff',rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange='\\u2700-\\u27bf',rsLowerRange='a-z\\xdf-\\xf6\\xf8-\\xff',rsMathOpRange='\\xac\\xb1\\xd7\\xf7',rsNonCharRange='\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',rsPunctuationRange='\\u2000-\\u206f',rsSpaceRange=' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',rsUpperRange='A-Z\\xc0-\\xd6\\xd8-\\xde',rsVarRange='\\ufe0e\\ufe0f',rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;/** Used to compose unicode capture groups. */var rsApos="['\u2019]",rsAstral='['+rsAstralRange+']',rsBreak='['+rsBreakRange+']',rsCombo='['+rsComboRange+']',rsDigits='\\d+',rsDingbat='['+rsDingbatRange+']',rsLower='['+rsLowerRange+']',rsMisc='[^'+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+']',rsFitz='\\ud83c[\\udffb-\\udfff]',rsModifier='(?:'+rsCombo+'|'+rsFitz+')',rsNonAstral='[^'+rsAstralRange+']',rsRegional='(?:\\ud83c[\\udde6-\\uddff]){2}',rsSurrPair='[\\ud800-\\udbff][\\udc00-\\udfff]',rsUpper='['+rsUpperRange+']',rsZWJ='\\u200d';/** Used to compose unicode regexes. */var rsMiscLower='(?:'+rsLower+'|'+rsMisc+')',rsMiscUpper='(?:'+rsUpper+'|'+rsMisc+')',rsOptContrLower='(?:'+rsApos+'(?:d|ll|m|re|s|t|ve))?',rsOptContrUpper='(?:'+rsApos+'(?:D|LL|M|RE|S|T|VE))?',reOptMod=rsModifier+'?',rsOptVar='['+rsVarRange+']?',rsOptJoin='(?:'+rsZWJ+'(?:'+[rsNonAstral,rsRegional,rsSurrPair].join('|')+')'+rsOptVar+reOptMod+')*',rsOrdLower='\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',rsOrdUpper='\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji='(?:'+[rsDingbat,rsRegional,rsSurrPair].join('|')+')'+rsSeq,rsSymbol='(?:'+[rsNonAstral+rsCombo+'?',rsCombo,rsRegional,rsSurrPair,rsAstral].join('|')+')';/** Used to match apostrophes. */var reApos=RegExp(rsApos,'g');/**
  431. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  432. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  433. */var reComboMark=RegExp(rsCombo,'g');/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */var reUnicode=RegExp(rsFitz+'(?='+rsFitz+')|'+rsSymbol+rsSeq,'g');/** Used to match complex or compound words. */var reUnicodeWord=RegExp([rsUpper+'?'+rsLower+'+'+rsOptContrLower+'(?='+[rsBreak,rsUpper,'$'].join('|')+')',rsMiscUpper+'+'+rsOptContrUpper+'(?='+[rsBreak,rsUpper+rsMiscLower,'$'].join('|')+')',rsUpper+'?'+rsMiscLower+'+'+rsOptContrLower,rsUpper+'+'+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join('|'),'g');/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */var reHasUnicode=RegExp('['+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+']');/** Used to detect strings that need a more robust regexp to match words. */var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;/** Used to assign default `context` object properties. */var contextProps=['Array','Buffer','DataView','Date','Error','Float32Array','Float64Array','Function','Int8Array','Int16Array','Int32Array','Map','Math','Object','Promise','RegExp','Set','String','Symbol','TypeError','Uint8Array','Uint8ClampedArray','Uint16Array','Uint32Array','WeakMap','_','clearTimeout','isFinite','parseInt','setTimeout'];/** Used to make template sourceURLs easier to identify. */var templateCounter=-1;/** Used to identify `toStringTag` values of typed arrays. */var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;/** Used to identify `toStringTag` values supported by `_.clone`. */var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;/** Used to map Latin Unicode letters to basic Latin letters. */var deburredLetters={// Latin-1 Supplement block.
  434. '\xc0':'A','\xc1':'A','\xc2':'A','\xc3':'A','\xc4':'A','\xc5':'A','\xe0':'a','\xe1':'a','\xe2':'a','\xe3':'a','\xe4':'a','\xe5':'a','\xc7':'C','\xe7':'c','\xd0':'D','\xf0':'d','\xc8':'E','\xc9':'E','\xca':'E','\xcb':'E','\xe8':'e','\xe9':'e','\xea':'e','\xeb':'e','\xcc':'I','\xcd':'I','\xce':'I','\xcf':'I','\xec':'i','\xed':'i','\xee':'i','\xef':'i','\xd1':'N','\xf1':'n','\xd2':'O','\xd3':'O','\xd4':'O','\xd5':'O','\xd6':'O','\xd8':'O','\xf2':'o','\xf3':'o','\xf4':'o','\xf5':'o','\xf6':'o','\xf8':'o','\xd9':'U','\xda':'U','\xdb':'U','\xdc':'U','\xf9':'u','\xfa':'u','\xfb':'u','\xfc':'u','\xdd':'Y','\xfd':'y','\xff':'y','\xc6':'Ae','\xe6':'ae','\xde':'Th','\xfe':'th','\xdf':'ss',// Latin Extended-A block.
  435. '\u0100':'A','\u0102':'A','\u0104':'A','\u0101':'a','\u0103':'a','\u0105':'a','\u0106':'C','\u0108':'C','\u010a':'C','\u010c':'C','\u0107':'c','\u0109':'c','\u010b':'c','\u010d':'c','\u010e':'D','\u0110':'D','\u010f':'d','\u0111':'d','\u0112':'E','\u0114':'E','\u0116':'E','\u0118':'E','\u011a':'E','\u0113':'e','\u0115':'e','\u0117':'e','\u0119':'e','\u011b':'e','\u011c':'G','\u011e':'G','\u0120':'G','\u0122':'G','\u011d':'g','\u011f':'g','\u0121':'g','\u0123':'g','\u0124':'H','\u0126':'H','\u0125':'h','\u0127':'h','\u0128':'I','\u012a':'I','\u012c':'I','\u012e':'I','\u0130':'I','\u0129':'i','\u012b':'i','\u012d':'i','\u012f':'i','\u0131':'i','\u0134':'J','\u0135':'j','\u0136':'K','\u0137':'k','\u0138':'k','\u0139':'L','\u013b':'L','\u013d':'L','\u013f':'L','\u0141':'L','\u013a':'l','\u013c':'l','\u013e':'l','\u0140':'l','\u0142':'l','\u0143':'N','\u0145':'N','\u0147':'N','\u014a':'N','\u0144':'n','\u0146':'n','\u0148':'n','\u014b':'n','\u014c':'O','\u014e':'O','\u0150':'O','\u014d':'o','\u014f':'o','\u0151':'o','\u0154':'R','\u0156':'R','\u0158':'R','\u0155':'r','\u0157':'r','\u0159':'r','\u015a':'S','\u015c':'S','\u015e':'S','\u0160':'S','\u015b':'s','\u015d':'s','\u015f':'s','\u0161':'s','\u0162':'T','\u0164':'T','\u0166':'T','\u0163':'t','\u0165':'t','\u0167':'t','\u0168':'U','\u016a':'U','\u016c':'U','\u016e':'U','\u0170':'U','\u0172':'U','\u0169':'u','\u016b':'u','\u016d':'u','\u016f':'u','\u0171':'u','\u0173':'u','\u0174':'W','\u0175':'w','\u0176':'Y','\u0177':'y','\u0178':'Y','\u0179':'Z','\u017b':'Z','\u017d':'Z','\u017a':'z','\u017c':'z','\u017e':'z','\u0132':'IJ','\u0133':'ij','\u0152':'Oe','\u0153':'oe','\u0149':"'n",'\u017f':'s'};/** Used to map characters to HTML entities. */var htmlEscapes={'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'};/** Used to map HTML entities to characters. */var htmlUnescapes={'&amp;':'&','&lt;':'<','&gt;':'>','&quot;':'"','&#39;':"'"};/** Used to escape characters for inclusion in compiled string literals. */var stringEscapes={'\\':'\\',"'":"'",'\n':'n','\r':'r','\u2028':'u2028','\u2029':'u2029'};/** Built-in method references without a dependency on `root`. */var freeParseFloat=parseFloat,freeParseInt=parseInt;/** Detect free variable `global` from Node.js. */var freeGlobal=typeof commonjsGlobal=='object'&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;/** Detect free variable `self`. */var freeSelf=typeof self=='object'&&self&&self.Object===Object&&self;/** Used as a reference to the global object. */var root=freeGlobal||freeSelf||Function('return this')();/** Detect free variable `exports`. */var freeExports=exports&&!exports.nodeType&&exports;/** Detect free variable `module`. */var freeModule=freeExports&&'object'=='object'&&module&&!module.nodeType&&module;/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;/** Detect free variable `process` from Node.js. */var freeProcess=moduleExports&&freeGlobal.process;/** Used to access faster Node.js helpers. */var nodeUtil=function(){try{// Use `util.types` for Node.js 10+.
  436. var types=freeModule&&freeModule.require&&freeModule.require('util').types;if(types){return types;}// Legacy `process.binding('util')` for Node.js < 10.
  437. return freeProcess&&freeProcess.binding&&freeProcess.binding('util');}catch(e){}}();/* Node.js helper references. */var nodeIsArrayBuffer=nodeUtil&&nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;/*--------------------------------------------------------------------------*/ /**
  438. * A faster alternative to `Function#apply`, this function invokes `func`
  439. * with the `this` binding of `thisArg` and the arguments of `args`.
  440. *
  441. * @private
  442. * @param {Function} func The function to invoke.
  443. * @param {*} thisArg The `this` binding of `func`.
  444. * @param {Array} args The arguments to invoke `func` with.
  445. * @returns {*} Returns the result of `func`.
  446. */function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2]);}return func.apply(thisArg,args);}/**
  447. * A specialized version of `baseAggregator` for arrays.
  448. *
  449. * @private
  450. * @param {Array} [array] The array to iterate over.
  451. * @param {Function} setter The function to set `accumulator` values.
  452. * @param {Function} iteratee The iteratee to transform keys.
  453. * @param {Object} accumulator The initial aggregated object.
  454. * @returns {Function} Returns `accumulator`.
  455. */function arrayAggregator(array,setter,iteratee,accumulator){var index=-1,length=array==null?0:array.length;while(++index<length){var value=array[index];setter(accumulator,value,iteratee(value),array);}return accumulator;}/**
  456. * A specialized version of `_.forEach` for arrays without support for
  457. * iteratee shorthands.
  458. *
  459. * @private
  460. * @param {Array} [array] The array to iterate over.
  461. * @param {Function} iteratee The function invoked per iteration.
  462. * @returns {Array} Returns `array`.
  463. */function arrayEach(array,iteratee){var index=-1,length=array==null?0:array.length;while(++index<length){if(iteratee(array[index],index,array)===false){break;}}return array;}/**
  464. * A specialized version of `_.forEachRight` for arrays without support for
  465. * iteratee shorthands.
  466. *
  467. * @private
  468. * @param {Array} [array] The array to iterate over.
  469. * @param {Function} iteratee The function invoked per iteration.
  470. * @returns {Array} Returns `array`.
  471. */function arrayEachRight(array,iteratee){var length=array==null?0:array.length;while(length--){if(iteratee(array[length],length,array)===false){break;}}return array;}/**
  472. * A specialized version of `_.every` for arrays without support for
  473. * iteratee shorthands.
  474. *
  475. * @private
  476. * @param {Array} [array] The array to iterate over.
  477. * @param {Function} predicate The function invoked per iteration.
  478. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  479. * else `false`.
  480. */function arrayEvery(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length){if(!predicate(array[index],index,array)){return false;}}return true;}/**
  481. * A specialized version of `_.filter` for arrays without support for
  482. * iteratee shorthands.
  483. *
  484. * @private
  485. * @param {Array} [array] The array to iterate over.
  486. * @param {Function} predicate The function invoked per iteration.
  487. * @returns {Array} Returns the new filtered array.
  488. */function arrayFilter(array,predicate){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array)){result[resIndex++]=value;}}return result;}/**
  489. * A specialized version of `_.includes` for arrays without support for
  490. * specifying an index to search from.
  491. *
  492. * @private
  493. * @param {Array} [array] The array to inspect.
  494. * @param {*} target The value to search for.
  495. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  496. */function arrayIncludes(array,value){var length=array==null?0:array.length;return !!length&&baseIndexOf(array,value,0)>-1;}/**
  497. * This function is like `arrayIncludes` except that it accepts a comparator.
  498. *
  499. * @private
  500. * @param {Array} [array] The array to inspect.
  501. * @param {*} target The value to search for.
  502. * @param {Function} comparator The comparator invoked per element.
  503. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  504. */function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index<length){if(comparator(value,array[index])){return true;}}return false;}/**
  505. * A specialized version of `_.map` for arrays without support for iteratee
  506. * shorthands.
  507. *
  508. * @private
  509. * @param {Array} [array] The array to iterate over.
  510. * @param {Function} iteratee The function invoked per iteration.
  511. * @returns {Array} Returns the new mapped array.
  512. */function arrayMap(array,iteratee){var index=-1,length=array==null?0:array.length,result=Array(length);while(++index<length){result[index]=iteratee(array[index],index,array);}return result;}/**
  513. * Appends the elements of `values` to `array`.
  514. *
  515. * @private
  516. * @param {Array} array The array to modify.
  517. * @param {Array} values The values to append.
  518. * @returns {Array} Returns `array`.
  519. */function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length){array[offset+index]=values[index];}return array;}/**
  520. * A specialized version of `_.reduce` for arrays without support for
  521. * iteratee shorthands.
  522. *
  523. * @private
  524. * @param {Array} [array] The array to iterate over.
  525. * @param {Function} iteratee The function invoked per iteration.
  526. * @param {*} [accumulator] The initial value.
  527. * @param {boolean} [initAccum] Specify using the first element of `array` as
  528. * the initial value.
  529. * @returns {*} Returns the accumulated value.
  530. */function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array==null?0:array.length;if(initAccum&&length){accumulator=array[++index];}while(++index<length){accumulator=iteratee(accumulator,array[index],index,array);}return accumulator;}/**
  531. * A specialized version of `_.reduceRight` for arrays without support for
  532. * iteratee shorthands.
  533. *
  534. * @private
  535. * @param {Array} [array] The array to iterate over.
  536. * @param {Function} iteratee The function invoked per iteration.
  537. * @param {*} [accumulator] The initial value.
  538. * @param {boolean} [initAccum] Specify using the last element of `array` as
  539. * the initial value.
  540. * @returns {*} Returns the accumulated value.
  541. */function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=array==null?0:array.length;if(initAccum&&length){accumulator=array[--length];}while(length--){accumulator=iteratee(accumulator,array[length],length,array);}return accumulator;}/**
  542. * A specialized version of `_.some` for arrays without support for iteratee
  543. * shorthands.
  544. *
  545. * @private
  546. * @param {Array} [array] The array to iterate over.
  547. * @param {Function} predicate The function invoked per iteration.
  548. * @returns {boolean} Returns `true` if any element passes the predicate check,
  549. * else `false`.
  550. */function arraySome(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length){if(predicate(array[index],index,array)){return true;}}return false;}/**
  551. * Gets the size of an ASCII `string`.
  552. *
  553. * @private
  554. * @param {string} string The string inspect.
  555. * @returns {number} Returns the string size.
  556. */var asciiSize=baseProperty('length');/**
  557. * Converts an ASCII `string` to an array.
  558. *
  559. * @private
  560. * @param {string} string The string to convert.
  561. * @returns {Array} Returns the converted array.
  562. */function asciiToArray(string){return string.split('');}/**
  563. * Splits an ASCII `string` into an array of its words.
  564. *
  565. * @private
  566. * @param {string} The string to inspect.
  567. * @returns {Array} Returns the words of `string`.
  568. */function asciiWords(string){return string.match(reAsciiWord)||[];}/**
  569. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  570. * without support for iteratee shorthands, which iterates over `collection`
  571. * using `eachFunc`.
  572. *
  573. * @private
  574. * @param {Array|Object} collection The collection to inspect.
  575. * @param {Function} predicate The function invoked per iteration.
  576. * @param {Function} eachFunc The function to iterate over `collection`.
  577. * @returns {*} Returns the found element or its key, else `undefined`.
  578. */function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key;return false;}});return result;}/**
  579. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  580. * support for iteratee shorthands.
  581. *
  582. * @private
  583. * @param {Array} array The array to inspect.
  584. * @param {Function} predicate The function invoked per iteration.
  585. * @param {number} fromIndex The index to search from.
  586. * @param {boolean} [fromRight] Specify iterating from right to left.
  587. * @returns {number} Returns the index of the matched value, else `-1`.
  588. */function baseFindIndex(array,predicate,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length){if(predicate(array[index],index,array)){return index;}}return -1;}/**
  589. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  590. *
  591. * @private
  592. * @param {Array} array The array to inspect.
  593. * @param {*} value The value to search for.
  594. * @param {number} fromIndex The index to search from.
  595. * @returns {number} Returns the index of the matched value, else `-1`.
  596. */function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex);}/**
  597. * This function is like `baseIndexOf` except that it accepts a comparator.
  598. *
  599. * @private
  600. * @param {Array} array The array to inspect.
  601. * @param {*} value The value to search for.
  602. * @param {number} fromIndex The index to search from.
  603. * @param {Function} comparator The comparator invoked per element.
  604. * @returns {number} Returns the index of the matched value, else `-1`.
  605. */function baseIndexOfWith(array,value,fromIndex,comparator){var index=fromIndex-1,length=array.length;while(++index<length){if(comparator(array[index],value)){return index;}}return -1;}/**
  606. * The base implementation of `_.isNaN` without support for number objects.
  607. *
  608. * @private
  609. * @param {*} value The value to check.
  610. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  611. */function baseIsNaN(value){return value!==value;}/**
  612. * The base implementation of `_.mean` and `_.meanBy` without support for
  613. * iteratee shorthands.
  614. *
  615. * @private
  616. * @param {Array} array The array to iterate over.
  617. * @param {Function} iteratee The function invoked per iteration.
  618. * @returns {number} Returns the mean.
  619. */function baseMean(array,iteratee){var length=array==null?0:array.length;return length?baseSum(array,iteratee)/length:NAN;}/**
  620. * The base implementation of `_.property` without support for deep paths.
  621. *
  622. * @private
  623. * @param {string} key The key of the property to get.
  624. * @returns {Function} Returns the new accessor function.
  625. */function baseProperty(key){return function(object){return object==null?undefined$1:object[key];};}/**
  626. * The base implementation of `_.propertyOf` without support for deep paths.
  627. *
  628. * @private
  629. * @param {Object} object The object to query.
  630. * @returns {Function} Returns the new accessor function.
  631. */function basePropertyOf(object){return function(key){return object==null?undefined$1:object[key];};}/**
  632. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  633. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  634. *
  635. * @private
  636. * @param {Array|Object} collection The collection to iterate over.
  637. * @param {Function} iteratee The function invoked per iteration.
  638. * @param {*} accumulator The initial value.
  639. * @param {boolean} initAccum Specify using the first or last element of
  640. * `collection` as the initial value.
  641. * @param {Function} eachFunc The function to iterate over `collection`.
  642. * @returns {*} Returns the accumulated value.
  643. */function baseReduce(collection,iteratee,accumulator,initAccum,eachFunc){eachFunc(collection,function(value,index,collection){accumulator=initAccum?(initAccum=false,value):iteratee(accumulator,value,index,collection);});return accumulator;}/**
  644. * The base implementation of `_.sortBy` which uses `comparer` to define the
  645. * sort order of `array` and replaces criteria objects with their corresponding
  646. * values.
  647. *
  648. * @private
  649. * @param {Array} array The array to sort.
  650. * @param {Function} comparer The function to define sort order.
  651. * @returns {Array} Returns `array`.
  652. */function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--){array[length]=array[length].value;}return array;}/**
  653. * The base implementation of `_.sum` and `_.sumBy` without support for
  654. * iteratee shorthands.
  655. *
  656. * @private
  657. * @param {Array} array The array to iterate over.
  658. * @param {Function} iteratee The function invoked per iteration.
  659. * @returns {number} Returns the sum.
  660. */function baseSum(array,iteratee){var result,index=-1,length=array.length;while(++index<length){var current=iteratee(array[index]);if(current!==undefined$1){result=result===undefined$1?current:result+current;}}return result;}/**
  661. * The base implementation of `_.times` without support for iteratee shorthands
  662. * or max array length checks.
  663. *
  664. * @private
  665. * @param {number} n The number of times to invoke `iteratee`.
  666. * @param {Function} iteratee The function invoked per iteration.
  667. * @returns {Array} Returns the array of results.
  668. */function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n){result[index]=iteratee(index);}return result;}/**
  669. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  670. * of key-value pairs for `object` corresponding to the property names of `props`.
  671. *
  672. * @private
  673. * @param {Object} object The object to query.
  674. * @param {Array} props The property names to get values for.
  675. * @returns {Object} Returns the key-value pairs.
  676. */function baseToPairs(object,props){return arrayMap(props,function(key){return [key,object[key]];});}/**
  677. * The base implementation of `_.trim`.
  678. *
  679. * @private
  680. * @param {string} string The string to trim.
  681. * @returns {string} Returns the trimmed string.
  682. */function baseTrim(string){return string?string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,''):string;}/**
  683. * The base implementation of `_.unary` without support for storing metadata.
  684. *
  685. * @private
  686. * @param {Function} func The function to cap arguments for.
  687. * @returns {Function} Returns the new capped function.
  688. */function baseUnary(func){return function(value){return func(value);};}/**
  689. * The base implementation of `_.values` and `_.valuesIn` which creates an
  690. * array of `object` property values corresponding to the property names
  691. * of `props`.
  692. *
  693. * @private
  694. * @param {Object} object The object to query.
  695. * @param {Array} props The property names to get values for.
  696. * @returns {Object} Returns the array of property values.
  697. */function baseValues(object,props){return arrayMap(props,function(key){return object[key];});}/**
  698. * Checks if a `cache` value for `key` exists.
  699. *
  700. * @private
  701. * @param {Object} cache The cache to query.
  702. * @param {string} key The key of the entry to check.
  703. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  704. */function cacheHas(cache,key){return cache.has(key);}/**
  705. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  706. * that is not found in the character symbols.
  707. *
  708. * @private
  709. * @param {Array} strSymbols The string symbols to inspect.
  710. * @param {Array} chrSymbols The character symbols to find.
  711. * @returns {number} Returns the index of the first unmatched string symbol.
  712. */function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length;while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index;}/**
  713. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  714. * that is not found in the character symbols.
  715. *
  716. * @private
  717. * @param {Array} strSymbols The string symbols to inspect.
  718. * @param {Array} chrSymbols The character symbols to find.
  719. * @returns {number} Returns the index of the last unmatched string symbol.
  720. */function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index;}/**
  721. * Gets the number of `placeholder` occurrences in `array`.
  722. *
  723. * @private
  724. * @param {Array} array The array to inspect.
  725. * @param {*} placeholder The placeholder to search for.
  726. * @returns {number} Returns the placeholder count.
  727. */function countHolders(array,placeholder){var length=array.length,result=0;while(length--){if(array[length]===placeholder){++result;}}return result;}/**
  728. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  729. * letters to basic Latin letters.
  730. *
  731. * @private
  732. * @param {string} letter The matched letter to deburr.
  733. * @returns {string} Returns the deburred letter.
  734. */var deburrLetter=basePropertyOf(deburredLetters);/**
  735. * Used by `_.escape` to convert characters to HTML entities.
  736. *
  737. * @private
  738. * @param {string} chr The matched character to escape.
  739. * @returns {string} Returns the escaped character.
  740. */var escapeHtmlChar=basePropertyOf(htmlEscapes);/**
  741. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  742. *
  743. * @private
  744. * @param {string} chr The matched character to escape.
  745. * @returns {string} Returns the escaped character.
  746. */function escapeStringChar(chr){return '\\'+stringEscapes[chr];}/**
  747. * Gets the value at `key` of `object`.
  748. *
  749. * @private
  750. * @param {Object} [object] The object to query.
  751. * @param {string} key The key of the property to get.
  752. * @returns {*} Returns the property value.
  753. */function getValue(object,key){return object==null?undefined$1:object[key];}/**
  754. * Checks if `string` contains Unicode symbols.
  755. *
  756. * @private
  757. * @param {string} string The string to inspect.
  758. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  759. */function hasUnicode(string){return reHasUnicode.test(string);}/**
  760. * Checks if `string` contains a word composed of Unicode symbols.
  761. *
  762. * @private
  763. * @param {string} string The string to inspect.
  764. * @returns {boolean} Returns `true` if a word is found, else `false`.
  765. */function hasUnicodeWord(string){return reHasUnicodeWord.test(string);}/**
  766. * Converts `iterator` to an array.
  767. *
  768. * @private
  769. * @param {Object} iterator The iterator to convert.
  770. * @returns {Array} Returns the converted array.
  771. */function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done){result.push(data.value);}return result;}/**
  772. * Converts `map` to its key-value pairs.
  773. *
  774. * @private
  775. * @param {Object} map The map to convert.
  776. * @returns {Array} Returns the key-value pairs.
  777. */function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value];});return result;}/**
  778. * Creates a unary function that invokes `func` with its argument transformed.
  779. *
  780. * @private
  781. * @param {Function} func The function to wrap.
  782. * @param {Function} transform The argument transform.
  783. * @returns {Function} Returns the new function.
  784. */function overArg(func,transform){return function(arg){return func(transform(arg));};}/**
  785. * Replaces all `placeholder` elements in `array` with an internal placeholder
  786. * and returns an array of their indexes.
  787. *
  788. * @private
  789. * @param {Array} array The array to modify.
  790. * @param {*} placeholder The placeholder to replace.
  791. * @returns {Array} Returns the new array of placeholder indexes.
  792. */function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value===placeholder||value===PLACEHOLDER){array[index]=PLACEHOLDER;result[resIndex++]=index;}}return result;}/**
  793. * Converts `set` to an array of its values.
  794. *
  795. * @private
  796. * @param {Object} set The set to convert.
  797. * @returns {Array} Returns the values.
  798. */function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value;});return result;}/**
  799. * Converts `set` to its value-value pairs.
  800. *
  801. * @private
  802. * @param {Object} set The set to convert.
  803. * @returns {Array} Returns the value-value pairs.
  804. */function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value];});return result;}/**
  805. * A specialized version of `_.indexOf` which performs strict equality
  806. * comparisons of values, i.e. `===`.
  807. *
  808. * @private
  809. * @param {Array} array The array to inspect.
  810. * @param {*} value The value to search for.
  811. * @param {number} fromIndex The index to search from.
  812. * @returns {number} Returns the index of the matched value, else `-1`.
  813. */function strictIndexOf(array,value,fromIndex){var index=fromIndex-1,length=array.length;while(++index<length){if(array[index]===value){return index;}}return -1;}/**
  814. * A specialized version of `_.lastIndexOf` which performs strict equality
  815. * comparisons of values, i.e. `===`.
  816. *
  817. * @private
  818. * @param {Array} array The array to inspect.
  819. * @param {*} value The value to search for.
  820. * @param {number} fromIndex The index to search from.
  821. * @returns {number} Returns the index of the matched value, else `-1`.
  822. */function strictLastIndexOf(array,value,fromIndex){var index=fromIndex+1;while(index--){if(array[index]===value){return index;}}return index;}/**
  823. * Gets the number of symbols in `string`.
  824. *
  825. * @private
  826. * @param {string} string The string to inspect.
  827. * @returns {number} Returns the string size.
  828. */function stringSize(string){return hasUnicode(string)?unicodeSize(string):asciiSize(string);}/**
  829. * Converts `string` to an array.
  830. *
  831. * @private
  832. * @param {string} string The string to convert.
  833. * @returns {Array} Returns the converted array.
  834. */function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string);}/**
  835. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  836. * character of `string`.
  837. *
  838. * @private
  839. * @param {string} string The string to inspect.
  840. * @returns {number} Returns the index of the last non-whitespace character.
  841. */function trimmedEndIndex(string){var index=string.length;while(index--&&reWhitespace.test(string.charAt(index))){}return index;}/**
  842. * Used by `_.unescape` to convert HTML entities to characters.
  843. *
  844. * @private
  845. * @param {string} chr The matched character to unescape.
  846. * @returns {string} Returns the unescaped character.
  847. */var unescapeHtmlChar=basePropertyOf(htmlUnescapes);/**
  848. * Gets the size of a Unicode `string`.
  849. *
  850. * @private
  851. * @param {string} string The string inspect.
  852. * @returns {number} Returns the string size.
  853. */function unicodeSize(string){var result=reUnicode.lastIndex=0;while(reUnicode.test(string)){++result;}return result;}/**
  854. * Converts a Unicode `string` to an array.
  855. *
  856. * @private
  857. * @param {string} string The string to convert.
  858. * @returns {Array} Returns the converted array.
  859. */function unicodeToArray(string){return string.match(reUnicode)||[];}/**
  860. * Splits a Unicode `string` into an array of its words.
  861. *
  862. * @private
  863. * @param {string} The string to inspect.
  864. * @returns {Array} Returns the words of `string`.
  865. */function unicodeWords(string){return string.match(reUnicodeWord)||[];}/*--------------------------------------------------------------------------*/ /**
  866. * Create a new pristine `lodash` function using the `context` object.
  867. *
  868. * @static
  869. * @memberOf _
  870. * @since 1.1.0
  871. * @category Util
  872. * @param {Object} [context=root] The context object.
  873. * @returns {Function} Returns a new `lodash` function.
  874. * @example
  875. *
  876. * _.mixin({ 'foo': _.constant('foo') });
  877. *
  878. * var lodash = _.runInContext();
  879. * lodash.mixin({ 'bar': lodash.constant('bar') });
  880. *
  881. * _.isFunction(_.foo);
  882. * // => true
  883. * _.isFunction(_.bar);
  884. * // => false
  885. *
  886. * lodash.isFunction(lodash.foo);
  887. * // => false
  888. * lodash.isFunction(lodash.bar);
  889. * // => true
  890. *
  891. * // Create a suped-up `defer` in Node.js.
  892. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  893. */var runInContext=function runInContext(context){context=context==null?root:_.defaults(root.Object(),context,_.pick(root,contextProps));/** Built-in constructor references. */var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;/** Used for built-in method references. */var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;/** Used to detect overreaching core-js shims. */var coreJsData=context['__core-js_shared__'];/** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString;/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty;/** Used to generate unique IDs. */var idCounter=0;/** Used to detect methods masquerading as native. */var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||'');return uid?'Symbol(src)_1.'+uid:'';}();/**
  894. * Used to resolve the
  895. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  896. * of values.
  897. */var nativeObjectToString=objectProto.toString;/** Used to infer the `Object` constructor. */var objectCtorString=funcToString.call(Object);/** Used to restore the original `_` reference in `_.noConflict`. */var oldDash=root._;/** Used to detect if a method is native. */var reIsNative=RegExp('^'+funcToString.call(hasOwnProperty).replace(reRegExpChar,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');/** Built-in value references. */var Buffer=moduleExports?context.Buffer:undefined$1,Symbol=context.Symbol,Uint8Array=context.Uint8Array,allocUnsafe=Buffer?Buffer.allocUnsafe:undefined$1,getPrototype=overArg(Object.getPrototypeOf,Object),objectCreate=Object.create,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:undefined$1,symIterator=Symbol?Symbol.iterator:undefined$1,symToStringTag=Symbol?Symbol.toStringTag:undefined$1;var defineProperty=function(){try{var func=getNative(Object,'defineProperty');func({},'',{});return func;}catch(e){}}();/** Mocked built-ins. */var ctxClearTimeout=context.clearTimeout!==root.clearTimeout&&context.clearTimeout,ctxNow=Date&&Date.now!==root.Date.now&&Date.now,ctxSetTimeout=context.setTimeout!==root.setTimeout&&context.setTimeout;/* Built-in method references for those with the same name as other `lodash` methods. */var nativeCeil=Math.ceil,nativeFloor=Math.floor,nativeGetSymbols=Object.getOwnPropertySymbols,nativeIsBuffer=Buffer?Buffer.isBuffer:undefined$1,nativeIsFinite=context.isFinite,nativeJoin=arrayProto.join,nativeKeys=overArg(Object.keys,Object),nativeMax=Math.max,nativeMin=Math.min,nativeNow=Date.now,nativeParseInt=context.parseInt,nativeRandom=Math.random,nativeReverse=arrayProto.reverse;/* Built-in method references that are verified to be native. */var DataView=getNative(context,'DataView'),Map=getNative(context,'Map'),Promise=getNative(context,'Promise'),Set=getNative(context,'Set'),WeakMap=getNative(context,'WeakMap'),nativeCreate=getNative(Object,'create');/** Used to store function metadata. */var metaMap=WeakMap&&new WeakMap();/** Used to lookup unminified function names. */var realNames={};/** Used to detect maps, sets, and weakmaps. */var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);/** Used to convert symbols to primitives and strings. */var symbolProto=Symbol?Symbol.prototype:undefined$1,symbolValueOf=symbolProto?symbolProto.valueOf:undefined$1,symbolToString=symbolProto?symbolProto.toString:undefined$1;/*------------------------------------------------------------------------*/ /**
  898. * Creates a `lodash` object which wraps `value` to enable implicit method
  899. * chain sequences. Methods that operate on and return arrays, collections,
  900. * and functions can be chained together. Methods that retrieve a single value
  901. * or may return a primitive value will automatically end the chain sequence
  902. * and return the unwrapped value. Otherwise, the value must be unwrapped
  903. * with `_#value`.
  904. *
  905. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  906. * enabled using `_.chain`.
  907. *
  908. * The execution of chained methods is lazy, that is, it's deferred until
  909. * `_#value` is implicitly or explicitly called.
  910. *
  911. * Lazy evaluation allows several methods to support shortcut fusion.
  912. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  913. * the creation of intermediate arrays and can greatly reduce the number of
  914. * iteratee executions. Sections of a chain sequence qualify for shortcut
  915. * fusion if the section is applied to an array and iteratees accept only
  916. * one argument. The heuristic for whether a section qualifies for shortcut
  917. * fusion is subject to change.
  918. *
  919. * Chaining is supported in custom builds as long as the `_#value` method is
  920. * directly or indirectly included in the build.
  921. *
  922. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  923. *
  924. * The wrapper `Array` methods are:
  925. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  926. *
  927. * The wrapper `String` methods are:
  928. * `replace` and `split`
  929. *
  930. * The wrapper methods that support shortcut fusion are:
  931. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  932. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  933. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  934. *
  935. * The chainable wrapper methods are:
  936. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  937. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  938. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  939. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  940. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  941. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  942. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  943. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  944. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  945. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  946. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  947. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  948. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  949. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  950. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  951. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  952. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  953. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  954. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  955. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  956. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  957. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  958. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  959. * `zipObject`, `zipObjectDeep`, and `zipWith`
  960. *
  961. * The wrapper methods that are **not** chainable by default are:
  962. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  963. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  964. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  965. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  966. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  967. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  968. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  969. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  970. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  971. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  972. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  973. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  974. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  975. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  976. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  977. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  978. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  979. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  980. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  981. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  982. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  983. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  984. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  985. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  986. * `upperFirst`, `value`, and `words`
  987. *
  988. * @name _
  989. * @constructor
  990. * @category Seq
  991. * @param {*} value The value to wrap in a `lodash` instance.
  992. * @returns {Object} Returns the new `lodash` wrapper instance.
  993. * @example
  994. *
  995. * function square(n) {
  996. * return n * n;
  997. * }
  998. *
  999. * var wrapped = _([1, 2, 3]);
  1000. *
  1001. * // Returns an unwrapped value.
  1002. * wrapped.reduce(_.add);
  1003. * // => 6
  1004. *
  1005. * // Returns a wrapped value.
  1006. * var squares = wrapped.map(square);
  1007. *
  1008. * _.isArray(squares);
  1009. * // => false
  1010. *
  1011. * _.isArray(squares.value());
  1012. * // => true
  1013. */function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper){return value;}if(hasOwnProperty.call(value,'__wrapped__')){return wrapperClone(value);}}return new LodashWrapper(value);}/**
  1014. * The base implementation of `_.create` without support for assigning
  1015. * properties to the created object.
  1016. *
  1017. * @private
  1018. * @param {Object} proto The object to inherit from.
  1019. * @returns {Object} Returns the new object.
  1020. */var baseCreate=function(){function object(){}return function(proto){if(!isObject(proto)){return {};}if(objectCreate){return objectCreate(proto);}object.prototype=proto;var result=new object();object.prototype=undefined$1;return result;};}();/**
  1021. * The function whose prototype chain sequence wrappers inherit from.
  1022. *
  1023. * @private
  1024. */function baseLodash(){// No operation performed.
  1025. }/**
  1026. * The base constructor for creating `lodash` wrapper objects.
  1027. *
  1028. * @private
  1029. * @param {*} value The value to wrap.
  1030. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  1031. */function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined$1;}/**
  1032. * By default, the template delimiters used by lodash are like those in
  1033. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  1034. * following template settings to use alternative delimiters.
  1035. *
  1036. * @static
  1037. * @memberOf _
  1038. * @type {Object}
  1039. */lodash.templateSettings={/**
  1040. * Used to detect `data` property values to be HTML-escaped.
  1041. *
  1042. * @memberOf _.templateSettings
  1043. * @type {RegExp}
  1044. */'escape':reEscape,/**
  1045. * Used to detect code to be evaluated.
  1046. *
  1047. * @memberOf _.templateSettings
  1048. * @type {RegExp}
  1049. */'evaluate':reEvaluate,/**
  1050. * Used to detect `data` property values to inject.
  1051. *
  1052. * @memberOf _.templateSettings
  1053. * @type {RegExp}
  1054. */'interpolate':reInterpolate,/**
  1055. * Used to reference the data object in the template text.
  1056. *
  1057. * @memberOf _.templateSettings
  1058. * @type {string}
  1059. */'variable':'',/**
  1060. * Used to import variables into the compiled template.
  1061. *
  1062. * @memberOf _.templateSettings
  1063. * @type {Object}
  1064. */'imports':{/**
  1065. * A reference to the `lodash` function.
  1066. *
  1067. * @memberOf _.templateSettings.imports
  1068. * @type {Function}
  1069. */'_':lodash}};// Ensure wrappers are instances of `baseLodash`.
  1070. lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype);LodashWrapper.prototype.constructor=LodashWrapper;/*------------------------------------------------------------------------*/ /**
  1071. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  1072. *
  1073. * @private
  1074. * @constructor
  1075. * @param {*} value The value to wrap.
  1076. */function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[];}/**
  1077. * Creates a clone of the lazy wrapper object.
  1078. *
  1079. * @private
  1080. * @name clone
  1081. * @memberOf LazyWrapper
  1082. * @returns {Object} Returns the cloned `LazyWrapper` object.
  1083. */function lazyClone(){var result=new LazyWrapper(this.__wrapped__);result.__actions__=copyArray(this.__actions__);result.__dir__=this.__dir__;result.__filtered__=this.__filtered__;result.__iteratees__=copyArray(this.__iteratees__);result.__takeCount__=this.__takeCount__;result.__views__=copyArray(this.__views__);return result;}/**
  1084. * Reverses the direction of lazy iteration.
  1085. *
  1086. * @private
  1087. * @name reverse
  1088. * @memberOf LazyWrapper
  1089. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  1090. */function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1;result.__filtered__=true;}else {result=this.clone();result.__dir__*=-1;}return result;}/**
  1091. * Extracts the unwrapped value from its lazy wrapper.
  1092. *
  1093. * @private
  1094. * @name value
  1095. * @memberOf LazyWrapper
  1096. * @returns {*} Returns the unwrapped value.
  1097. */function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length){return baseWrapperValue(array,this.__actions__);}var result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,type=data.type,computed=iteratee(value);if(type==LAZY_MAP_FLAG){value=computed;}else if(!computed){if(type==LAZY_FILTER_FLAG){continue outer;}else {break outer;}}}result[resIndex++]=value;}return result;}// Ensure `LazyWrapper` is an instance of `baseLodash`.
  1098. LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;/*------------------------------------------------------------------------*/ /**
  1099. * Creates a hash object.
  1100. *
  1101. * @private
  1102. * @constructor
  1103. * @param {Array} [entries] The key-value pairs to cache.
  1104. */function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1]);}}/**
  1105. * Removes all key-value entries from the hash.
  1106. *
  1107. * @private
  1108. * @name clear
  1109. * @memberOf Hash
  1110. */function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0;}/**
  1111. * Removes `key` and its value from the hash.
  1112. *
  1113. * @private
  1114. * @name delete
  1115. * @memberOf Hash
  1116. * @param {Object} hash The hash to modify.
  1117. * @param {string} key The key of the value to remove.
  1118. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1119. */function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0;return result;}/**
  1120. * Gets the hash value for `key`.
  1121. *
  1122. * @private
  1123. * @name get
  1124. * @memberOf Hash
  1125. * @param {string} key The key of the value to get.
  1126. * @returns {*} Returns the entry value.
  1127. */function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined$1:result;}return hasOwnProperty.call(data,key)?data[key]:undefined$1;}/**
  1128. * Checks if a hash value for `key` exists.
  1129. *
  1130. * @private
  1131. * @name has
  1132. * @memberOf Hash
  1133. * @param {string} key The key of the entry to check.
  1134. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1135. */function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined$1:hasOwnProperty.call(data,key);}/**
  1136. * Sets the hash `key` to `value`.
  1137. *
  1138. * @private
  1139. * @name set
  1140. * @memberOf Hash
  1141. * @param {string} key The key of the value to set.
  1142. * @param {*} value The value to set.
  1143. * @returns {Object} Returns the hash instance.
  1144. */function hashSet(key,value){var data=this.__data__;this.size+=this.has(key)?0:1;data[key]=nativeCreate&&value===undefined$1?HASH_UNDEFINED:value;return this;}// Add methods to `Hash`.
  1145. Hash.prototype.clear=hashClear;Hash.prototype['delete']=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;/*------------------------------------------------------------------------*/ /**
  1146. * Creates an list cache object.
  1147. *
  1148. * @private
  1149. * @constructor
  1150. * @param {Array} [entries] The key-value pairs to cache.
  1151. */function ListCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1]);}}/**
  1152. * Removes all key-value entries from the list cache.
  1153. *
  1154. * @private
  1155. * @name clear
  1156. * @memberOf ListCache
  1157. */function listCacheClear(){this.__data__=[];this.size=0;}/**
  1158. * Removes `key` and its value from the list cache.
  1159. *
  1160. * @private
  1161. * @name delete
  1162. * @memberOf ListCache
  1163. * @param {string} key The key of the value to remove.
  1164. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1165. */function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false;}var lastIndex=data.length-1;if(index==lastIndex){data.pop();}else {splice.call(data,index,1);}--this.size;return true;}/**
  1166. * Gets the list cache value for `key`.
  1167. *
  1168. * @private
  1169. * @name get
  1170. * @memberOf ListCache
  1171. * @param {string} key The key of the value to get.
  1172. * @returns {*} Returns the entry value.
  1173. */function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined$1:data[index][1];}/**
  1174. * Checks if a list cache value for `key` exists.
  1175. *
  1176. * @private
  1177. * @name has
  1178. * @memberOf ListCache
  1179. * @param {string} key The key of the entry to check.
  1180. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1181. */function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1;}/**
  1182. * Sets the list cache `key` to `value`.
  1183. *
  1184. * @private
  1185. * @name set
  1186. * @memberOf ListCache
  1187. * @param {string} key The key of the value to set.
  1188. * @param {*} value The value to set.
  1189. * @returns {Object} Returns the list cache instance.
  1190. */function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value]);}else {data[index][1]=value;}return this;}// Add methods to `ListCache`.
  1191. ListCache.prototype.clear=listCacheClear;ListCache.prototype['delete']=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;/*------------------------------------------------------------------------*/ /**
  1192. * Creates a map cache object to store key-value pairs.
  1193. *
  1194. * @private
  1195. * @constructor
  1196. * @param {Array} [entries] The key-value pairs to cache.
  1197. */function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1]);}}/**
  1198. * Removes all key-value entries from the map.
  1199. *
  1200. * @private
  1201. * @name clear
  1202. * @memberOf MapCache
  1203. */function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}/**
  1204. * Removes `key` and its value from the map.
  1205. *
  1206. * @private
  1207. * @name delete
  1208. * @memberOf MapCache
  1209. * @param {string} key The key of the value to remove.
  1210. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1211. */function mapCacheDelete(key){var result=getMapData(this,key)['delete'](key);this.size-=result?1:0;return result;}/**
  1212. * Gets the map value for `key`.
  1213. *
  1214. * @private
  1215. * @name get
  1216. * @memberOf MapCache
  1217. * @param {string} key The key of the value to get.
  1218. * @returns {*} Returns the entry value.
  1219. */function mapCacheGet(key){return getMapData(this,key).get(key);}/**
  1220. * Checks if a map value for `key` exists.
  1221. *
  1222. * @private
  1223. * @name has
  1224. * @memberOf MapCache
  1225. * @param {string} key The key of the entry to check.
  1226. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1227. */function mapCacheHas(key){return getMapData(this,key).has(key);}/**
  1228. * Sets the map `key` to `value`.
  1229. *
  1230. * @private
  1231. * @name set
  1232. * @memberOf MapCache
  1233. * @param {string} key The key of the value to set.
  1234. * @param {*} value The value to set.
  1235. * @returns {Object} Returns the map cache instance.
  1236. */function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this;}// Add methods to `MapCache`.
  1237. MapCache.prototype.clear=mapCacheClear;MapCache.prototype['delete']=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;/*------------------------------------------------------------------------*/ /**
  1238. *
  1239. * Creates an array cache object to store unique values.
  1240. *
  1241. * @private
  1242. * @constructor
  1243. * @param {Array} [values] The values to cache.
  1244. */function SetCache(values){var index=-1,length=values==null?0:values.length;this.__data__=new MapCache();while(++index<length){this.add(values[index]);}}/**
  1245. * Adds `value` to the array cache.
  1246. *
  1247. * @private
  1248. * @name add
  1249. * @memberOf SetCache
  1250. * @alias push
  1251. * @param {*} value The value to cache.
  1252. * @returns {Object} Returns the cache instance.
  1253. */function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this;}/**
  1254. * Checks if `value` is in the array cache.
  1255. *
  1256. * @private
  1257. * @name has
  1258. * @memberOf SetCache
  1259. * @param {*} value The value to search for.
  1260. * @returns {number} Returns `true` if `value` is found, else `false`.
  1261. */function setCacheHas(value){return this.__data__.has(value);}// Add methods to `SetCache`.
  1262. SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;/*------------------------------------------------------------------------*/ /**
  1263. * Creates a stack cache object to store key-value pairs.
  1264. *
  1265. * @private
  1266. * @constructor
  1267. * @param {Array} [entries] The key-value pairs to cache.
  1268. */function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size;}/**
  1269. * Removes all key-value entries from the stack.
  1270. *
  1271. * @private
  1272. * @name clear
  1273. * @memberOf Stack
  1274. */function stackClear(){this.__data__=new ListCache();this.size=0;}/**
  1275. * Removes `key` and its value from the stack.
  1276. *
  1277. * @private
  1278. * @name delete
  1279. * @memberOf Stack
  1280. * @param {string} key The key of the value to remove.
  1281. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1282. */function stackDelete(key){var data=this.__data__,result=data['delete'](key);this.size=data.size;return result;}/**
  1283. * Gets the stack value for `key`.
  1284. *
  1285. * @private
  1286. * @name get
  1287. * @memberOf Stack
  1288. * @param {string} key The key of the value to get.
  1289. * @returns {*} Returns the entry value.
  1290. */function stackGet(key){return this.__data__.get(key);}/**
  1291. * Checks if a stack value for `key` exists.
  1292. *
  1293. * @private
  1294. * @name has
  1295. * @memberOf Stack
  1296. * @param {string} key The key of the entry to check.
  1297. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1298. */function stackHas(key){return this.__data__.has(key);}/**
  1299. * Sets the stack `key` to `value`.
  1300. *
  1301. * @private
  1302. * @name set
  1303. * @memberOf Stack
  1304. * @param {string} key The key of the value to set.
  1305. * @param {*} value The value to set.
  1306. * @returns {Object} Returns the stack cache instance.
  1307. */function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this;}data=this.__data__=new MapCache(pairs);}data.set(key,value);this.size=data.size;return this;}// Add methods to `Stack`.
  1308. Stack.prototype.clear=stackClear;Stack.prototype['delete']=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;/*------------------------------------------------------------------------*/ /**
  1309. * Creates an array of the enumerable property names of the array-like `value`.
  1310. *
  1311. * @private
  1312. * @param {*} value The value to query.
  1313. * @param {boolean} inherited Specify returning inherited property names.
  1314. * @returns {Array} Returns the array of property names.
  1315. */function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value){if((inherited||hasOwnProperty.call(value,key))&&!(skipIndexes&&(// Safari 9 has enumerable `arguments.length` in strict mode.
  1316. key=='length'||// Node.js 0.10 has enumerable non-index properties on buffers.
  1317. isBuff&&(key=='offset'||key=='parent')||// PhantomJS 2 has enumerable non-index properties on typed arrays.
  1318. isType&&(key=='buffer'||key=='byteLength'||key=='byteOffset')||// Skip index properties.
  1319. isIndex(key,length)))){result.push(key);}}return result;}/**
  1320. * A specialized version of `_.sample` for arrays.
  1321. *
  1322. * @private
  1323. * @param {Array} array The array to sample.
  1324. * @returns {*} Returns the random element.
  1325. */function arraySample(array){var length=array.length;return length?array[baseRandom(0,length-1)]:undefined$1;}/**
  1326. * A specialized version of `_.sampleSize` for arrays.
  1327. *
  1328. * @private
  1329. * @param {Array} array The array to sample.
  1330. * @param {number} n The number of elements to sample.
  1331. * @returns {Array} Returns the random elements.
  1332. */function arraySampleSize(array,n){return shuffleSelf(copyArray(array),baseClamp(n,0,array.length));}/**
  1333. * A specialized version of `_.shuffle` for arrays.
  1334. *
  1335. * @private
  1336. * @param {Array} array The array to shuffle.
  1337. * @returns {Array} Returns the new shuffled array.
  1338. */function arrayShuffle(array){return shuffleSelf(copyArray(array));}/**
  1339. * This function is like `assignValue` except that it doesn't assign
  1340. * `undefined` values.
  1341. *
  1342. * @private
  1343. * @param {Object} object The object to modify.
  1344. * @param {string} key The key of the property to assign.
  1345. * @param {*} value The value to assign.
  1346. */function assignMergeValue(object,key,value){if(value!==undefined$1&&!eq(object[key],value)||value===undefined$1&&!(key in object)){baseAssignValue(object,key,value);}}/**
  1347. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  1348. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  1349. * for equality comparisons.
  1350. *
  1351. * @private
  1352. * @param {Object} object The object to modify.
  1353. * @param {string} key The key of the property to assign.
  1354. * @param {*} value The value to assign.
  1355. */function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined$1&&!(key in object)){baseAssignValue(object,key,value);}}/**
  1356. * Gets the index at which the `key` is found in `array` of key-value pairs.
  1357. *
  1358. * @private
  1359. * @param {Array} array The array to inspect.
  1360. * @param {*} key The key to search for.
  1361. * @returns {number} Returns the index of the matched value, else `-1`.
  1362. */function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length;}}return -1;}/**
  1363. * Aggregates elements of `collection` on `accumulator` with keys transformed
  1364. * by `iteratee` and values set by `setter`.
  1365. *
  1366. * @private
  1367. * @param {Array|Object} collection The collection to iterate over.
  1368. * @param {Function} setter The function to set `accumulator` values.
  1369. * @param {Function} iteratee The iteratee to transform keys.
  1370. * @param {Object} accumulator The initial aggregated object.
  1371. * @returns {Function} Returns `accumulator`.
  1372. */function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator,value,iteratee(value),collection);});return accumulator;}/**
  1373. * The base implementation of `_.assign` without support for multiple sources
  1374. * or `customizer` functions.
  1375. *
  1376. * @private
  1377. * @param {Object} object The destination object.
  1378. * @param {Object} source The source object.
  1379. * @returns {Object} Returns `object`.
  1380. */function baseAssign(object,source){return object&&copyObject(source,keys(source),object);}/**
  1381. * The base implementation of `_.assignIn` without support for multiple sources
  1382. * or `customizer` functions.
  1383. *
  1384. * @private
  1385. * @param {Object} object The destination object.
  1386. * @param {Object} source The source object.
  1387. * @returns {Object} Returns `object`.
  1388. */function baseAssignIn(object,source){return object&&copyObject(source,keysIn(source),object);}/**
  1389. * The base implementation of `assignValue` and `assignMergeValue` without
  1390. * value checks.
  1391. *
  1392. * @private
  1393. * @param {Object} object The object to modify.
  1394. * @param {string} key The key of the property to assign.
  1395. * @param {*} value The value to assign.
  1396. */function baseAssignValue(object,key,value){if(key=='__proto__'&&defineProperty){defineProperty(object,key,{'configurable':true,'enumerable':true,'value':value,'writable':true});}else {object[key]=value;}}/**
  1397. * The base implementation of `_.at` without support for individual paths.
  1398. *
  1399. * @private
  1400. * @param {Object} object The object to iterate over.
  1401. * @param {string[]} paths The property paths to pick.
  1402. * @returns {Array} Returns the picked elements.
  1403. */function baseAt(object,paths){var index=-1,length=paths.length,result=Array(length),skip=object==null;while(++index<length){result[index]=skip?undefined$1:get(object,paths[index]);}return result;}/**
  1404. * The base implementation of `_.clamp` which doesn't coerce arguments.
  1405. *
  1406. * @private
  1407. * @param {number} number The number to clamp.
  1408. * @param {number} [lower] The lower bound.
  1409. * @param {number} upper The upper bound.
  1410. * @returns {number} Returns the clamped number.
  1411. */function baseClamp(number,lower,upper){if(number===number){if(upper!==undefined$1){number=number<=upper?number:upper;}if(lower!==undefined$1){number=number>=lower?number:lower;}}return number;}/**
  1412. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  1413. * traversed objects.
  1414. *
  1415. * @private
  1416. * @param {*} value The value to clone.
  1417. * @param {boolean} bitmask The bitmask flags.
  1418. * 1 - Deep clone
  1419. * 2 - Flatten inherited properties
  1420. * 4 - Clone symbols
  1421. * @param {Function} [customizer] The function to customize cloning.
  1422. * @param {string} [key] The key of `value`.
  1423. * @param {Object} [object] The parent object of `value`.
  1424. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  1425. * @returns {*} Returns the cloned value.
  1426. */function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer){result=object?customizer(value,key,object,stack):customizer(value);}if(result!==undefined$1){return result;}if(!isObject(value)){return value;}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return copyArray(value,result);}}else {var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value)){return cloneBuffer(value,isDeep);}if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep){return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value));}}else {if(!cloneableTags[tag]){return object?value:{};}result=initCloneByTag(value,tag,isDeep);}}// Check for circular references and return its corresponding clone.
  1427. stack||(stack=new Stack());var stacked=stack.get(value);if(stacked){return stacked;}stack.set(value,result);if(isSet(value)){value.forEach(function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack));});}else if(isMap(value)){value.forEach(function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,stack));});}var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined$1:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key];}// Recursively populate clone (susceptible to call stack limits).
  1428. assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack));});return result;}/**
  1429. * The base implementation of `_.conforms` which doesn't clone `source`.
  1430. *
  1431. * @private
  1432. * @param {Object} source The object of property predicates to conform to.
  1433. * @returns {Function} Returns the new spec function.
  1434. */function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props);};}/**
  1435. * The base implementation of `_.conformsTo` which accepts `props` to check.
  1436. *
  1437. * @private
  1438. * @param {Object} object The object to inspect.
  1439. * @param {Object} source The object of property predicates to conform to.
  1440. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  1441. */function baseConformsTo(object,source,props){var length=props.length;if(object==null){return !length;}object=Object(object);while(length--){var key=props[length],predicate=source[key],value=object[key];if(value===undefined$1&&!(key in object)||!predicate(value)){return false;}}return true;}/**
  1442. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  1443. * to provide to `func`.
  1444. *
  1445. * @private
  1446. * @param {Function} func The function to delay.
  1447. * @param {number} wait The number of milliseconds to delay invocation.
  1448. * @param {Array} args The arguments to provide to `func`.
  1449. * @returns {number|Object} Returns the timer id or timeout object.
  1450. */function baseDelay(func,wait,args){if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}return setTimeout(function(){func.apply(undefined$1,args);},wait);}/**
  1451. * The base implementation of methods like `_.difference` without support
  1452. * for excluding multiple arrays or iteratee shorthands.
  1453. *
  1454. * @private
  1455. * @param {Array} array The array to inspect.
  1456. * @param {Array} values The values to exclude.
  1457. * @param {Function} [iteratee] The iteratee invoked per element.
  1458. * @param {Function} [comparator] The comparator invoked per element.
  1459. * @returns {Array} Returns the new array of filtered values.
  1460. */function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length,result=[],valuesLength=values.length;if(!length){return result;}if(iteratee){values=arrayMap(values,baseUnary(iteratee));}if(comparator){includes=arrayIncludesWith;isCommon=false;}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values);}outer:while(++index<length){var value=array[index],computed=iteratee==null?value:iteratee(value);value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var valuesIndex=valuesLength;while(valuesIndex--){if(values[valuesIndex]===computed){continue outer;}}result.push(value);}else if(!includes(values,computed,comparator)){result.push(value);}}return result;}/**
  1461. * The base implementation of `_.forEach` without support for iteratee shorthands.
  1462. *
  1463. * @private
  1464. * @param {Array|Object} collection The collection to iterate over.
  1465. * @param {Function} iteratee The function invoked per iteration.
  1466. * @returns {Array|Object} Returns `collection`.
  1467. */var baseEach=createBaseEach(baseForOwn);/**
  1468. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  1469. *
  1470. * @private
  1471. * @param {Array|Object} collection The collection to iterate over.
  1472. * @param {Function} iteratee The function invoked per iteration.
  1473. * @returns {Array|Object} Returns `collection`.
  1474. */var baseEachRight=createBaseEach(baseForOwnRight,true);/**
  1475. * The base implementation of `_.every` without support for iteratee shorthands.
  1476. *
  1477. * @private
  1478. * @param {Array|Object} collection The collection to iterate over.
  1479. * @param {Function} predicate The function invoked per iteration.
  1480. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1481. * else `false`
  1482. */function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result;});return result;}/**
  1483. * The base implementation of methods like `_.max` and `_.min` which accepts a
  1484. * `comparator` to determine the extremum value.
  1485. *
  1486. * @private
  1487. * @param {Array} array The array to iterate over.
  1488. * @param {Function} iteratee The iteratee invoked per iteration.
  1489. * @param {Function} comparator The comparator used to compare values.
  1490. * @returns {*} Returns the extremum value.
  1491. */function baseExtremum(array,iteratee,comparator){var index=-1,length=array.length;while(++index<length){var value=array[index],current=iteratee(value);if(current!=null&&(computed===undefined$1?current===current&&!isSymbol(current):comparator(current,computed))){var computed=current,result=value;}}return result;}/**
  1492. * The base implementation of `_.fill` without an iteratee call guard.
  1493. *
  1494. * @private
  1495. * @param {Array} array The array to fill.
  1496. * @param {*} value The value to fill `array` with.
  1497. * @param {number} [start=0] The start position.
  1498. * @param {number} [end=array.length] The end position.
  1499. * @returns {Array} Returns `array`.
  1500. */function baseFill(array,value,start,end){var length=array.length;start=toInteger(start);if(start<0){start=-start>length?0:length+start;}end=end===undefined$1||end>length?length:toInteger(end);if(end<0){end+=length;}end=start>end?0:toLength(end);while(start<end){array[start++]=value;}return array;}/**
  1501. * The base implementation of `_.filter` without support for iteratee shorthands.
  1502. *
  1503. * @private
  1504. * @param {Array|Object} collection The collection to iterate over.
  1505. * @param {Function} predicate The function invoked per iteration.
  1506. * @returns {Array} Returns the new filtered array.
  1507. */function baseFilter(collection,predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection)){result.push(value);}});return result;}/**
  1508. * The base implementation of `_.flatten` with support for restricting flattening.
  1509. *
  1510. * @private
  1511. * @param {Array} array The array to flatten.
  1512. * @param {number} depth The maximum recursion depth.
  1513. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  1514. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  1515. * @param {Array} [result=[]] The initial result value.
  1516. * @returns {Array} Returns the new flattened array.
  1517. */function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){var value=array[index];if(depth>0&&predicate(value)){if(depth>1){// Recursively flatten arrays (susceptible to call stack limits).
  1518. baseFlatten(value,depth-1,predicate,isStrict,result);}else {arrayPush(result,value);}}else if(!isStrict){result[result.length]=value;}}return result;}/**
  1519. * The base implementation of `baseForOwn` which iterates over `object`
  1520. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  1521. * Iteratee functions may exit iteration early by explicitly returning `false`.
  1522. *
  1523. * @private
  1524. * @param {Object} object The object to iterate over.
  1525. * @param {Function} iteratee The function invoked per iteration.
  1526. * @param {Function} keysFunc The function to get the keys of `object`.
  1527. * @returns {Object} Returns `object`.
  1528. */var baseFor=createBaseFor();/**
  1529. * This function is like `baseFor` except that it iterates over properties
  1530. * in the opposite order.
  1531. *
  1532. * @private
  1533. * @param {Object} object The object to iterate over.
  1534. * @param {Function} iteratee The function invoked per iteration.
  1535. * @param {Function} keysFunc The function to get the keys of `object`.
  1536. * @returns {Object} Returns `object`.
  1537. */var baseForRight=createBaseFor(true);/**
  1538. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  1539. *
  1540. * @private
  1541. * @param {Object} object The object to iterate over.
  1542. * @param {Function} iteratee The function invoked per iteration.
  1543. * @returns {Object} Returns `object`.
  1544. */function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys);}/**
  1545. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  1546. *
  1547. * @private
  1548. * @param {Object} object The object to iterate over.
  1549. * @param {Function} iteratee The function invoked per iteration.
  1550. * @returns {Object} Returns `object`.
  1551. */function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys);}/**
  1552. * The base implementation of `_.functions` which creates an array of
  1553. * `object` function property names filtered from `props`.
  1554. *
  1555. * @private
  1556. * @param {Object} object The object to inspect.
  1557. * @param {Array} props The property names to filter.
  1558. * @returns {Array} Returns the function names.
  1559. */function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key]);});}/**
  1560. * The base implementation of `_.get` without support for default values.
  1561. *
  1562. * @private
  1563. * @param {Object} object The object to query.
  1564. * @param {Array|string} path The path of the property to get.
  1565. * @returns {*} Returns the resolved value.
  1566. */function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&index<length){object=object[toKey(path[index++])];}return index&&index==length?object:undefined$1;}/**
  1567. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  1568. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  1569. * symbols of `object`.
  1570. *
  1571. * @private
  1572. * @param {Object} object The object to query.
  1573. * @param {Function} keysFunc The function to get the keys of `object`.
  1574. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  1575. * @returns {Array} Returns the array of property names and symbols.
  1576. */function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object));}/**
  1577. * The base implementation of `getTag` without fallbacks for buggy environments.
  1578. *
  1579. * @private
  1580. * @param {*} value The value to query.
  1581. * @returns {string} Returns the `toStringTag`.
  1582. */function baseGetTag(value){if(value==null){return value===undefined$1?undefinedTag:nullTag;}return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value);}/**
  1583. * The base implementation of `_.gt` which doesn't coerce arguments.
  1584. *
  1585. * @private
  1586. * @param {*} value The value to compare.
  1587. * @param {*} other The other value to compare.
  1588. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  1589. * else `false`.
  1590. */function baseGt(value,other){return value>other;}/**
  1591. * The base implementation of `_.has` without support for deep paths.
  1592. *
  1593. * @private
  1594. * @param {Object} [object] The object to query.
  1595. * @param {Array|string} key The key to check.
  1596. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  1597. */function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key);}/**
  1598. * The base implementation of `_.hasIn` without support for deep paths.
  1599. *
  1600. * @private
  1601. * @param {Object} [object] The object to query.
  1602. * @param {Array|string} key The key to check.
  1603. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  1604. */function baseHasIn(object,key){return object!=null&&key in Object(object);}/**
  1605. * The base implementation of `_.inRange` which doesn't coerce arguments.
  1606. *
  1607. * @private
  1608. * @param {number} number The number to check.
  1609. * @param {number} start The start of the range.
  1610. * @param {number} end The end of the range.
  1611. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  1612. */function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end);}/**
  1613. * The base implementation of methods like `_.intersection`, without support
  1614. * for iteratee shorthands, that accepts an array of arrays to inspect.
  1615. *
  1616. * @private
  1617. * @param {Array} arrays The arrays to inspect.
  1618. * @param {Function} [iteratee] The iteratee invoked per element.
  1619. * @param {Function} [comparator] The comparator invoked per element.
  1620. * @returns {Array} Returns the new array of shared values.
  1621. */function baseIntersection(arrays,iteratee,comparator){var includes=comparator?arrayIncludesWith:arrayIncludes,length=arrays[0].length,othLength=arrays.length,othIndex=othLength,caches=Array(othLength),maxLength=Infinity,result=[];while(othIndex--){var array=arrays[othIndex];if(othIndex&&iteratee){array=arrayMap(array,baseUnary(iteratee));}maxLength=nativeMin(array.length,maxLength);caches[othIndex]=!comparator&&(iteratee||length>=120&&array.length>=120)?new SetCache(othIndex&&array):undefined$1;}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index<length&&result.length<maxLength){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(!(seen?cacheHas(seen,computed):includes(result,computed,comparator))){othIndex=othLength;while(--othIndex){var cache=caches[othIndex];if(!(cache?cacheHas(cache,computed):includes(arrays[othIndex],computed,comparator))){continue outer;}}if(seen){seen.push(computed);}result.push(value);}}return result;}/**
  1622. * The base implementation of `_.invert` and `_.invertBy` which inverts
  1623. * `object` with values transformed by `iteratee` and set by `setter`.
  1624. *
  1625. * @private
  1626. * @param {Object} object The object to iterate over.
  1627. * @param {Function} setter The function to set `accumulator` values.
  1628. * @param {Function} iteratee The iteratee to transform values.
  1629. * @param {Object} accumulator The initial inverted object.
  1630. * @returns {Function} Returns `accumulator`.
  1631. */function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object);});return accumulator;}/**
  1632. * The base implementation of `_.invoke` without support for individual
  1633. * method arguments.
  1634. *
  1635. * @private
  1636. * @param {Object} object The object to query.
  1637. * @param {Array|string} path The path of the method to invoke.
  1638. * @param {Array} args The arguments to invoke the method with.
  1639. * @returns {*} Returns the result of the invoked method.
  1640. */function baseInvoke(object,path,args){path=castPath(path,object);object=parent(object,path);var func=object==null?object:object[toKey(last(path))];return func==null?undefined$1:apply(func,object,args);}/**
  1641. * The base implementation of `_.isArguments`.
  1642. *
  1643. * @private
  1644. * @param {*} value The value to check.
  1645. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  1646. */function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag;}/**
  1647. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  1648. *
  1649. * @private
  1650. * @param {*} value The value to check.
  1651. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  1652. */function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag;}/**
  1653. * The base implementation of `_.isDate` without Node.js optimizations.
  1654. *
  1655. * @private
  1656. * @param {*} value The value to check.
  1657. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  1658. */function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag;}/**
  1659. * The base implementation of `_.isEqual` which supports partial comparisons
  1660. * and tracks traversed objects.
  1661. *
  1662. * @private
  1663. * @param {*} value The value to compare.
  1664. * @param {*} other The other value to compare.
  1665. * @param {boolean} bitmask The bitmask flags.
  1666. * 1 - Unordered comparison
  1667. * 2 - Partial comparison
  1668. * @param {Function} [customizer] The function to customize comparisons.
  1669. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  1670. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  1671. */function baseIsEqual(value,other,bitmask,customizer,stack){if(value===other){return true;}if(value==null||other==null||!isObjectLike(value)&&!isObjectLike(other)){return value!==value&&other!==other;}return baseIsEqualDeep(value,other,bitmask,customizer,baseIsEqual,stack);}/**
  1672. * A specialized version of `baseIsEqual` for arrays and objects which performs
  1673. * deep comparisons and tracks traversed objects enabling objects with circular
  1674. * references to be compared.
  1675. *
  1676. * @private
  1677. * @param {Object} object The object to compare.
  1678. * @param {Object} other The other object to compare.
  1679. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  1680. * @param {Function} customizer The function to customize comparisons.
  1681. * @param {Function} equalFunc The function to determine equivalents of values.
  1682. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  1683. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1684. */function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag;othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other)){return false;}objIsArr=true;objIsObj=false;}if(isSameTag&&!objIsObj){stack||(stack=new Stack());return objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack);}if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,'__wrapped__'),othIsWrapped=othIsObj&&hasOwnProperty.call(other,'__wrapped__');if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;stack||(stack=new Stack());return equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack);}}if(!isSameTag){return false;}stack||(stack=new Stack());return equalObjects(object,other,bitmask,customizer,equalFunc,stack);}/**
  1685. * The base implementation of `_.isMap` without Node.js optimizations.
  1686. *
  1687. * @private
  1688. * @param {*} value The value to check.
  1689. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  1690. */function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag;}/**
  1691. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  1692. *
  1693. * @private
  1694. * @param {Object} object The object to inspect.
  1695. * @param {Object} source The object of property values to match.
  1696. * @param {Array} matchData The property names, values, and compare flags to match.
  1697. * @param {Function} [customizer] The function to customize comparisons.
  1698. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  1699. */function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null){return !length;}object=Object(object);while(index--){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object)){return false;}}while(++index<length){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined$1&&!(key in object)){return false;}}else {var stack=new Stack();if(customizer){var result=customizer(objValue,srcValue,key,object,source,stack);}if(!(result===undefined$1?baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG,customizer,stack):result)){return false;}}}return true;}/**
  1700. * The base implementation of `_.isNative` without bad shim checks.
  1701. *
  1702. * @private
  1703. * @param {*} value The value to check.
  1704. * @returns {boolean} Returns `true` if `value` is a native function,
  1705. * else `false`.
  1706. */function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false;}var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value));}/**
  1707. * The base implementation of `_.isRegExp` without Node.js optimizations.
  1708. *
  1709. * @private
  1710. * @param {*} value The value to check.
  1711. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  1712. */function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag;}/**
  1713. * The base implementation of `_.isSet` without Node.js optimizations.
  1714. *
  1715. * @private
  1716. * @param {*} value The value to check.
  1717. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  1718. */function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag;}/**
  1719. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  1720. *
  1721. * @private
  1722. * @param {*} value The value to check.
  1723. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  1724. */function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)];}/**
  1725. * The base implementation of `_.iteratee`.
  1726. *
  1727. * @private
  1728. * @param {*} [value=_.identity] The value to convert to an iteratee.
  1729. * @returns {Function} Returns the iteratee.
  1730. */function baseIteratee(value){// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  1731. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  1732. if(typeof value=='function'){return value;}if(value==null){return identity;}if(typeof value=='object'){return isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value);}return property(value);}/**
  1733. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  1734. *
  1735. * @private
  1736. * @param {Object} object The object to query.
  1737. * @returns {Array} Returns the array of property names.
  1738. */function baseKeys(object){if(!isPrototype(object)){return nativeKeys(object);}var result=[];for(var key in Object(object)){if(hasOwnProperty.call(object,key)&&key!='constructor'){result.push(key);}}return result;}/**
  1739. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  1740. *
  1741. * @private
  1742. * @param {Object} object The object to query.
  1743. * @returns {Array} Returns the array of property names.
  1744. */function baseKeysIn(object){if(!isObject(object)){return nativeKeysIn(object);}var isProto=isPrototype(object),result=[];for(var key in object){if(!(key=='constructor'&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key);}}return result;}/**
  1745. * The base implementation of `_.lt` which doesn't coerce arguments.
  1746. *
  1747. * @private
  1748. * @param {*} value The value to compare.
  1749. * @param {*} other The other value to compare.
  1750. * @returns {boolean} Returns `true` if `value` is less than `other`,
  1751. * else `false`.
  1752. */function baseLt(value,other){return value<other;}/**
  1753. * The base implementation of `_.map` without support for iteratee shorthands.
  1754. *
  1755. * @private
  1756. * @param {Array|Object} collection The collection to iterate over.
  1757. * @param {Function} iteratee The function invoked per iteration.
  1758. * @returns {Array} Returns the new mapped array.
  1759. */function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection);});return result;}/**
  1760. * The base implementation of `_.matches` which doesn't clone `source`.
  1761. *
  1762. * @private
  1763. * @param {Object} source The object of property values to match.
  1764. * @returns {Function} Returns the new spec function.
  1765. */function baseMatches(source){var matchData=getMatchData(source);if(matchData.length==1&&matchData[0][2]){return matchesStrictComparable(matchData[0][0],matchData[0][1]);}return function(object){return object===source||baseIsMatch(object,source,matchData);};}/**
  1766. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  1767. *
  1768. * @private
  1769. * @param {string} path The path of the property to get.
  1770. * @param {*} srcValue The value to match.
  1771. * @returns {Function} Returns the new spec function.
  1772. */function baseMatchesProperty(path,srcValue){if(isKey(path)&&isStrictComparable(srcValue)){return matchesStrictComparable(toKey(path),srcValue);}return function(object){var objValue=get(object,path);return objValue===undefined$1&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG);};}/**
  1773. * The base implementation of `_.merge` without support for multiple sources.
  1774. *
  1775. * @private
  1776. * @param {Object} object The destination object.
  1777. * @param {Object} source The source object.
  1778. * @param {number} srcIndex The index of `source`.
  1779. * @param {Function} [customizer] The function to customize merged values.
  1780. * @param {Object} [stack] Tracks traversed source values and their merged
  1781. * counterparts.
  1782. */function baseMerge(object,source,srcIndex,customizer,stack){if(object===source){return;}baseFor(source,function(srcValue,key){stack||(stack=new Stack());if(isObject(srcValue)){baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack);}else {var newValue=customizer?customizer(safeGet(object,key),srcValue,key+'',object,source,stack):undefined$1;if(newValue===undefined$1){newValue=srcValue;}assignMergeValue(object,key,newValue);}},keysIn);}/**
  1783. * A specialized version of `baseMerge` for arrays and objects which performs
  1784. * deep merges and tracks traversed objects enabling objects with circular
  1785. * references to be merged.
  1786. *
  1787. * @private
  1788. * @param {Object} object The destination object.
  1789. * @param {Object} source The source object.
  1790. * @param {string} key The key of the value to merge.
  1791. * @param {number} srcIndex The index of `source`.
  1792. * @param {Function} mergeFunc The function to merge values.
  1793. * @param {Function} [customizer] The function to customize assigned values.
  1794. * @param {Object} [stack] Tracks traversed source values and their merged
  1795. * counterparts.
  1796. */function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=safeGet(object,key),srcValue=safeGet(source,key),stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return;}var newValue=customizer?customizer(objValue,srcValue,key+'',object,source,stack):undefined$1;var isCommon=newValue===undefined$1;if(isCommon){var isArr=isArray(srcValue),isBuff=!isArr&&isBuffer(srcValue),isTyped=!isArr&&!isBuff&&isTypedArray(srcValue);newValue=srcValue;if(isArr||isBuff||isTyped){if(isArray(objValue)){newValue=objValue;}else if(isArrayLikeObject(objValue)){newValue=copyArray(objValue);}else if(isBuff){isCommon=false;newValue=cloneBuffer(srcValue,true);}else if(isTyped){isCommon=false;newValue=cloneTypedArray(srcValue,true);}else {newValue=[];}}else if(isPlainObject(srcValue)||isArguments(srcValue)){newValue=objValue;if(isArguments(objValue)){newValue=toPlainObject(objValue);}else if(!isObject(objValue)||isFunction(objValue)){newValue=initCloneObject(srcValue);}}else {isCommon=false;}}if(isCommon){// Recursively merge objects and arrays (susceptible to call stack limits).
  1797. stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,stack);stack['delete'](srcValue);}assignMergeValue(object,key,newValue);}/**
  1798. * The base implementation of `_.nth` which doesn't coerce arguments.
  1799. *
  1800. * @private
  1801. * @param {Array} array The array to query.
  1802. * @param {number} n The index of the element to return.
  1803. * @returns {*} Returns the nth element of `array`.
  1804. */function baseNth(array,n){var length=array.length;if(!length){return;}n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined$1;}/**
  1805. * The base implementation of `_.orderBy` without param guards.
  1806. *
  1807. * @private
  1808. * @param {Array|Object} collection The collection to iterate over.
  1809. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  1810. * @param {string[]} orders The sort orders of `iteratees`.
  1811. * @returns {Array} Returns the new sorted array.
  1812. */function baseOrderBy(collection,iteratees,orders){if(iteratees.length){iteratees=arrayMap(iteratees,function(iteratee){if(isArray(iteratee)){return function(value){return baseGet(value,iteratee.length===1?iteratee[0]:iteratee);};}return iteratee;});}else {iteratees=[identity];}var index=-1;iteratees=arrayMap(iteratees,baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value);});return {'criteria':criteria,'index':++index,'value':value};});return baseSortBy(result,function(object,other){return compareMultiple(object,other,orders);});}/**
  1813. * The base implementation of `_.pick` without support for individual
  1814. * property identifiers.
  1815. *
  1816. * @private
  1817. * @param {Object} object The source object.
  1818. * @param {string[]} paths The property paths to pick.
  1819. * @returns {Object} Returns the new object.
  1820. */function basePick(object,paths){return basePickBy(object,paths,function(value,path){return hasIn(object,path);});}/**
  1821. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  1822. *
  1823. * @private
  1824. * @param {Object} object The source object.
  1825. * @param {string[]} paths The property paths to pick.
  1826. * @param {Function} predicate The function invoked per property.
  1827. * @returns {Object} Returns the new object.
  1828. */function basePickBy(object,paths,predicate){var index=-1,length=paths.length,result={};while(++index<length){var path=paths[index],value=baseGet(object,path);if(predicate(value,path)){baseSet(result,castPath(path,object),value);}}return result;}/**
  1829. * A specialized version of `baseProperty` which supports deep paths.
  1830. *
  1831. * @private
  1832. * @param {Array|string} path The path of the property to get.
  1833. * @returns {Function} Returns the new accessor function.
  1834. */function basePropertyDeep(path){return function(object){return baseGet(object,path);};}/**
  1835. * The base implementation of `_.pullAllBy` without support for iteratee
  1836. * shorthands.
  1837. *
  1838. * @private
  1839. * @param {Array} array The array to modify.
  1840. * @param {Array} values The values to remove.
  1841. * @param {Function} [iteratee] The iteratee invoked per element.
  1842. * @param {Function} [comparator] The comparator invoked per element.
  1843. * @returns {Array} Returns `array`.
  1844. */function basePullAll(array,values,iteratee,comparator){var indexOf=comparator?baseIndexOfWith:baseIndexOf,index=-1,length=values.length,seen=array;if(array===values){values=copyArray(values);}if(iteratee){seen=arrayMap(array,baseUnary(iteratee));}while(++index<length){var fromIndex=0,value=values[index],computed=iteratee?iteratee(value):value;while((fromIndex=indexOf(seen,computed,fromIndex,comparator))>-1){if(seen!==array){splice.call(seen,fromIndex,1);}splice.call(array,fromIndex,1);}}return array;}/**
  1845. * The base implementation of `_.pullAt` without support for individual
  1846. * indexes or capturing the removed elements.
  1847. *
  1848. * @private
  1849. * @param {Array} array The array to modify.
  1850. * @param {number[]} indexes The indexes of elements to remove.
  1851. * @returns {Array} Returns `array`.
  1852. */function basePullAt(array,indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index)){splice.call(array,index,1);}else {baseUnset(array,index);}}}return array;}/**
  1853. * The base implementation of `_.random` without support for returning
  1854. * floating-point numbers.
  1855. *
  1856. * @private
  1857. * @param {number} lower The lower bound.
  1858. * @param {number} upper The upper bound.
  1859. * @returns {number} Returns the random number.
  1860. */function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1));}/**
  1861. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  1862. * coerce arguments.
  1863. *
  1864. * @private
  1865. * @param {number} start The start of the range.
  1866. * @param {number} end The end of the range.
  1867. * @param {number} step The value to increment or decrement by.
  1868. * @param {boolean} [fromRight] Specify iterating from right to left.
  1869. * @returns {Array} Returns the range of numbers.
  1870. */function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?length:++index]=start;start+=step;}return result;}/**
  1871. * The base implementation of `_.repeat` which doesn't coerce arguments.
  1872. *
  1873. * @private
  1874. * @param {string} string The string to repeat.
  1875. * @param {number} n The number of times to repeat the string.
  1876. * @returns {string} Returns the repeated string.
  1877. */function baseRepeat(string,n){var result='';if(!string||n<1||n>MAX_SAFE_INTEGER){return result;}// Leverage the exponentiation by squaring algorithm for a faster repeat.
  1878. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  1879. do{if(n%2){result+=string;}n=nativeFloor(n/2);if(n){string+=string;}}while(n);return result;}/**
  1880. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  1881. *
  1882. * @private
  1883. * @param {Function} func The function to apply a rest parameter to.
  1884. * @param {number} [start=func.length-1] The start position of the rest parameter.
  1885. * @returns {Function} Returns the new function.
  1886. */function baseRest(func,start){return setToString(overRest(func,start,identity),func+'');}/**
  1887. * The base implementation of `_.sample`.
  1888. *
  1889. * @private
  1890. * @param {Array|Object} collection The collection to sample.
  1891. * @returns {*} Returns the random element.
  1892. */function baseSample(collection){return arraySample(values(collection));}/**
  1893. * The base implementation of `_.sampleSize` without param guards.
  1894. *
  1895. * @private
  1896. * @param {Array|Object} collection The collection to sample.
  1897. * @param {number} n The number of elements to sample.
  1898. * @returns {Array} Returns the random elements.
  1899. */function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length));}/**
  1900. * The base implementation of `_.set`.
  1901. *
  1902. * @private
  1903. * @param {Object} object The object to modify.
  1904. * @param {Array|string} path The path of the property to set.
  1905. * @param {*} value The value to set.
  1906. * @param {Function} [customizer] The function to customize path creation.
  1907. * @returns {Object} Returns `object`.
  1908. */function baseSet(object,path,value,customizer){if(!isObject(object)){return object;}path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(key==='__proto__'||key==='constructor'||key==='prototype'){return object;}if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined$1;if(newValue===undefined$1){newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{};}}assignValue(nested,key,newValue);nested=nested[key];}return object;}/**
  1909. * The base implementation of `setData` without support for hot loop shorting.
  1910. *
  1911. * @private
  1912. * @param {Function} func The function to associate metadata with.
  1913. * @param {*} data The metadata.
  1914. * @returns {Function} Returns `func`.
  1915. */var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func;};/**
  1916. * The base implementation of `setToString` without support for hot loop shorting.
  1917. *
  1918. * @private
  1919. * @param {Function} func The function to modify.
  1920. * @param {Function} string The `toString` result.
  1921. * @returns {Function} Returns `func`.
  1922. */var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,'toString',{'configurable':true,'enumerable':false,'value':constant(string),'writable':true});};/**
  1923. * The base implementation of `_.shuffle`.
  1924. *
  1925. * @private
  1926. * @param {Array|Object} collection The collection to shuffle.
  1927. * @returns {Array} Returns the new shuffled array.
  1928. */function baseShuffle(collection){return shuffleSelf(values(collection));}/**
  1929. * The base implementation of `_.slice` without an iteratee call guard.
  1930. *
  1931. * @private
  1932. * @param {Array} array The array to slice.
  1933. * @param {number} [start=0] The start position.
  1934. * @param {number} [end=array.length] The end position.
  1935. * @returns {Array} Returns the slice of `array`.
  1936. */function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start;}end=end>length?length:end;if(end<0){end+=length;}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length){result[index]=array[index+start];}return result;}/**
  1937. * The base implementation of `_.some` without support for iteratee shorthands.
  1938. *
  1939. * @private
  1940. * @param {Array|Object} collection The collection to iterate over.
  1941. * @param {Function} predicate The function invoked per iteration.
  1942. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1943. * else `false`.
  1944. */function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return !result;});return !!result;}/**
  1945. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  1946. * performs a binary search of `array` to determine the index at which `value`
  1947. * should be inserted into `array` in order to maintain its sort order.
  1948. *
  1949. * @private
  1950. * @param {Array} array The sorted array to inspect.
  1951. * @param {*} value The value to evaluate.
  1952. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  1953. * @returns {number} Returns the index at which `value` should be inserted
  1954. * into `array`.
  1955. */function baseSortedIndex(array,value,retHighest){var low=0,high=array==null?low:array.length;if(typeof value=='number'&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid=low+high>>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed<value)){low=mid+1;}else {high=mid;}}return high;}return baseSortedIndexBy(array,value,identity,retHighest);}/**
  1956. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  1957. * which invokes `iteratee` for `value` and each element of `array` to compute
  1958. * their sort ranking. The iteratee is invoked with one argument; (value).
  1959. *
  1960. * @private
  1961. * @param {Array} array The sorted array to inspect.
  1962. * @param {*} value The value to evaluate.
  1963. * @param {Function} iteratee The iteratee invoked per element.
  1964. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  1965. * @returns {number} Returns the index at which `value` should be inserted
  1966. * into `array`.
  1967. */function baseSortedIndexBy(array,value,iteratee,retHighest){var low=0,high=array==null?0:array.length;if(high===0){return 0;}value=iteratee(value);var valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined$1;while(low<high){var mid=nativeFloor((low+high)/2),computed=iteratee(array[mid]),othIsDefined=computed!==undefined$1,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN){var setLow=retHighest||othIsReflexive;}else if(valIsUndefined){setLow=othIsReflexive&&(retHighest||othIsDefined);}else if(valIsNull){setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull);}else if(valIsSymbol){setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol);}else if(othIsNull||othIsSymbol){setLow=false;}else {setLow=retHighest?computed<=value:computed<value;}if(setLow){low=mid+1;}else {high=mid;}}return nativeMin(high,MAX_ARRAY_INDEX);}/**
  1968. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  1969. * support for iteratee shorthands.
  1970. *
  1971. * @private
  1972. * @param {Array} array The array to inspect.
  1973. * @param {Function} [iteratee] The iteratee invoked per element.
  1974. * @returns {Array} Returns the new duplicate free array.
  1975. */function baseSortedUniq(array,iteratee){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;if(!index||!eq(computed,seen)){var seen=computed;result[resIndex++]=value===0?0:value;}}return result;}/**
  1976. * The base implementation of `_.toNumber` which doesn't ensure correct
  1977. * conversions of binary, hexadecimal, or octal string values.
  1978. *
  1979. * @private
  1980. * @param {*} value The value to process.
  1981. * @returns {number} Returns the number.
  1982. */function baseToNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}return +value;}/**
  1983. * The base implementation of `_.toString` which doesn't convert nullish
  1984. * values to empty strings.
  1985. *
  1986. * @private
  1987. * @param {*} value The value to process.
  1988. * @returns {string} Returns the string.
  1989. */function baseToString(value){// Exit early for strings to avoid a performance hit in some environments.
  1990. if(typeof value=='string'){return value;}if(isArray(value)){// Recursively convert values (susceptible to call stack limits).
  1991. return arrayMap(value,baseToString)+'';}if(isSymbol(value)){return symbolToString?symbolToString.call(value):'';}var result=value+'';return result=='0'&&1/value==-INFINITY?'-0':result;}/**
  1992. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  1993. *
  1994. * @private
  1995. * @param {Array} array The array to inspect.
  1996. * @param {Function} [iteratee] The iteratee invoked per element.
  1997. * @param {Function} [comparator] The comparator invoked per element.
  1998. * @returns {Array} Returns the new duplicate free array.
  1999. */function baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=true,result=[],seen=result;if(comparator){isCommon=false;includes=arrayIncludesWith;}else if(length>=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set);}isCommon=false;includes=cacheHas;seen=new SetCache();}else {seen=iteratee?[]:result;}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var seenIndex=seen.length;while(seenIndex--){if(seen[seenIndex]===computed){continue outer;}}if(iteratee){seen.push(computed);}result.push(value);}else if(!includes(seen,computed,comparator)){if(seen!==result){seen.push(computed);}result.push(value);}}return result;}/**
  2000. * The base implementation of `_.unset`.
  2001. *
  2002. * @private
  2003. * @param {Object} object The object to modify.
  2004. * @param {Array|string} path The property path to unset.
  2005. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  2006. */function baseUnset(object,path){path=castPath(path,object);object=parent(object,path);return object==null||delete object[toKey(last(path))];}/**
  2007. * The base implementation of `_.update`.
  2008. *
  2009. * @private
  2010. * @param {Object} object The object to modify.
  2011. * @param {Array|string} path The path of the property to update.
  2012. * @param {Function} updater The function to produce the updated value.
  2013. * @param {Function} [customizer] The function to customize path creation.
  2014. * @returns {Object} Returns `object`.
  2015. */function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer);}/**
  2016. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  2017. * without support for iteratee shorthands.
  2018. *
  2019. * @private
  2020. * @param {Array} array The array to query.
  2021. * @param {Function} predicate The function invoked per iteration.
  2022. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  2023. * @param {boolean} [fromRight] Specify iterating from right to left.
  2024. * @returns {Array} Returns the slice of `array`.
  2025. */function baseWhile(array,predicate,isDrop,fromRight){var length=array.length,index=fromRight?length:-1;while((fromRight?index--:++index<length)&&predicate(array[index],index,array)){}return isDrop?baseSlice(array,fromRight?0:index,fromRight?index+1:length):baseSlice(array,fromRight?index+1:0,fromRight?length:index);}/**
  2026. * The base implementation of `wrapperValue` which returns the result of
  2027. * performing a sequence of actions on the unwrapped `value`, where each
  2028. * successive action is supplied the return value of the previous.
  2029. *
  2030. * @private
  2031. * @param {*} value The unwrapped value.
  2032. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  2033. * @returns {*} Returns the resolved value.
  2034. */function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper){result=result.value();}return arrayReduce(actions,function(result,action){return action.func.apply(action.thisArg,arrayPush([result],action.args));},result);}/**
  2035. * The base implementation of methods like `_.xor`, without support for
  2036. * iteratee shorthands, that accepts an array of arrays to inspect.
  2037. *
  2038. * @private
  2039. * @param {Array} arrays The arrays to inspect.
  2040. * @param {Function} [iteratee] The iteratee invoked per element.
  2041. * @param {Function} [comparator] The comparator invoked per element.
  2042. * @returns {Array} Returns the new array of values.
  2043. */function baseXor(arrays,iteratee,comparator){var length=arrays.length;if(length<2){return length?baseUniq(arrays[0]):[];}var index=-1,result=Array(length);while(++index<length){var array=arrays[index],othIndex=-1;while(++othIndex<length){if(othIndex!=index){result[index]=baseDifference(result[index]||array,arrays[othIndex],iteratee,comparator);}}}return baseUniq(baseFlatten(result,1),iteratee,comparator);}/**
  2044. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  2045. *
  2046. * @private
  2047. * @param {Array} props The property identifiers.
  2048. * @param {Array} values The property values.
  2049. * @param {Function} assignFunc The function to assign values.
  2050. * @returns {Object} Returns the new object.
  2051. */function baseZipObject(props,values,assignFunc){var index=-1,length=props.length,valsLength=values.length,result={};while(++index<length){var value=index<valsLength?values[index]:undefined$1;assignFunc(result,props[index],value);}return result;}/**
  2052. * Casts `value` to an empty array if it's not an array like object.
  2053. *
  2054. * @private
  2055. * @param {*} value The value to inspect.
  2056. * @returns {Array|Object} Returns the cast array-like object.
  2057. */function castArrayLikeObject(value){return isArrayLikeObject(value)?value:[];}/**
  2058. * Casts `value` to `identity` if it's not a function.
  2059. *
  2060. * @private
  2061. * @param {*} value The value to inspect.
  2062. * @returns {Function} Returns cast function.
  2063. */function castFunction(value){return typeof value=='function'?value:identity;}/**
  2064. * Casts `value` to a path array if it's not one.
  2065. *
  2066. * @private
  2067. * @param {*} value The value to inspect.
  2068. * @param {Object} [object] The object to query keys on.
  2069. * @returns {Array} Returns the cast property path array.
  2070. */function castPath(value,object){if(isArray(value)){return value;}return isKey(value,object)?[value]:stringToPath(toString(value));}/**
  2071. * A `baseRest` alias which can be replaced with `identity` by module
  2072. * replacement plugins.
  2073. *
  2074. * @private
  2075. * @type {Function}
  2076. * @param {Function} func The function to apply a rest parameter to.
  2077. * @returns {Function} Returns the new function.
  2078. */var castRest=baseRest;/**
  2079. * Casts `array` to a slice if it's needed.
  2080. *
  2081. * @private
  2082. * @param {Array} array The array to inspect.
  2083. * @param {number} start The start position.
  2084. * @param {number} [end=array.length] The end position.
  2085. * @returns {Array} Returns the cast slice.
  2086. */function castSlice(array,start,end){var length=array.length;end=end===undefined$1?length:end;return !start&&end>=length?array:baseSlice(array,start,end);}/**
  2087. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  2088. *
  2089. * @private
  2090. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  2091. */var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id);};/**
  2092. * Creates a clone of `buffer`.
  2093. *
  2094. * @private
  2095. * @param {Buffer} buffer The buffer to clone.
  2096. * @param {boolean} [isDeep] Specify a deep clone.
  2097. * @returns {Buffer} Returns the cloned buffer.
  2098. */function cloneBuffer(buffer,isDeep){if(isDeep){return buffer.slice();}var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result;}/**
  2099. * Creates a clone of `arrayBuffer`.
  2100. *
  2101. * @private
  2102. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  2103. * @returns {ArrayBuffer} Returns the cloned array buffer.
  2104. */function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result;}/**
  2105. * Creates a clone of `dataView`.
  2106. *
  2107. * @private
  2108. * @param {Object} dataView The data view to clone.
  2109. * @param {boolean} [isDeep] Specify a deep clone.
  2110. * @returns {Object} Returns the cloned data view.
  2111. */function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength);}/**
  2112. * Creates a clone of `regexp`.
  2113. *
  2114. * @private
  2115. * @param {Object} regexp The regexp to clone.
  2116. * @returns {Object} Returns the cloned regexp.
  2117. */function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result;}/**
  2118. * Creates a clone of the `symbol` object.
  2119. *
  2120. * @private
  2121. * @param {Object} symbol The symbol object to clone.
  2122. * @returns {Object} Returns the cloned symbol object.
  2123. */function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{};}/**
  2124. * Creates a clone of `typedArray`.
  2125. *
  2126. * @private
  2127. * @param {Object} typedArray The typed array to clone.
  2128. * @param {boolean} [isDeep] Specify a deep clone.
  2129. * @returns {Object} Returns the cloned typed array.
  2130. */function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length);}/**
  2131. * Compares values to sort them in ascending order.
  2132. *
  2133. * @private
  2134. * @param {*} value The value to compare.
  2135. * @param {*} other The other value to compare.
  2136. * @returns {number} Returns the sort order indicator for `value`.
  2137. */function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined$1,valIsNull=value===null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined$1,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive){return 1;}if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&&!valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive){return -1;}}return 0;}/**
  2138. * Used by `_.orderBy` to compare multiple properties of a value to another
  2139. * and stable sort them.
  2140. *
  2141. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  2142. * specify an order of "desc" for descending or "asc" for ascending sort order
  2143. * of corresponding values.
  2144. *
  2145. * @private
  2146. * @param {Object} object The object to compare.
  2147. * @param {Object} other The other object to compare.
  2148. * @param {boolean[]|string[]} orders The order to sort by for each property.
  2149. * @returns {number} Returns the sort order indicator for `object`.
  2150. */function compareMultiple(object,other,orders){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;while(++index<length){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength){return result;}var order=orders[index];return result*(order=='desc'?-1:1);}}// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  2151. // that causes it, under certain circumstances, to provide the same value for
  2152. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  2153. // for more details.
  2154. //
  2155. // This also ensures a stable sort in V8 and other engines.
  2156. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  2157. return object.index-other.index;}/**
  2158. * Creates an array that is the composition of partially applied arguments,
  2159. * placeholders, and provided arguments into a single array of arguments.
  2160. *
  2161. * @private
  2162. * @param {Array} args The provided arguments.
  2163. * @param {Array} partials The arguments to prepend to those provided.
  2164. * @param {Array} holders The `partials` placeholder indexes.
  2165. * @params {boolean} [isCurried] Specify composing for a curried function.
  2166. * @returns {Array} Returns the new array of composed arguments.
  2167. */function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex<leftLength){result[leftIndex]=partials[leftIndex];}while(++argsIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[holders[argsIndex]]=args[argsIndex];}}while(rangeLength--){result[leftIndex++]=args[argsIndex++];}return result;}/**
  2168. * This function is like `composeArgs` except that the arguments composition
  2169. * is tailored for `_.partialRight`.
  2170. *
  2171. * @private
  2172. * @param {Array} args The provided arguments.
  2173. * @param {Array} partials The arguments to append to those provided.
  2174. * @param {Array} holders The `partials` placeholder indexes.
  2175. * @params {boolean} [isCurried] Specify composing for a curried function.
  2176. * @returns {Array} Returns the new array of composed arguments.
  2177. */function composeArgsRight(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersIndex=-1,holdersLength=holders.length,rightIndex=-1,rightLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(rangeLength+rightLength),isUncurried=!isCurried;while(++argsIndex<rangeLength){result[argsIndex]=args[argsIndex];}var offset=argsIndex;while(++rightIndex<rightLength){result[offset+rightIndex]=partials[rightIndex];}while(++holdersIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[offset+holders[holdersIndex]]=args[argsIndex++];}}return result;}/**
  2178. * Copies the values of `source` to `array`.
  2179. *
  2180. * @private
  2181. * @param {Array} source The array to copy values from.
  2182. * @param {Array} [array=[]] The array to copy values to.
  2183. * @returns {Array} Returns `array`.
  2184. */function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index];}return array;}/**
  2185. * Copies properties of `source` to `object`.
  2186. *
  2187. * @private
  2188. * @param {Object} source The object to copy properties from.
  2189. * @param {Array} props The property identifiers to copy.
  2190. * @param {Object} [object={}] The object to copy properties to.
  2191. * @param {Function} [customizer] The function to customize copied values.
  2192. * @returns {Object} Returns `object`.
  2193. */function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key],key,object,source):undefined$1;if(newValue===undefined$1){newValue=source[key];}if(isNew){baseAssignValue(object,key,newValue);}else {assignValue(object,key,newValue);}}return object;}/**
  2194. * Copies own symbols of `source` to `object`.
  2195. *
  2196. * @private
  2197. * @param {Object} source The object to copy symbols from.
  2198. * @param {Object} [object={}] The object to copy symbols to.
  2199. * @returns {Object} Returns `object`.
  2200. */function copySymbols(source,object){return copyObject(source,getSymbols(source),object);}/**
  2201. * Copies own and inherited symbols of `source` to `object`.
  2202. *
  2203. * @private
  2204. * @param {Object} source The object to copy symbols from.
  2205. * @param {Object} [object={}] The object to copy symbols to.
  2206. * @returns {Object} Returns `object`.
  2207. */function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object);}/**
  2208. * Creates a function like `_.groupBy`.
  2209. *
  2210. * @private
  2211. * @param {Function} setter The function to set accumulator values.
  2212. * @param {Function} [initializer] The accumulator object initializer.
  2213. * @returns {Function} Returns the new aggregator function.
  2214. */function createAggregator(setter,initializer){return function(collection,iteratee){var func=isArray(collection)?arrayAggregator:baseAggregator,accumulator=initializer?initializer():{};return func(collection,setter,getIteratee(iteratee,2),accumulator);};}/**
  2215. * Creates a function like `_.assign`.
  2216. *
  2217. * @private
  2218. * @param {Function} assigner The function to assign values.
  2219. * @returns {Function} Returns the new assigner function.
  2220. */function createAssigner(assigner){return baseRest(function(object,sources){var index=-1,length=sources.length,customizer=length>1?sources[length-1]:undefined$1,guard=length>2?sources[2]:undefined$1;customizer=assigner.length>3&&typeof customizer=='function'?(length--,customizer):undefined$1;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined$1:customizer;length=1;}object=Object(object);while(++index<length){var source=sources[index];if(source){assigner(object,source,index,customizer);}}return object;});}/**
  2221. * Creates a `baseEach` or `baseEachRight` function.
  2222. *
  2223. * @private
  2224. * @param {Function} eachFunc The function to iterate over a collection.
  2225. * @param {boolean} [fromRight] Specify iterating from right to left.
  2226. * @returns {Function} Returns the new base function.
  2227. */function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(collection==null){return collection;}if(!isArrayLike(collection)){return eachFunc(collection,iteratee);}var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);while(fromRight?index--:++index<length){if(iteratee(iterable[index],index,iterable)===false){break;}}return collection;};}/**
  2228. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  2229. *
  2230. * @private
  2231. * @param {boolean} [fromRight] Specify iterating from right to left.
  2232. * @returns {Function} Returns the new base function.
  2233. */function createBaseFor(fromRight){return function(object,iteratee,keysFunc){var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;while(length--){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===false){break;}}return object;};}/**
  2234. * Creates a function that wraps `func` to invoke it with the optional `this`
  2235. * binding of `thisArg`.
  2236. *
  2237. * @private
  2238. * @param {Function} func The function to wrap.
  2239. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2240. * @param {*} [thisArg] The `this` binding of `func`.
  2241. * @returns {Function} Returns the new wrapped function.
  2242. */function createBind(func,bitmask,thisArg){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,arguments);}return wrapper;}/**
  2243. * Creates a function like `_.lowerFirst`.
  2244. *
  2245. * @private
  2246. * @param {string} methodName The name of the `String` case method to use.
  2247. * @returns {Function} Returns the new case function.
  2248. */function createCaseFirst(methodName){return function(string){string=toString(string);var strSymbols=hasUnicode(string)?stringToArray(string):undefined$1;var chr=strSymbols?strSymbols[0]:string.charAt(0);var trailing=strSymbols?castSlice(strSymbols,1).join(''):string.slice(1);return chr[methodName]()+trailing;};}/**
  2249. * Creates a function like `_.camelCase`.
  2250. *
  2251. * @private
  2252. * @param {Function} callback The function to combine each word.
  2253. * @returns {Function} Returns the new compounder function.
  2254. */function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,'')),callback,'');};}/**
  2255. * Creates a function that produces an instance of `Ctor` regardless of
  2256. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  2257. *
  2258. * @private
  2259. * @param {Function} Ctor The constructor to wrap.
  2260. * @returns {Function} Returns the new wrapped function.
  2261. */function createCtor(Ctor){return function(){// Use a `switch` statement to work with class constructors. See
  2262. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  2263. // for more details.
  2264. var args=arguments;switch(args.length){case 0:return new Ctor();case 1:return new Ctor(args[0]);case 2:return new Ctor(args[0],args[1]);case 3:return new Ctor(args[0],args[1],args[2]);case 4:return new Ctor(args[0],args[1],args[2],args[3]);case 5:return new Ctor(args[0],args[1],args[2],args[3],args[4]);case 6:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5]);case 7:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);}var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,args);// Mimic the constructor's `return` behavior.
  2265. // See https://es5.github.io/#x13.2.2 for more details.
  2266. return isObject(result)?result:thisBinding;};}/**
  2267. * Creates a function that wraps `func` to enable currying.
  2268. *
  2269. * @private
  2270. * @param {Function} func The function to wrap.
  2271. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2272. * @param {number} arity The arity of `func`.
  2273. * @returns {Function} Returns the new wrapped function.
  2274. */function createCurry(func,bitmask,arity){var Ctor=createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length,placeholder=getHolder(wrapper);while(index--){args[index]=arguments[index];}var holders=length<3&&args[0]!==placeholder&&args[length-1]!==placeholder?[]:replaceHolders(args,placeholder);length-=holders.length;if(length<arity){return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,undefined$1,args,holders,undefined$1,undefined$1,arity-length);}var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return apply(fn,this,args);}return wrapper;}/**
  2275. * Creates a `_.find` or `_.findLast` function.
  2276. *
  2277. * @private
  2278. * @param {Function} findIndexFunc The function to find the collection index.
  2279. * @returns {Function} Returns the new find function.
  2280. */function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);if(!isArrayLike(collection)){var iteratee=getIteratee(predicate,3);collection=keys(collection);predicate=function(key){return iteratee(iterable[key],key,iterable);};}var index=findIndexFunc(collection,predicate,fromIndex);return index>-1?iterable[iteratee?collection[index]:index]:undefined$1;};}/**
  2281. * Creates a `_.flow` or `_.flowRight` function.
  2282. *
  2283. * @private
  2284. * @param {boolean} [fromRight] Specify iterating from right to left.
  2285. * @returns {Function} Returns the new flow function.
  2286. */function createFlow(fromRight){return flatRest(function(funcs){var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight){funcs.reverse();}while(index--){var func=funcs[index];if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}if(prereq&&!wrapper&&getFuncName(func)=='wrapper'){var wrapper=new LodashWrapper([],true);}}index=wrapper?index:length;while(++index<length){func=funcs[index];var funcName=getFuncName(func),data=funcName=='wrapper'?getData(func):undefined$1;if(data&&isLaziable(data[0])&&data[1]==(WRAP_ARY_FLAG|WRAP_CURRY_FLAG|WRAP_PARTIAL_FLAG|WRAP_REARG_FLAG)&&!data[4].length&&data[9]==1){wrapper=wrapper[getFuncName(data[0])].apply(wrapper,data[3]);}else {wrapper=func.length==1&&isLaziable(func)?wrapper[funcName]():wrapper.thru(func);}}return function(){var args=arguments,value=args[0];if(wrapper&&args.length==1&&isArray(value)){return wrapper.plant(value).value();}var index=0,result=length?funcs[index].apply(this,args):value;while(++index<length){result=funcs[index].call(this,result);}return result;};});}/**
  2287. * Creates a function that wraps `func` to invoke it with optional `this`
  2288. * binding of `thisArg`, partial application, and currying.
  2289. *
  2290. * @private
  2291. * @param {Function|string} func The function or method name to wrap.
  2292. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2293. * @param {*} [thisArg] The `this` binding of `func`.
  2294. * @param {Array} [partials] The arguments to prepend to those provided to
  2295. * the new function.
  2296. * @param {Array} [holders] The `partials` placeholder indexes.
  2297. * @param {Array} [partialsRight] The arguments to append to those provided
  2298. * to the new function.
  2299. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  2300. * @param {Array} [argPos] The argument positions of the new function.
  2301. * @param {number} [ary] The arity cap of `func`.
  2302. * @param {number} [arity] The arity of `func`.
  2303. * @returns {Function} Returns the new wrapped function.
  2304. */function createHybrid(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&WRAP_ARY_FLAG,isBind=bitmask&WRAP_BIND_FLAG,isBindKey=bitmask&WRAP_BIND_KEY_FLAG,isCurried=bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG),isFlip=bitmask&WRAP_FLIP_FLAG,Ctor=isBindKey?undefined$1:createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length;while(index--){args[index]=arguments[index];}if(isCurried){var placeholder=getHolder(wrapper),holdersCount=countHolders(args,placeholder);}if(partials){args=composeArgs(args,partials,holders,isCurried);}if(partialsRight){args=composeArgsRight(args,partialsRight,holdersRight,isCurried);}length-=holdersCount;if(isCurried&&length<arity){var newHolders=replaceHolders(args,placeholder);return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,thisArg,args,newHolders,argPos,ary,arity-length);}var thisBinding=isBind?thisArg:this,fn=isBindKey?thisBinding[func]:func;length=args.length;if(argPos){args=reorder(args,argPos);}else if(isFlip&&length>1){args.reverse();}if(isAry&&ary<length){args.length=ary;}if(this&&this!==root&&this instanceof wrapper){fn=Ctor||createCtor(fn);}return fn.apply(thisBinding,args);}return wrapper;}/**
  2305. * Creates a function like `_.invertBy`.
  2306. *
  2307. * @private
  2308. * @param {Function} setter The function to set accumulator values.
  2309. * @param {Function} toIteratee The function to resolve iteratees.
  2310. * @returns {Function} Returns the new inverter function.
  2311. */function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{});};}/**
  2312. * Creates a function that performs a mathematical operation on two values.
  2313. *
  2314. * @private
  2315. * @param {Function} operator The function to perform the operation.
  2316. * @param {number} [defaultValue] The value used for `undefined` arguments.
  2317. * @returns {Function} Returns the new mathematical operation function.
  2318. */function createMathOperation(operator,defaultValue){return function(value,other){var result;if(value===undefined$1&&other===undefined$1){return defaultValue;}if(value!==undefined$1){result=value;}if(other!==undefined$1){if(result===undefined$1){return other;}if(typeof value=='string'||typeof other=='string'){value=baseToString(value);other=baseToString(other);}else {value=baseToNumber(value);other=baseToNumber(other);}result=operator(value,other);}return result;};}/**
  2319. * Creates a function like `_.over`.
  2320. *
  2321. * @private
  2322. * @param {Function} arrayFunc The function to iterate over iteratees.
  2323. * @returns {Function} Returns the new over function.
  2324. */function createOver(arrayFunc){return flatRest(function(iteratees){iteratees=arrayMap(iteratees,baseUnary(getIteratee()));return baseRest(function(args){var thisArg=this;return arrayFunc(iteratees,function(iteratee){return apply(iteratee,thisArg,args);});});});}/**
  2325. * Creates the padding for `string` based on `length`. The `chars` string
  2326. * is truncated if the number of characters exceeds `length`.
  2327. *
  2328. * @private
  2329. * @param {number} length The padding length.
  2330. * @param {string} [chars=' '] The string used as padding.
  2331. * @returns {string} Returns the padding for `string`.
  2332. */function createPadding(length,chars){chars=chars===undefined$1?' ':baseToString(chars);var charsLength=chars.length;if(charsLength<2){return charsLength?baseRepeat(chars,length):chars;}var result=baseRepeat(chars,nativeCeil(length/stringSize(chars)));return hasUnicode(chars)?castSlice(stringToArray(result),0,length).join(''):result.slice(0,length);}/**
  2333. * Creates a function that wraps `func` to invoke it with the `this` binding
  2334. * of `thisArg` and `partials` prepended to the arguments it receives.
  2335. *
  2336. * @private
  2337. * @param {Function} func The function to wrap.
  2338. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2339. * @param {*} thisArg The `this` binding of `func`.
  2340. * @param {Array} partials The arguments to prepend to those provided to
  2341. * the new function.
  2342. * @returns {Function} Returns the new wrapped function.
  2343. */function createPartial(func,bitmask,thisArg,partials){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var argsIndex=-1,argsLength=arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(leftLength+argsLength),fn=this&&this!==root&&this instanceof wrapper?Ctor:func;while(++leftIndex<leftLength){args[leftIndex]=partials[leftIndex];}while(argsLength--){args[leftIndex++]=arguments[++argsIndex];}return apply(fn,isBind?thisArg:this,args);}return wrapper;}/**
  2344. * Creates a `_.range` or `_.rangeRight` function.
  2345. *
  2346. * @private
  2347. * @param {boolean} [fromRight] Specify iterating from right to left.
  2348. * @returns {Function} Returns the new range function.
  2349. */function createRange(fromRight){return function(start,end,step){if(step&&typeof step!='number'&&isIterateeCall(start,end,step)){end=step=undefined$1;}// Ensure the sign of `-0` is preserved.
  2350. start=toFinite(start);if(end===undefined$1){end=start;start=0;}else {end=toFinite(end);}step=step===undefined$1?start<end?1:-1:toFinite(step);return baseRange(start,end,step,fromRight);};}/**
  2351. * Creates a function that performs a relational operation on two values.
  2352. *
  2353. * @private
  2354. * @param {Function} operator The function to perform the operation.
  2355. * @returns {Function} Returns the new relational operation function.
  2356. */function createRelationalOperation(operator){return function(value,other){if(!(typeof value=='string'&&typeof other=='string')){value=toNumber(value);other=toNumber(other);}return operator(value,other);};}/**
  2357. * Creates a function that wraps `func` to continue currying.
  2358. *
  2359. * @private
  2360. * @param {Function} func The function to wrap.
  2361. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2362. * @param {Function} wrapFunc The function to create the `func` wrapper.
  2363. * @param {*} placeholder The placeholder value.
  2364. * @param {*} [thisArg] The `this` binding of `func`.
  2365. * @param {Array} [partials] The arguments to prepend to those provided to
  2366. * the new function.
  2367. * @param {Array} [holders] The `partials` placeholder indexes.
  2368. * @param {Array} [argPos] The argument positions of the new function.
  2369. * @param {number} [ary] The arity cap of `func`.
  2370. * @param {number} [arity] The arity of `func`.
  2371. * @returns {Function} Returns the new wrapped function.
  2372. */function createRecurry(func,bitmask,wrapFunc,placeholder,thisArg,partials,holders,argPos,ary,arity){var isCurry=bitmask&WRAP_CURRY_FLAG,newHolders=isCurry?holders:undefined$1,newHoldersRight=isCurry?undefined$1:holders,newPartials=isCurry?partials:undefined$1,newPartialsRight=isCurry?undefined$1:partials;bitmask|=isCurry?WRAP_PARTIAL_FLAG:WRAP_PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?WRAP_PARTIAL_RIGHT_FLAG:WRAP_PARTIAL_FLAG);if(!(bitmask&WRAP_CURRY_BOUND_FLAG)){bitmask&=~(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG);}var newData=[func,bitmask,thisArg,newPartials,newHolders,newPartialsRight,newHoldersRight,argPos,ary,arity];var result=wrapFunc.apply(undefined$1,newData);if(isLaziable(func)){setData(result,newData);}result.placeholder=placeholder;return setWrapToString(result,func,bitmask);}/**
  2373. * Creates a function like `_.round`.
  2374. *
  2375. * @private
  2376. * @param {string} methodName The name of the `Math` method to use when rounding.
  2377. * @returns {Function} Returns the new round function.
  2378. */function createRound(methodName){var func=Math[methodName];return function(number,precision){number=toNumber(number);precision=precision==null?0:nativeMin(toInteger(precision),292);if(precision&&nativeIsFinite(number)){// Shift with exponential notation to avoid floating-point issues.
  2379. // See [MDN](https://mdn.io/round#Examples) for more details.
  2380. var pair=(toString(number)+'e').split('e'),value=func(pair[0]+'e'+(+pair[1]+precision));pair=(toString(value)+'e').split('e');return +(pair[0]+'e'+(+pair[1]-precision));}return func(number);};}/**
  2381. * Creates a set object of `values`.
  2382. *
  2383. * @private
  2384. * @param {Array} values The values to add to the set.
  2385. * @returns {Object} Returns the new set.
  2386. */var createSet=!(Set&&1/setToArray(new Set([,-0]))[1]==INFINITY)?noop:function(values){return new Set(values);};/**
  2387. * Creates a `_.toPairs` or `_.toPairsIn` function.
  2388. *
  2389. * @private
  2390. * @param {Function} keysFunc The function to get the keys of a given object.
  2391. * @returns {Function} Returns the new pairs function.
  2392. */function createToPairs(keysFunc){return function(object){var tag=getTag(object);if(tag==mapTag){return mapToArray(object);}if(tag==setTag){return setToPairs(object);}return baseToPairs(object,keysFunc(object));};}/**
  2393. * Creates a function that either curries or invokes `func` with optional
  2394. * `this` binding and partially applied arguments.
  2395. *
  2396. * @private
  2397. * @param {Function|string} func The function or method name to wrap.
  2398. * @param {number} bitmask The bitmask flags.
  2399. * 1 - `_.bind`
  2400. * 2 - `_.bindKey`
  2401. * 4 - `_.curry` or `_.curryRight` of a bound function
  2402. * 8 - `_.curry`
  2403. * 16 - `_.curryRight`
  2404. * 32 - `_.partial`
  2405. * 64 - `_.partialRight`
  2406. * 128 - `_.rearg`
  2407. * 256 - `_.ary`
  2408. * 512 - `_.flip`
  2409. * @param {*} [thisArg] The `this` binding of `func`.
  2410. * @param {Array} [partials] The arguments to be partially applied.
  2411. * @param {Array} [holders] The `partials` placeholder indexes.
  2412. * @param {Array} [argPos] The argument positions of the new function.
  2413. * @param {number} [ary] The arity cap of `func`.
  2414. * @param {number} [arity] The arity of `func`.
  2415. * @returns {Function} Returns the new wrapped function.
  2416. */function createWrap(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&WRAP_BIND_KEY_FLAG;if(!isBindKey&&typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}var length=partials?partials.length:0;if(!length){bitmask&=~(WRAP_PARTIAL_FLAG|WRAP_PARTIAL_RIGHT_FLAG);partials=holders=undefined$1;}ary=ary===undefined$1?ary:nativeMax(toInteger(ary),0);arity=arity===undefined$1?arity:toInteger(arity);length-=holders?holders.length:0;if(bitmask&WRAP_PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=undefined$1;}var data=isBindKey?undefined$1:getData(func);var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data){mergeData(newData,data);}func=newData[0];bitmask=newData[1];thisArg=newData[2];partials=newData[3];holders=newData[4];arity=newData[9]=newData[9]===undefined$1?isBindKey?0:func.length:nativeMax(newData[9]-length,0);if(!arity&&bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG)){bitmask&=~(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG);}if(!bitmask||bitmask==WRAP_BIND_FLAG){var result=createBind(func,bitmask,thisArg);}else if(bitmask==WRAP_CURRY_FLAG||bitmask==WRAP_CURRY_RIGHT_FLAG){result=createCurry(func,bitmask,arity);}else if((bitmask==WRAP_PARTIAL_FLAG||bitmask==(WRAP_BIND_FLAG|WRAP_PARTIAL_FLAG))&&!holders.length){result=createPartial(func,bitmask,thisArg,partials);}else {result=createHybrid.apply(undefined$1,newData);}var setter=data?baseSetData:setData;return setWrapToString(setter(result,newData),func,bitmask);}/**
  2417. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  2418. * of source objects to the destination object for all destination properties
  2419. * that resolve to `undefined`.
  2420. *
  2421. * @private
  2422. * @param {*} objValue The destination value.
  2423. * @param {*} srcValue The source value.
  2424. * @param {string} key The key of the property to assign.
  2425. * @param {Object} object The parent object of `objValue`.
  2426. * @returns {*} Returns the value to assign.
  2427. */function customDefaultsAssignIn(objValue,srcValue,key,object){if(objValue===undefined$1||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key)){return srcValue;}return objValue;}/**
  2428. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  2429. * objects into destination objects that are passed thru.
  2430. *
  2431. * @private
  2432. * @param {*} objValue The destination value.
  2433. * @param {*} srcValue The source value.
  2434. * @param {string} key The key of the property to merge.
  2435. * @param {Object} object The parent object of `objValue`.
  2436. * @param {Object} source The parent object of `srcValue`.
  2437. * @param {Object} [stack] Tracks traversed source values and their merged
  2438. * counterparts.
  2439. * @returns {*} Returns the value to assign.
  2440. */function customDefaultsMerge(objValue,srcValue,key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){// Recursively merge objects and arrays (susceptible to call stack limits).
  2441. stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined$1,customDefaultsMerge,stack);stack['delete'](srcValue);}return objValue;}/**
  2442. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  2443. * objects.
  2444. *
  2445. * @private
  2446. * @param {*} value The value to inspect.
  2447. * @param {string} key The key of the property to inspect.
  2448. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  2449. */function customOmitClone(value){return isPlainObject(value)?undefined$1:value;}/**
  2450. * A specialized version of `baseIsEqualDeep` for arrays with support for
  2451. * partial deep comparisons.
  2452. *
  2453. * @private
  2454. * @param {Array} array The array to compare.
  2455. * @param {Array} other The other array to compare.
  2456. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2457. * @param {Function} customizer The function to customize comparisons.
  2458. * @param {Function} equalFunc The function to determine equivalents of values.
  2459. * @param {Object} stack Tracks traversed `array` and `other` objects.
  2460. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  2461. */function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false;}// Check that cyclic values are equal.
  2462. var arrStacked=stack.get(array);var othStacked=stack.get(other);if(arrStacked&&othStacked){return arrStacked==other&&othStacked==array;}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache():undefined$1;stack.set(array,other);stack.set(other,array);// Ignore non-index properties.
  2463. while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer){var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);}if(compared!==undefined$1){if(compared){continue;}result=false;break;}// Recursively compare arrays (susceptible to call stack limits).
  2464. if(seen){if(!arraySome(other,function(othValue,othIndex){if(!cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){return seen.push(othIndex);}})){result=false;break;}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){result=false;break;}}stack['delete'](array);stack['delete'](other);return result;}/**
  2465. * A specialized version of `baseIsEqualDeep` for comparing objects of
  2466. * the same `toStringTag`.
  2467. *
  2468. * **Note:** This function only supports comparing values with tags of
  2469. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  2470. *
  2471. * @private
  2472. * @param {Object} object The object to compare.
  2473. * @param {Object} other The other object to compare.
  2474. * @param {string} tag The `toStringTag` of the objects to compare.
  2475. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2476. * @param {Function} customizer The function to customize comparisons.
  2477. * @param {Function} equalFunc The function to determine equivalents of values.
  2478. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2479. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2480. */function equalByTag(object,other,tag,bitmask,customizer,equalFunc,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset){return false;}object=object.buffer;other=other.buffer;case arrayBufferTag:if(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other))){return false;}return true;case boolTag:case dateTag:case numberTag:// Coerce booleans to `1` or `0` and dates to milliseconds.
  2481. // Invalid dates are coerced to `NaN`.
  2482. return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:// Coerce regexes to strings and treat strings, primitives and objects,
  2483. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  2484. // for more details.
  2485. return object==other+'';case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&COMPARE_PARTIAL_FLAG;convert||(convert=setToArray);if(object.size!=other.size&&!isPartial){return false;}// Assume cyclic values are equal.
  2486. var stacked=stack.get(object);if(stacked){return stacked==other;}bitmask|=COMPARE_UNORDERED_FLAG;// Recursively compare objects (susceptible to call stack limits).
  2487. stack.set(object,other);var result=equalArrays(convert(object),convert(other),bitmask,customizer,equalFunc,stack);stack['delete'](object);return result;case symbolTag:if(symbolValueOf){return symbolValueOf.call(object)==symbolValueOf.call(other);}}return false;}/**
  2488. * A specialized version of `baseIsEqualDeep` for objects with support for
  2489. * partial deep comparisons.
  2490. *
  2491. * @private
  2492. * @param {Object} object The object to compare.
  2493. * @param {Object} other The other object to compare.
  2494. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2495. * @param {Function} customizer The function to customize comparisons.
  2496. * @param {Function} equalFunc The function to determine equivalents of values.
  2497. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2498. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2499. */function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial){return false;}var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key))){return false;}}// Check that cyclic values are equal.
  2500. var objStacked=stack.get(object);var othStacked=stack.get(other);if(objStacked&&othStacked){return objStacked==other&&othStacked==object;}var result=true;stack.set(object,other);stack.set(other,object);var skipCtor=isPartial;while(++index<objLength){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer){var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);}// Recursively compare objects (susceptible to call stack limits).
  2501. if(!(compared===undefined$1?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=false;break;}skipCtor||(skipCtor=key=='constructor');}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;// Non `Object` object instances with different constructors are not equal.
  2502. if(objCtor!=othCtor&&'constructor'in object&&'constructor'in other&&!(typeof objCtor=='function'&&objCtor instanceof objCtor&&typeof othCtor=='function'&&othCtor instanceof othCtor)){result=false;}}stack['delete'](object);stack['delete'](other);return result;}/**
  2503. * A specialized version of `baseRest` which flattens the rest array.
  2504. *
  2505. * @private
  2506. * @param {Function} func The function to apply a rest parameter to.
  2507. * @returns {Function} Returns the new function.
  2508. */function flatRest(func){return setToString(overRest(func,undefined$1,flatten),func+'');}/**
  2509. * Creates an array of own enumerable property names and symbols of `object`.
  2510. *
  2511. * @private
  2512. * @param {Object} object The object to query.
  2513. * @returns {Array} Returns the array of property names and symbols.
  2514. */function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols);}/**
  2515. * Creates an array of own and inherited enumerable property names and
  2516. * symbols of `object`.
  2517. *
  2518. * @private
  2519. * @param {Object} object The object to query.
  2520. * @returns {Array} Returns the array of property names and symbols.
  2521. */function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn);}/**
  2522. * Gets metadata for `func`.
  2523. *
  2524. * @private
  2525. * @param {Function} func The function to query.
  2526. * @returns {*} Returns the metadata for `func`.
  2527. */var getData=!metaMap?noop:function(func){return metaMap.get(func);};/**
  2528. * Gets the name of `func`.
  2529. *
  2530. * @private
  2531. * @param {Function} func The function to query.
  2532. * @returns {string} Returns the function name.
  2533. */function getFuncName(func){var result=func.name+'',array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;while(length--){var data=array[length],otherFunc=data.func;if(otherFunc==null||otherFunc==func){return data.name;}}return result;}/**
  2534. * Gets the argument placeholder value for `func`.
  2535. *
  2536. * @private
  2537. * @param {Function} func The function to inspect.
  2538. * @returns {*} Returns the placeholder value.
  2539. */function getHolder(func){var object=hasOwnProperty.call(lodash,'placeholder')?lodash:func;return object.placeholder;}/**
  2540. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  2541. * this function returns the custom method, otherwise it returns `baseIteratee`.
  2542. * If arguments are provided, the chosen function is invoked with them and
  2543. * its result is returned.
  2544. *
  2545. * @private
  2546. * @param {*} [value] The value to convert to an iteratee.
  2547. * @param {number} [arity] The arity of the created iteratee.
  2548. * @returns {Function} Returns the chosen function or its result.
  2549. */function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length?result(arguments[0],arguments[1]):result;}/**
  2550. * Gets the data for `map`.
  2551. *
  2552. * @private
  2553. * @param {Object} map The map to query.
  2554. * @param {string} key The reference key.
  2555. * @returns {*} Returns the map data.
  2556. */function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=='string'?'string':'hash']:data.map;}/**
  2557. * Gets the property names, values, and compare flags of `object`.
  2558. *
  2559. * @private
  2560. * @param {Object} object The object to query.
  2561. * @returns {Array} Returns the match data of `object`.
  2562. */function getMatchData(object){var result=keys(object),length=result.length;while(length--){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)];}return result;}/**
  2563. * Gets the native function at `key` of `object`.
  2564. *
  2565. * @private
  2566. * @param {Object} object The object to query.
  2567. * @param {string} key The key of the method to get.
  2568. * @returns {*} Returns the function if it's native, else `undefined`.
  2569. */function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined$1;}/**
  2570. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  2571. *
  2572. * @private
  2573. * @param {*} value The value to query.
  2574. * @returns {string} Returns the raw `toStringTag`.
  2575. */function getRawTag(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined$1;var unmasked=true;}catch(e){}var result=nativeObjectToString.call(value);if(unmasked){if(isOwn){value[symToStringTag]=tag;}else {delete value[symToStringTag];}}return result;}/**
  2576. * Creates an array of the own enumerable symbols of `object`.
  2577. *
  2578. * @private
  2579. * @param {Object} object The object to query.
  2580. * @returns {Array} Returns the array of symbols.
  2581. */var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null){return [];}object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol);});};/**
  2582. * Creates an array of the own and inherited enumerable symbols of `object`.
  2583. *
  2584. * @private
  2585. * @param {Object} object The object to query.
  2586. * @returns {Array} Returns the array of symbols.
  2587. */var getSymbolsIn=!nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object);}return result;};/**
  2588. * Gets the `toStringTag` of `value`.
  2589. *
  2590. * @private
  2591. * @param {*} value The value to query.
  2592. * @returns {string} Returns the `toStringTag`.
  2593. */var getTag=baseGetTag;// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  2594. if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map())!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set())!=setTag||WeakMap&&getTag(new WeakMap())!=weakMapTag){getTag=function(value){var result=baseGetTag(value),Ctor=result==objectTag?value.constructor:undefined$1,ctorString=Ctor?toSource(Ctor):'';if(ctorString){switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag;}}return result;};}/**
  2595. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  2596. *
  2597. * @private
  2598. * @param {number} start The start of the view.
  2599. * @param {number} end The end of the view.
  2600. * @param {Array} transforms The transformations to apply to the view.
  2601. * @returns {Object} Returns an object containing the `start` and `end`
  2602. * positions of the view.
  2603. */function getView(start,end,transforms){var index=-1,length=transforms.length;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case'drop':start+=size;break;case'dropRight':end-=size;break;case'take':end=nativeMin(end,start+size);break;case'takeRight':start=nativeMax(start,end-size);break;}}return {'start':start,'end':end};}/**
  2604. * Extracts wrapper details from the `source` body comment.
  2605. *
  2606. * @private
  2607. * @param {string} source The source to inspect.
  2608. * @returns {Array} Returns the wrapper details.
  2609. */function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[];}/**
  2610. * Checks if `path` exists on `object`.
  2611. *
  2612. * @private
  2613. * @param {Object} object The object to query.
  2614. * @param {Array|string} path The path to check.
  2615. * @param {Function} hasFunc The function to check properties.
  2616. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  2617. */function hasPath(object,path,hasFunc){path=castPath(path,object);var index=-1,length=path.length,result=false;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key))){break;}object=object[key];}if(result||++index!=length){return result;}length=object==null?0:object.length;return !!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object));}/**
  2618. * Initializes an array clone.
  2619. *
  2620. * @private
  2621. * @param {Array} array The array to clone.
  2622. * @returns {Array} Returns the initialized clone.
  2623. */function initCloneArray(array){var length=array.length,result=new array.constructor(length);// Add properties assigned by `RegExp#exec`.
  2624. if(length&&typeof array[0]=='string'&&hasOwnProperty.call(array,'index')){result.index=array.index;result.input=array.input;}return result;}/**
  2625. * Initializes an object clone.
  2626. *
  2627. * @private
  2628. * @param {Object} object The object to clone.
  2629. * @returns {Object} Returns the initialized clone.
  2630. */function initCloneObject(object){return typeof object.constructor=='function'&&!isPrototype(object)?baseCreate(getPrototype(object)):{};}/**
  2631. * Initializes an object clone based on its `toStringTag`.
  2632. *
  2633. * **Note:** This function only supports cloning values with tags of
  2634. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  2635. *
  2636. * @private
  2637. * @param {Object} object The object to clone.
  2638. * @param {string} tag The `toStringTag` of the object to clone.
  2639. * @param {boolean} [isDeep] Specify a deep clone.
  2640. * @returns {Object} Returns the initialized clone.
  2641. */function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return new Ctor();case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object);case setTag:return new Ctor();case symbolTag:return cloneSymbol(object);}}/**
  2642. * Inserts wrapper `details` in a comment at the top of the `source` body.
  2643. *
  2644. * @private
  2645. * @param {string} source The source to modify.
  2646. * @returns {Array} details The details to insert.
  2647. * @returns {string} Returns the modified source.
  2648. */function insertWrapDetails(source,details){var length=details.length;if(!length){return source;}var lastIndex=length-1;details[lastIndex]=(length>1?'& ':'')+details[lastIndex];details=details.join(length>2?', ':' ');return source.replace(reWrapComment,'{\n/* [wrapped with '+details+'] */\n');}/**
  2649. * Checks if `value` is a flattenable `arguments` object or array.
  2650. *
  2651. * @private
  2652. * @param {*} value The value to check.
  2653. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  2654. */function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol]);}/**
  2655. * Checks if `value` is a valid array-like index.
  2656. *
  2657. * @private
  2658. * @param {*} value The value to check.
  2659. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  2660. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  2661. */function isIndex(value,length){var type=typeof value;length=length==null?MAX_SAFE_INTEGER:length;return !!length&&(type=='number'||type!='symbol'&&reIsUint.test(value))&&value>-1&&value%1==0&&value<length;}/**
  2662. * Checks if the given arguments are from an iteratee call.
  2663. *
  2664. * @private
  2665. * @param {*} value The potential iteratee value argument.
  2666. * @param {*} index The potential iteratee index or key argument.
  2667. * @param {*} object The potential iteratee object argument.
  2668. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  2669. * else `false`.
  2670. */function isIterateeCall(value,index,object){if(!isObject(object)){return false;}var type=typeof index;if(type=='number'?isArrayLike(object)&&isIndex(index,object.length):type=='string'&&index in object){return eq(object[index],value);}return false;}/**
  2671. * Checks if `value` is a property name and not a property path.
  2672. *
  2673. * @private
  2674. * @param {*} value The value to check.
  2675. * @param {Object} [object] The object to query keys on.
  2676. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  2677. */function isKey(value,object){if(isArray(value)){return false;}var type=typeof value;if(type=='number'||type=='symbol'||type=='boolean'||value==null||isSymbol(value)){return true;}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object);}/**
  2678. * Checks if `value` is suitable for use as unique object key.
  2679. *
  2680. * @private
  2681. * @param {*} value The value to check.
  2682. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2683. */function isKeyable(value){var type=typeof value;return type=='string'||type=='number'||type=='symbol'||type=='boolean'?value!=='__proto__':value===null;}/**
  2684. * Checks if `func` has a lazy counterpart.
  2685. *
  2686. * @private
  2687. * @param {Function} func The function to check.
  2688. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  2689. * else `false`.
  2690. */function isLaziable(func){var funcName=getFuncName(func),other=lodash[funcName];if(typeof other!='function'||!(funcName in LazyWrapper.prototype)){return false;}if(func===other){return true;}var data=getData(other);return !!data&&func===data[0];}/**
  2691. * Checks if `func` has its source masked.
  2692. *
  2693. * @private
  2694. * @param {Function} func The function to check.
  2695. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2696. */function isMasked(func){return !!maskSrcKey&&maskSrcKey in func;}/**
  2697. * Checks if `func` is capable of being masked.
  2698. *
  2699. * @private
  2700. * @param {*} value The value to check.
  2701. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  2702. */var isMaskable=coreJsData?isFunction:stubFalse;/**
  2703. * Checks if `value` is likely a prototype object.
  2704. *
  2705. * @private
  2706. * @param {*} value The value to check.
  2707. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2708. */function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=='function'&&Ctor.prototype||objectProto;return value===proto;}/**
  2709. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  2710. *
  2711. * @private
  2712. * @param {*} value The value to check.
  2713. * @returns {boolean} Returns `true` if `value` if suitable for strict
  2714. * equality comparisons, else `false`.
  2715. */function isStrictComparable(value){return value===value&&!isObject(value);}/**
  2716. * A specialized version of `matchesProperty` for source values suitable
  2717. * for strict equality comparisons, i.e. `===`.
  2718. *
  2719. * @private
  2720. * @param {string} key The key of the property to get.
  2721. * @param {*} srcValue The value to match.
  2722. * @returns {Function} Returns the new spec function.
  2723. */function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false;}return object[key]===srcValue&&(srcValue!==undefined$1||key in Object(object));};}/**
  2724. * A specialized version of `_.memoize` which clears the memoized function's
  2725. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  2726. *
  2727. * @private
  2728. * @param {Function} func The function to have its output memoized.
  2729. * @returns {Function} Returns the new memoized function.
  2730. */function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE){cache.clear();}return key;});var cache=result.cache;return result;}/**
  2731. * Merges the function metadata of `source` into `data`.
  2732. *
  2733. * Merging metadata reduces the number of wrappers used to invoke a function.
  2734. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  2735. * may be applied regardless of execution order. Methods like `_.ary` and
  2736. * `_.rearg` modify function arguments, making the order in which they are
  2737. * executed important, preventing the merging of metadata. However, we make
  2738. * an exception for a safe combined case where curried functions have `_.ary`
  2739. * and or `_.rearg` applied.
  2740. *
  2741. * @private
  2742. * @param {Array} data The destination metadata.
  2743. * @param {Array} source The source metadata.
  2744. * @returns {Array} Returns `data`.
  2745. */function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask<(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG|WRAP_ARY_FLAG);var isCombo=srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_CURRY_FLAG||srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_REARG_FLAG&&data[7].length<=source[8]||srcBitmask==(WRAP_ARY_FLAG|WRAP_REARG_FLAG)&&source[7].length<=source[8]&&bitmask==WRAP_CURRY_FLAG;// Exit early if metadata can't be merged.
  2746. if(!(isCommon||isCombo)){return data;}// Use source `thisArg` if available.
  2747. if(srcBitmask&WRAP_BIND_FLAG){data[2]=source[2];// Set when currying a bound function.
  2748. newBitmask|=bitmask&WRAP_BIND_FLAG?0:WRAP_CURRY_BOUND_FLAG;}// Compose partial arguments.
  2749. var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):value;data[4]=partials?replaceHolders(data[3],PLACEHOLDER):source[4];}// Compose partial right arguments.
  2750. value=source[5];if(value){partials=data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):value;data[6]=partials?replaceHolders(data[5],PLACEHOLDER):source[6];}// Use source `argPos` if available.
  2751. value=source[7];if(value){data[7]=value;}// Use source `ary` if it's smaller.
  2752. if(srcBitmask&WRAP_ARY_FLAG){data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8]);}// Use source `arity` if one is not provided.
  2753. if(data[9]==null){data[9]=source[9];}// Use source `func` and merge bitmasks.
  2754. data[0]=source[0];data[1]=newBitmask;return data;}/**
  2755. * This function is like
  2756. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2757. * except that it includes inherited enumerable properties.
  2758. *
  2759. * @private
  2760. * @param {Object} object The object to query.
  2761. * @returns {Array} Returns the array of property names.
  2762. */function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key);}}return result;}/**
  2763. * Converts `value` to a string using `Object.prototype.toString`.
  2764. *
  2765. * @private
  2766. * @param {*} value The value to convert.
  2767. * @returns {string} Returns the converted string.
  2768. */function objectToString(value){return nativeObjectToString.call(value);}/**
  2769. * A specialized version of `baseRest` which transforms the rest array.
  2770. *
  2771. * @private
  2772. * @param {Function} func The function to apply a rest parameter to.
  2773. * @param {number} [start=func.length-1] The start position of the rest parameter.
  2774. * @param {Function} transform The rest array transform.
  2775. * @returns {Function} Returns the new function.
  2776. */function overRest(func,start,transform){start=nativeMax(start===undefined$1?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index<length){array[index]=args[start+index];}index=-1;var otherArgs=Array(start+1);while(++index<start){otherArgs[index]=args[index];}otherArgs[start]=transform(array);return apply(func,this,otherArgs);};}/**
  2777. * Gets the parent value at `path` of `object`.
  2778. *
  2779. * @private
  2780. * @param {Object} object The object to query.
  2781. * @param {Array} path The path to get the parent value of.
  2782. * @returns {*} Returns the parent value.
  2783. */function parent(object,path){return path.length<2?object:baseGet(object,baseSlice(path,0,-1));}/**
  2784. * Reorder `array` according to the specified indexes where the element at
  2785. * the first index is assigned as the first element, the element at
  2786. * the second index is assigned as the second element, and so on.
  2787. *
  2788. * @private
  2789. * @param {Array} array The array to reorder.
  2790. * @param {Array} indexes The arranged array indexes.
  2791. * @returns {Array} Returns `array`.
  2792. */function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=copyArray(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined$1;}return array;}/**
  2793. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  2794. *
  2795. * @private
  2796. * @param {Object} object The object to query.
  2797. * @param {string} key The key of the property to get.
  2798. * @returns {*} Returns the property value.
  2799. */function safeGet(object,key){if(key==='constructor'&&typeof object[key]==='function'){return;}if(key=='__proto__'){return;}return object[key];}/**
  2800. * Sets metadata for `func`.
  2801. *
  2802. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  2803. * period of time, it will trip its breaker and transition to an identity
  2804. * function to avoid garbage collection pauses in V8. See
  2805. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  2806. * for more details.
  2807. *
  2808. * @private
  2809. * @param {Function} func The function to associate metadata with.
  2810. * @param {*} data The metadata.
  2811. * @returns {Function} Returns `func`.
  2812. */var setData=shortOut(baseSetData);/**
  2813. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  2814. *
  2815. * @private
  2816. * @param {Function} func The function to delay.
  2817. * @param {number} wait The number of milliseconds to delay invocation.
  2818. * @returns {number|Object} Returns the timer id or timeout object.
  2819. */var setTimeout=ctxSetTimeout||function(func,wait){return root.setTimeout(func,wait);};/**
  2820. * Sets the `toString` method of `func` to return `string`.
  2821. *
  2822. * @private
  2823. * @param {Function} func The function to modify.
  2824. * @param {Function} string The `toString` result.
  2825. * @returns {Function} Returns `func`.
  2826. */var setToString=shortOut(baseSetToString);/**
  2827. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  2828. * with wrapper details in a comment at the top of the source body.
  2829. *
  2830. * @private
  2831. * @param {Function} wrapper The function to modify.
  2832. * @param {Function} reference The reference function.
  2833. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2834. * @returns {Function} Returns `wrapper`.
  2835. */function setWrapToString(wrapper,reference,bitmask){var source=reference+'';return setToString(wrapper,insertWrapDetails(source,updateWrapDetails(getWrapDetails(source),bitmask)));}/**
  2836. * Creates a function that'll short out and invoke `identity` instead
  2837. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  2838. * milliseconds.
  2839. *
  2840. * @private
  2841. * @param {Function} func The function to restrict.
  2842. * @returns {Function} Returns the new shortable function.
  2843. */function shortOut(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT){return arguments[0];}}else {count=0;}return func.apply(undefined$1,arguments);};}/**
  2844. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  2845. *
  2846. * @private
  2847. * @param {Array} array The array to shuffle.
  2848. * @param {number} [size=array.length] The size of `array`.
  2849. * @returns {Array} Returns `array`.
  2850. */function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;size=size===undefined$1?length:size;while(++index<size){var rand=baseRandom(index,lastIndex),value=array[rand];array[rand]=array[index];array[index]=value;}array.length=size;return array;}/**
  2851. * Converts `string` to a property path array.
  2852. *
  2853. * @private
  2854. * @param {string} string The string to convert.
  2855. * @returns {Array} Returns the property path array.
  2856. */var stringToPath=memoizeCapped(function(string){var result=[];if(string.charCodeAt(0)===46/* . */){result.push('');}string.replace(rePropName,function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,'$1'):number||match);});return result;});/**
  2857. * Converts `value` to a string key if it's not a string or symbol.
  2858. *
  2859. * @private
  2860. * @param {*} value The value to inspect.
  2861. * @returns {string|symbol} Returns the key.
  2862. */function toKey(value){if(typeof value=='string'||isSymbol(value)){return value;}var result=value+'';return result=='0'&&1/value==-INFINITY?'-0':result;}/**
  2863. * Converts `func` to its source code.
  2864. *
  2865. * @private
  2866. * @param {Function} func The function to convert.
  2867. * @returns {string} Returns the source code.
  2868. */function toSource(func){if(func!=null){try{return funcToString.call(func);}catch(e){}try{return func+'';}catch(e){}}return '';}/**
  2869. * Updates wrapper `details` based on `bitmask` flags.
  2870. *
  2871. * @private
  2872. * @returns {Array} details The details to modify.
  2873. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2874. * @returns {Array} Returns `details`.
  2875. */function updateWrapDetails(details,bitmask){arrayEach(wrapFlags,function(pair){var value='_.'+pair[0];if(bitmask&pair[1]&&!arrayIncludes(details,value)){details.push(value);}});return details.sort();}/**
  2876. * Creates a clone of `wrapper`.
  2877. *
  2878. * @private
  2879. * @param {Object} wrapper The wrapper to clone.
  2880. * @returns {Object} Returns the cloned wrapper.
  2881. */function wrapperClone(wrapper){if(wrapper instanceof LazyWrapper){return wrapper.clone();}var result=new LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);result.__actions__=copyArray(wrapper.__actions__);result.__index__=wrapper.__index__;result.__values__=wrapper.__values__;return result;}/*------------------------------------------------------------------------*/ /**
  2882. * Creates an array of elements split into groups the length of `size`.
  2883. * If `array` can't be split evenly, the final chunk will be the remaining
  2884. * elements.
  2885. *
  2886. * @static
  2887. * @memberOf _
  2888. * @since 3.0.0
  2889. * @category Array
  2890. * @param {Array} array The array to process.
  2891. * @param {number} [size=1] The length of each chunk
  2892. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  2893. * @returns {Array} Returns the new array of chunks.
  2894. * @example
  2895. *
  2896. * _.chunk(['a', 'b', 'c', 'd'], 2);
  2897. * // => [['a', 'b'], ['c', 'd']]
  2898. *
  2899. * _.chunk(['a', 'b', 'c', 'd'], 3);
  2900. * // => [['a', 'b', 'c'], ['d']]
  2901. */function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size===undefined$1){size=1;}else {size=nativeMax(toInteger(size),0);}var length=array==null?0:array.length;if(!length||size<1){return [];}var index=0,resIndex=0,result=Array(nativeCeil(length/size));while(index<length){result[resIndex++]=baseSlice(array,index,index+=size);}return result;}/**
  2902. * Creates an array with all falsey values removed. The values `false`, `null`,
  2903. * `0`, `""`, `undefined`, and `NaN` are falsey.
  2904. *
  2905. * @static
  2906. * @memberOf _
  2907. * @since 0.1.0
  2908. * @category Array
  2909. * @param {Array} array The array to compact.
  2910. * @returns {Array} Returns the new array of filtered values.
  2911. * @example
  2912. *
  2913. * _.compact([0, 1, false, 2, '', 3]);
  2914. * // => [1, 2, 3]
  2915. */function compact(array){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value){result[resIndex++]=value;}}return result;}/**
  2916. * Creates a new array concatenating `array` with any additional arrays
  2917. * and/or values.
  2918. *
  2919. * @static
  2920. * @memberOf _
  2921. * @since 4.0.0
  2922. * @category Array
  2923. * @param {Array} array The array to concatenate.
  2924. * @param {...*} [values] The values to concatenate.
  2925. * @returns {Array} Returns the new concatenated array.
  2926. * @example
  2927. *
  2928. * var array = [1];
  2929. * var other = _.concat(array, 2, [3], [[4]]);
  2930. *
  2931. * console.log(other);
  2932. * // => [1, 2, 3, [4]]
  2933. *
  2934. * console.log(array);
  2935. * // => [1]
  2936. */function concat(){var length=arguments.length;if(!length){return [];}var args=Array(length-1),array=arguments[0],index=length;while(index--){args[index-1]=arguments[index];}return arrayPush(isArray(array)?copyArray(array):[array],baseFlatten(args,1));}/**
  2937. * Creates an array of `array` values not included in the other given arrays
  2938. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2939. * for equality comparisons. The order and references of result values are
  2940. * determined by the first array.
  2941. *
  2942. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  2943. *
  2944. * @static
  2945. * @memberOf _
  2946. * @since 0.1.0
  2947. * @category Array
  2948. * @param {Array} array The array to inspect.
  2949. * @param {...Array} [values] The values to exclude.
  2950. * @returns {Array} Returns the new array of filtered values.
  2951. * @see _.without, _.xor
  2952. * @example
  2953. *
  2954. * _.difference([2, 1], [2, 3]);
  2955. * // => [1]
  2956. */var difference=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)):[];});/**
  2957. * This method is like `_.difference` except that it accepts `iteratee` which
  2958. * is invoked for each element of `array` and `values` to generate the criterion
  2959. * by which they're compared. The order and references of result values are
  2960. * determined by the first array. The iteratee is invoked with one argument:
  2961. * (value).
  2962. *
  2963. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  2964. *
  2965. * @static
  2966. * @memberOf _
  2967. * @since 4.0.0
  2968. * @category Array
  2969. * @param {Array} array The array to inspect.
  2970. * @param {...Array} [values] The values to exclude.
  2971. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  2972. * @returns {Array} Returns the new array of filtered values.
  2973. * @example
  2974. *
  2975. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  2976. * // => [1.2]
  2977. *
  2978. * // The `_.property` iteratee shorthand.
  2979. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  2980. * // => [{ 'x': 2 }]
  2981. */var differenceBy=baseRest(function(array,values){var iteratee=last(values);if(isArrayLikeObject(iteratee)){iteratee=undefined$1;}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),getIteratee(iteratee,2)):[];});/**
  2982. * This method is like `_.difference` except that it accepts `comparator`
  2983. * which is invoked to compare elements of `array` to `values`. The order and
  2984. * references of result values are determined by the first array. The comparator
  2985. * is invoked with two arguments: (arrVal, othVal).
  2986. *
  2987. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  2988. *
  2989. * @static
  2990. * @memberOf _
  2991. * @since 4.0.0
  2992. * @category Array
  2993. * @param {Array} array The array to inspect.
  2994. * @param {...Array} [values] The values to exclude.
  2995. * @param {Function} [comparator] The comparator invoked per element.
  2996. * @returns {Array} Returns the new array of filtered values.
  2997. * @example
  2998. *
  2999. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  3000. *
  3001. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  3002. * // => [{ 'x': 2, 'y': 1 }]
  3003. */var differenceWith=baseRest(function(array,values){var comparator=last(values);if(isArrayLikeObject(comparator)){comparator=undefined$1;}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),undefined$1,comparator):[];});/**
  3004. * Creates a slice of `array` with `n` elements dropped from the beginning.
  3005. *
  3006. * @static
  3007. * @memberOf _
  3008. * @since 0.5.0
  3009. * @category Array
  3010. * @param {Array} array The array to query.
  3011. * @param {number} [n=1] The number of elements to drop.
  3012. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3013. * @returns {Array} Returns the slice of `array`.
  3014. * @example
  3015. *
  3016. * _.drop([1, 2, 3]);
  3017. * // => [2, 3]
  3018. *
  3019. * _.drop([1, 2, 3], 2);
  3020. * // => [3]
  3021. *
  3022. * _.drop([1, 2, 3], 5);
  3023. * // => []
  3024. *
  3025. * _.drop([1, 2, 3], 0);
  3026. * // => [1, 2, 3]
  3027. */function drop(array,n,guard){var length=array==null?0:array.length;if(!length){return [];}n=guard||n===undefined$1?1:toInteger(n);return baseSlice(array,n<0?0:n,length);}/**
  3028. * Creates a slice of `array` with `n` elements dropped from the end.
  3029. *
  3030. * @static
  3031. * @memberOf _
  3032. * @since 3.0.0
  3033. * @category Array
  3034. * @param {Array} array The array to query.
  3035. * @param {number} [n=1] The number of elements to drop.
  3036. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3037. * @returns {Array} Returns the slice of `array`.
  3038. * @example
  3039. *
  3040. * _.dropRight([1, 2, 3]);
  3041. * // => [1, 2]
  3042. *
  3043. * _.dropRight([1, 2, 3], 2);
  3044. * // => [1]
  3045. *
  3046. * _.dropRight([1, 2, 3], 5);
  3047. * // => []
  3048. *
  3049. * _.dropRight([1, 2, 3], 0);
  3050. * // => [1, 2, 3]
  3051. */function dropRight(array,n,guard){var length=array==null?0:array.length;if(!length){return [];}n=guard||n===undefined$1?1:toInteger(n);n=length-n;return baseSlice(array,0,n<0?0:n);}/**
  3052. * Creates a slice of `array` excluding elements dropped from the end.
  3053. * Elements are dropped until `predicate` returns falsey. The predicate is
  3054. * invoked with three arguments: (value, index, array).
  3055. *
  3056. * @static
  3057. * @memberOf _
  3058. * @since 3.0.0
  3059. * @category Array
  3060. * @param {Array} array The array to query.
  3061. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3062. * @returns {Array} Returns the slice of `array`.
  3063. * @example
  3064. *
  3065. * var users = [
  3066. * { 'user': 'barney', 'active': true },
  3067. * { 'user': 'fred', 'active': false },
  3068. * { 'user': 'pebbles', 'active': false }
  3069. * ];
  3070. *
  3071. * _.dropRightWhile(users, function(o) { return !o.active; });
  3072. * // => objects for ['barney']
  3073. *
  3074. * // The `_.matches` iteratee shorthand.
  3075. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  3076. * // => objects for ['barney', 'fred']
  3077. *
  3078. * // The `_.matchesProperty` iteratee shorthand.
  3079. * _.dropRightWhile(users, ['active', false]);
  3080. * // => objects for ['barney']
  3081. *
  3082. * // The `_.property` iteratee shorthand.
  3083. * _.dropRightWhile(users, 'active');
  3084. * // => objects for ['barney', 'fred', 'pebbles']
  3085. */function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[];}/**
  3086. * Creates a slice of `array` excluding elements dropped from the beginning.
  3087. * Elements are dropped until `predicate` returns falsey. The predicate is
  3088. * invoked with three arguments: (value, index, array).
  3089. *
  3090. * @static
  3091. * @memberOf _
  3092. * @since 3.0.0
  3093. * @category Array
  3094. * @param {Array} array The array to query.
  3095. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3096. * @returns {Array} Returns the slice of `array`.
  3097. * @example
  3098. *
  3099. * var users = [
  3100. * { 'user': 'barney', 'active': false },
  3101. * { 'user': 'fred', 'active': false },
  3102. * { 'user': 'pebbles', 'active': true }
  3103. * ];
  3104. *
  3105. * _.dropWhile(users, function(o) { return !o.active; });
  3106. * // => objects for ['pebbles']
  3107. *
  3108. * // The `_.matches` iteratee shorthand.
  3109. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  3110. * // => objects for ['fred', 'pebbles']
  3111. *
  3112. * // The `_.matchesProperty` iteratee shorthand.
  3113. * _.dropWhile(users, ['active', false]);
  3114. * // => objects for ['pebbles']
  3115. *
  3116. * // The `_.property` iteratee shorthand.
  3117. * _.dropWhile(users, 'active');
  3118. * // => objects for ['barney', 'fred', 'pebbles']
  3119. */function dropWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true):[];}/**
  3120. * Fills elements of `array` with `value` from `start` up to, but not
  3121. * including, `end`.
  3122. *
  3123. * **Note:** This method mutates `array`.
  3124. *
  3125. * @static
  3126. * @memberOf _
  3127. * @since 3.2.0
  3128. * @category Array
  3129. * @param {Array} array The array to fill.
  3130. * @param {*} value The value to fill `array` with.
  3131. * @param {number} [start=0] The start position.
  3132. * @param {number} [end=array.length] The end position.
  3133. * @returns {Array} Returns `array`.
  3134. * @example
  3135. *
  3136. * var array = [1, 2, 3];
  3137. *
  3138. * _.fill(array, 'a');
  3139. * console.log(array);
  3140. * // => ['a', 'a', 'a']
  3141. *
  3142. * _.fill(Array(3), 2);
  3143. * // => [2, 2, 2]
  3144. *
  3145. * _.fill([4, 6, 8, 10], '*', 1, 3);
  3146. * // => [4, '*', '*', 10]
  3147. */function fill(array,value,start,end){var length=array==null?0:array.length;if(!length){return [];}if(start&&typeof start!='number'&&isIterateeCall(array,value,start)){start=0;end=length;}return baseFill(array,value,start,end);}/**
  3148. * This method is like `_.find` except that it returns the index of the first
  3149. * element `predicate` returns truthy for instead of the element itself.
  3150. *
  3151. * @static
  3152. * @memberOf _
  3153. * @since 1.1.0
  3154. * @category Array
  3155. * @param {Array} array The array to inspect.
  3156. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3157. * @param {number} [fromIndex=0] The index to search from.
  3158. * @returns {number} Returns the index of the found element, else `-1`.
  3159. * @example
  3160. *
  3161. * var users = [
  3162. * { 'user': 'barney', 'active': false },
  3163. * { 'user': 'fred', 'active': false },
  3164. * { 'user': 'pebbles', 'active': true }
  3165. * ];
  3166. *
  3167. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  3168. * // => 0
  3169. *
  3170. * // The `_.matches` iteratee shorthand.
  3171. * _.findIndex(users, { 'user': 'fred', 'active': false });
  3172. * // => 1
  3173. *
  3174. * // The `_.matchesProperty` iteratee shorthand.
  3175. * _.findIndex(users, ['active', false]);
  3176. * // => 0
  3177. *
  3178. * // The `_.property` iteratee shorthand.
  3179. * _.findIndex(users, 'active');
  3180. * // => 2
  3181. */function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return -1;}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0);}return baseFindIndex(array,getIteratee(predicate,3),index);}/**
  3182. * This method is like `_.findIndex` except that it iterates over elements
  3183. * of `collection` from right to left.
  3184. *
  3185. * @static
  3186. * @memberOf _
  3187. * @since 2.0.0
  3188. * @category Array
  3189. * @param {Array} array The array to inspect.
  3190. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3191. * @param {number} [fromIndex=array.length-1] The index to search from.
  3192. * @returns {number} Returns the index of the found element, else `-1`.
  3193. * @example
  3194. *
  3195. * var users = [
  3196. * { 'user': 'barney', 'active': true },
  3197. * { 'user': 'fred', 'active': false },
  3198. * { 'user': 'pebbles', 'active': false }
  3199. * ];
  3200. *
  3201. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  3202. * // => 2
  3203. *
  3204. * // The `_.matches` iteratee shorthand.
  3205. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  3206. * // => 0
  3207. *
  3208. * // The `_.matchesProperty` iteratee shorthand.
  3209. * _.findLastIndex(users, ['active', false]);
  3210. * // => 2
  3211. *
  3212. * // The `_.property` iteratee shorthand.
  3213. * _.findLastIndex(users, 'active');
  3214. * // => 0
  3215. */function findLastIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return -1;}var index=length-1;if(fromIndex!==undefined$1){index=toInteger(fromIndex);index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1);}return baseFindIndex(array,getIteratee(predicate,3),index,true);}/**
  3216. * Flattens `array` a single level deep.
  3217. *
  3218. * @static
  3219. * @memberOf _
  3220. * @since 0.1.0
  3221. * @category Array
  3222. * @param {Array} array The array to flatten.
  3223. * @returns {Array} Returns the new flattened array.
  3224. * @example
  3225. *
  3226. * _.flatten([1, [2, [3, [4]], 5]]);
  3227. * // => [1, 2, [3, [4]], 5]
  3228. */function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[];}/**
  3229. * Recursively flattens `array`.
  3230. *
  3231. * @static
  3232. * @memberOf _
  3233. * @since 3.0.0
  3234. * @category Array
  3235. * @param {Array} array The array to flatten.
  3236. * @returns {Array} Returns the new flattened array.
  3237. * @example
  3238. *
  3239. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  3240. * // => [1, 2, 3, 4, 5]
  3241. */function flattenDeep(array){var length=array==null?0:array.length;return length?baseFlatten(array,INFINITY):[];}/**
  3242. * Recursively flatten `array` up to `depth` times.
  3243. *
  3244. * @static
  3245. * @memberOf _
  3246. * @since 4.4.0
  3247. * @category Array
  3248. * @param {Array} array The array to flatten.
  3249. * @param {number} [depth=1] The maximum recursion depth.
  3250. * @returns {Array} Returns the new flattened array.
  3251. * @example
  3252. *
  3253. * var array = [1, [2, [3, [4]], 5]];
  3254. *
  3255. * _.flattenDepth(array, 1);
  3256. * // => [1, 2, [3, [4]], 5]
  3257. *
  3258. * _.flattenDepth(array, 2);
  3259. * // => [1, 2, 3, [4], 5]
  3260. */function flattenDepth(array,depth){var length=array==null?0:array.length;if(!length){return [];}depth=depth===undefined$1?1:toInteger(depth);return baseFlatten(array,depth);}/**
  3261. * The inverse of `_.toPairs`; this method returns an object composed
  3262. * from key-value `pairs`.
  3263. *
  3264. * @static
  3265. * @memberOf _
  3266. * @since 4.0.0
  3267. * @category Array
  3268. * @param {Array} pairs The key-value pairs.
  3269. * @returns {Object} Returns the new object.
  3270. * @example
  3271. *
  3272. * _.fromPairs([['a', 1], ['b', 2]]);
  3273. * // => { 'a': 1, 'b': 2 }
  3274. */function fromPairs(pairs){var index=-1,length=pairs==null?0:pairs.length,result={};while(++index<length){var pair=pairs[index];result[pair[0]]=pair[1];}return result;}/**
  3275. * Gets the first element of `array`.
  3276. *
  3277. * @static
  3278. * @memberOf _
  3279. * @since 0.1.0
  3280. * @alias first
  3281. * @category Array
  3282. * @param {Array} array The array to query.
  3283. * @returns {*} Returns the first element of `array`.
  3284. * @example
  3285. *
  3286. * _.head([1, 2, 3]);
  3287. * // => 1
  3288. *
  3289. * _.head([]);
  3290. * // => undefined
  3291. */function head(array){return array&&array.length?array[0]:undefined$1;}/**
  3292. * Gets the index at which the first occurrence of `value` is found in `array`
  3293. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3294. * for equality comparisons. If `fromIndex` is negative, it's used as the
  3295. * offset from the end of `array`.
  3296. *
  3297. * @static
  3298. * @memberOf _
  3299. * @since 0.1.0
  3300. * @category Array
  3301. * @param {Array} array The array to inspect.
  3302. * @param {*} value The value to search for.
  3303. * @param {number} [fromIndex=0] The index to search from.
  3304. * @returns {number} Returns the index of the matched value, else `-1`.
  3305. * @example
  3306. *
  3307. * _.indexOf([1, 2, 1, 2], 2);
  3308. * // => 1
  3309. *
  3310. * // Search from the `fromIndex`.
  3311. * _.indexOf([1, 2, 1, 2], 2, 2);
  3312. * // => 3
  3313. */function indexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length){return -1;}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0);}return baseIndexOf(array,value,index);}/**
  3314. * Gets all but the last element of `array`.
  3315. *
  3316. * @static
  3317. * @memberOf _
  3318. * @since 0.1.0
  3319. * @category Array
  3320. * @param {Array} array The array to query.
  3321. * @returns {Array} Returns the slice of `array`.
  3322. * @example
  3323. *
  3324. * _.initial([1, 2, 3]);
  3325. * // => [1, 2]
  3326. */function initial(array){var length=array==null?0:array.length;return length?baseSlice(array,0,-1):[];}/**
  3327. * Creates an array of unique values that are included in all given arrays
  3328. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3329. * for equality comparisons. The order and references of result values are
  3330. * determined by the first array.
  3331. *
  3332. * @static
  3333. * @memberOf _
  3334. * @since 0.1.0
  3335. * @category Array
  3336. * @param {...Array} [arrays] The arrays to inspect.
  3337. * @returns {Array} Returns the new array of intersecting values.
  3338. * @example
  3339. *
  3340. * _.intersection([2, 1], [2, 3]);
  3341. * // => [2]
  3342. */var intersection=baseRest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[];});/**
  3343. * This method is like `_.intersection` except that it accepts `iteratee`
  3344. * which is invoked for each element of each `arrays` to generate the criterion
  3345. * by which they're compared. The order and references of result values are
  3346. * determined by the first array. The iteratee is invoked with one argument:
  3347. * (value).
  3348. *
  3349. * @static
  3350. * @memberOf _
  3351. * @since 4.0.0
  3352. * @category Array
  3353. * @param {...Array} [arrays] The arrays to inspect.
  3354. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3355. * @returns {Array} Returns the new array of intersecting values.
  3356. * @example
  3357. *
  3358. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  3359. * // => [2.1]
  3360. *
  3361. * // The `_.property` iteratee shorthand.
  3362. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  3363. * // => [{ 'x': 1 }]
  3364. */var intersectionBy=baseRest(function(arrays){var iteratee=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);if(iteratee===last(mapped)){iteratee=undefined$1;}else {mapped.pop();}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,getIteratee(iteratee,2)):[];});/**
  3365. * This method is like `_.intersection` except that it accepts `comparator`
  3366. * which is invoked to compare elements of `arrays`. The order and references
  3367. * of result values are determined by the first array. The comparator is
  3368. * invoked with two arguments: (arrVal, othVal).
  3369. *
  3370. * @static
  3371. * @memberOf _
  3372. * @since 4.0.0
  3373. * @category Array
  3374. * @param {...Array} [arrays] The arrays to inspect.
  3375. * @param {Function} [comparator] The comparator invoked per element.
  3376. * @returns {Array} Returns the new array of intersecting values.
  3377. * @example
  3378. *
  3379. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  3380. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  3381. *
  3382. * _.intersectionWith(objects, others, _.isEqual);
  3383. * // => [{ 'x': 1, 'y': 2 }]
  3384. */var intersectionWith=baseRest(function(arrays){var comparator=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);comparator=typeof comparator=='function'?comparator:undefined$1;if(comparator){mapped.pop();}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,undefined$1,comparator):[];});/**
  3385. * Converts all elements in `array` into a string separated by `separator`.
  3386. *
  3387. * @static
  3388. * @memberOf _
  3389. * @since 4.0.0
  3390. * @category Array
  3391. * @param {Array} array The array to convert.
  3392. * @param {string} [separator=','] The element separator.
  3393. * @returns {string} Returns the joined string.
  3394. * @example
  3395. *
  3396. * _.join(['a', 'b', 'c'], '~');
  3397. * // => 'a~b~c'
  3398. */function join(array,separator){return array==null?'':nativeJoin.call(array,separator);}/**
  3399. * Gets the last element of `array`.
  3400. *
  3401. * @static
  3402. * @memberOf _
  3403. * @since 0.1.0
  3404. * @category Array
  3405. * @param {Array} array The array to query.
  3406. * @returns {*} Returns the last element of `array`.
  3407. * @example
  3408. *
  3409. * _.last([1, 2, 3]);
  3410. * // => 3
  3411. */function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined$1;}/**
  3412. * This method is like `_.indexOf` except that it iterates over elements of
  3413. * `array` from right to left.
  3414. *
  3415. * @static
  3416. * @memberOf _
  3417. * @since 0.1.0
  3418. * @category Array
  3419. * @param {Array} array The array to inspect.
  3420. * @param {*} value The value to search for.
  3421. * @param {number} [fromIndex=array.length-1] The index to search from.
  3422. * @returns {number} Returns the index of the matched value, else `-1`.
  3423. * @example
  3424. *
  3425. * _.lastIndexOf([1, 2, 1, 2], 2);
  3426. * // => 3
  3427. *
  3428. * // Search from the `fromIndex`.
  3429. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  3430. * // => 1
  3431. */function lastIndexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length){return -1;}var index=length;if(fromIndex!==undefined$1){index=toInteger(fromIndex);index=index<0?nativeMax(length+index,0):nativeMin(index,length-1);}return value===value?strictLastIndexOf(array,value,index):baseFindIndex(array,baseIsNaN,index,true);}/**
  3432. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  3433. * element from the end is returned.
  3434. *
  3435. * @static
  3436. * @memberOf _
  3437. * @since 4.11.0
  3438. * @category Array
  3439. * @param {Array} array The array to query.
  3440. * @param {number} [n=0] The index of the element to return.
  3441. * @returns {*} Returns the nth element of `array`.
  3442. * @example
  3443. *
  3444. * var array = ['a', 'b', 'c', 'd'];
  3445. *
  3446. * _.nth(array, 1);
  3447. * // => 'b'
  3448. *
  3449. * _.nth(array, -2);
  3450. * // => 'c';
  3451. */function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined$1;}/**
  3452. * Removes all given values from `array` using
  3453. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3454. * for equality comparisons.
  3455. *
  3456. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  3457. * to remove elements from an array by predicate.
  3458. *
  3459. * @static
  3460. * @memberOf _
  3461. * @since 2.0.0
  3462. * @category Array
  3463. * @param {Array} array The array to modify.
  3464. * @param {...*} [values] The values to remove.
  3465. * @returns {Array} Returns `array`.
  3466. * @example
  3467. *
  3468. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  3469. *
  3470. * _.pull(array, 'a', 'c');
  3471. * console.log(array);
  3472. * // => ['b', 'b']
  3473. */var pull=baseRest(pullAll);/**
  3474. * This method is like `_.pull` except that it accepts an array of values to remove.
  3475. *
  3476. * **Note:** Unlike `_.difference`, this method mutates `array`.
  3477. *
  3478. * @static
  3479. * @memberOf _
  3480. * @since 4.0.0
  3481. * @category Array
  3482. * @param {Array} array The array to modify.
  3483. * @param {Array} values The values to remove.
  3484. * @returns {Array} Returns `array`.
  3485. * @example
  3486. *
  3487. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  3488. *
  3489. * _.pullAll(array, ['a', 'c']);
  3490. * console.log(array);
  3491. * // => ['b', 'b']
  3492. */function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array;}/**
  3493. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  3494. * invoked for each element of `array` and `values` to generate the criterion
  3495. * by which they're compared. The iteratee is invoked with one argument: (value).
  3496. *
  3497. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  3498. *
  3499. * @static
  3500. * @memberOf _
  3501. * @since 4.0.0
  3502. * @category Array
  3503. * @param {Array} array The array to modify.
  3504. * @param {Array} values The values to remove.
  3505. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3506. * @returns {Array} Returns `array`.
  3507. * @example
  3508. *
  3509. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  3510. *
  3511. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  3512. * console.log(array);
  3513. * // => [{ 'x': 2 }]
  3514. */function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee,2)):array;}/**
  3515. * This method is like `_.pullAll` except that it accepts `comparator` which
  3516. * is invoked to compare elements of `array` to `values`. The comparator is
  3517. * invoked with two arguments: (arrVal, othVal).
  3518. *
  3519. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  3520. *
  3521. * @static
  3522. * @memberOf _
  3523. * @since 4.6.0
  3524. * @category Array
  3525. * @param {Array} array The array to modify.
  3526. * @param {Array} values The values to remove.
  3527. * @param {Function} [comparator] The comparator invoked per element.
  3528. * @returns {Array} Returns `array`.
  3529. * @example
  3530. *
  3531. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  3532. *
  3533. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  3534. * console.log(array);
  3535. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  3536. */function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array,values,undefined$1,comparator):array;}/**
  3537. * Removes elements from `array` corresponding to `indexes` and returns an
  3538. * array of removed elements.
  3539. *
  3540. * **Note:** Unlike `_.at`, this method mutates `array`.
  3541. *
  3542. * @static
  3543. * @memberOf _
  3544. * @since 3.0.0
  3545. * @category Array
  3546. * @param {Array} array The array to modify.
  3547. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  3548. * @returns {Array} Returns the new array of removed elements.
  3549. * @example
  3550. *
  3551. * var array = ['a', 'b', 'c', 'd'];
  3552. * var pulled = _.pullAt(array, [1, 3]);
  3553. *
  3554. * console.log(array);
  3555. * // => ['a', 'c']
  3556. *
  3557. * console.log(pulled);
  3558. * // => ['b', 'd']
  3559. */var pullAt=flatRest(function(array,indexes){var length=array==null?0:array.length,result=baseAt(array,indexes);basePullAt(array,arrayMap(indexes,function(index){return isIndex(index,length)?+index:index;}).sort(compareAscending));return result;});/**
  3560. * Removes all elements from `array` that `predicate` returns truthy for
  3561. * and returns an array of the removed elements. The predicate is invoked
  3562. * with three arguments: (value, index, array).
  3563. *
  3564. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  3565. * to pull elements from an array by value.
  3566. *
  3567. * @static
  3568. * @memberOf _
  3569. * @since 2.0.0
  3570. * @category Array
  3571. * @param {Array} array The array to modify.
  3572. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3573. * @returns {Array} Returns the new array of removed elements.
  3574. * @example
  3575. *
  3576. * var array = [1, 2, 3, 4];
  3577. * var evens = _.remove(array, function(n) {
  3578. * return n % 2 == 0;
  3579. * });
  3580. *
  3581. * console.log(array);
  3582. * // => [1, 3]
  3583. *
  3584. * console.log(evens);
  3585. * // => [2, 4]
  3586. */function remove(array,predicate){var result=[];if(!(array&&array.length)){return result;}var index=-1,indexes=[],length=array.length;predicate=getIteratee(predicate,3);while(++index<length){var value=array[index];if(predicate(value,index,array)){result.push(value);indexes.push(index);}}basePullAt(array,indexes);return result;}/**
  3587. * Reverses `array` so that the first element becomes the last, the second
  3588. * element becomes the second to last, and so on.
  3589. *
  3590. * **Note:** This method mutates `array` and is based on
  3591. * [`Array#reverse`](https://mdn.io/Array/reverse).
  3592. *
  3593. * @static
  3594. * @memberOf _
  3595. * @since 4.0.0
  3596. * @category Array
  3597. * @param {Array} array The array to modify.
  3598. * @returns {Array} Returns `array`.
  3599. * @example
  3600. *
  3601. * var array = [1, 2, 3];
  3602. *
  3603. * _.reverse(array);
  3604. * // => [3, 2, 1]
  3605. *
  3606. * console.log(array);
  3607. * // => [3, 2, 1]
  3608. */function reverse(array){return array==null?array:nativeReverse.call(array);}/**
  3609. * Creates a slice of `array` from `start` up to, but not including, `end`.
  3610. *
  3611. * **Note:** This method is used instead of
  3612. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  3613. * returned.
  3614. *
  3615. * @static
  3616. * @memberOf _
  3617. * @since 3.0.0
  3618. * @category Array
  3619. * @param {Array} array The array to slice.
  3620. * @param {number} [start=0] The start position.
  3621. * @param {number} [end=array.length] The end position.
  3622. * @returns {Array} Returns the slice of `array`.
  3623. */function slice(array,start,end){var length=array==null?0:array.length;if(!length){return [];}if(end&&typeof end!='number'&&isIterateeCall(array,start,end)){start=0;end=length;}else {start=start==null?0:toInteger(start);end=end===undefined$1?length:toInteger(end);}return baseSlice(array,start,end);}/**
  3624. * Uses a binary search to determine the lowest index at which `value`
  3625. * should be inserted into `array` in order to maintain its sort order.
  3626. *
  3627. * @static
  3628. * @memberOf _
  3629. * @since 0.1.0
  3630. * @category Array
  3631. * @param {Array} array The sorted array to inspect.
  3632. * @param {*} value The value to evaluate.
  3633. * @returns {number} Returns the index at which `value` should be inserted
  3634. * into `array`.
  3635. * @example
  3636. *
  3637. * _.sortedIndex([30, 50], 40);
  3638. * // => 1
  3639. */function sortedIndex(array,value){return baseSortedIndex(array,value);}/**
  3640. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  3641. * which is invoked for `value` and each element of `array` to compute their
  3642. * sort ranking. The iteratee is invoked with one argument: (value).
  3643. *
  3644. * @static
  3645. * @memberOf _
  3646. * @since 4.0.0
  3647. * @category Array
  3648. * @param {Array} array The sorted array to inspect.
  3649. * @param {*} value The value to evaluate.
  3650. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3651. * @returns {number} Returns the index at which `value` should be inserted
  3652. * into `array`.
  3653. * @example
  3654. *
  3655. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  3656. *
  3657. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  3658. * // => 0
  3659. *
  3660. * // The `_.property` iteratee shorthand.
  3661. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  3662. * // => 0
  3663. */function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2));}/**
  3664. * This method is like `_.indexOf` except that it performs a binary
  3665. * search on a sorted `array`.
  3666. *
  3667. * @static
  3668. * @memberOf _
  3669. * @since 4.0.0
  3670. * @category Array
  3671. * @param {Array} array The array to inspect.
  3672. * @param {*} value The value to search for.
  3673. * @returns {number} Returns the index of the matched value, else `-1`.
  3674. * @example
  3675. *
  3676. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  3677. * // => 1
  3678. */function sortedIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value);if(index<length&&eq(array[index],value)){return index;}}return -1;}/**
  3679. * This method is like `_.sortedIndex` except that it returns the highest
  3680. * index at which `value` should be inserted into `array` in order to
  3681. * maintain its sort order.
  3682. *
  3683. * @static
  3684. * @memberOf _
  3685. * @since 3.0.0
  3686. * @category Array
  3687. * @param {Array} array The sorted array to inspect.
  3688. * @param {*} value The value to evaluate.
  3689. * @returns {number} Returns the index at which `value` should be inserted
  3690. * into `array`.
  3691. * @example
  3692. *
  3693. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  3694. * // => 4
  3695. */function sortedLastIndex(array,value){return baseSortedIndex(array,value,true);}/**
  3696. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  3697. * which is invoked for `value` and each element of `array` to compute their
  3698. * sort ranking. The iteratee is invoked with one argument: (value).
  3699. *
  3700. * @static
  3701. * @memberOf _
  3702. * @since 4.0.0
  3703. * @category Array
  3704. * @param {Array} array The sorted array to inspect.
  3705. * @param {*} value The value to evaluate.
  3706. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3707. * @returns {number} Returns the index at which `value` should be inserted
  3708. * into `array`.
  3709. * @example
  3710. *
  3711. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  3712. *
  3713. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  3714. * // => 1
  3715. *
  3716. * // The `_.property` iteratee shorthand.
  3717. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  3718. * // => 1
  3719. */function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2),true);}/**
  3720. * This method is like `_.lastIndexOf` except that it performs a binary
  3721. * search on a sorted `array`.
  3722. *
  3723. * @static
  3724. * @memberOf _
  3725. * @since 4.0.0
  3726. * @category Array
  3727. * @param {Array} array The array to inspect.
  3728. * @param {*} value The value to search for.
  3729. * @returns {number} Returns the index of the matched value, else `-1`.
  3730. * @example
  3731. *
  3732. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  3733. * // => 3
  3734. */function sortedLastIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value,true)-1;if(eq(array[index],value)){return index;}}return -1;}/**
  3735. * This method is like `_.uniq` except that it's designed and optimized
  3736. * for sorted arrays.
  3737. *
  3738. * @static
  3739. * @memberOf _
  3740. * @since 4.0.0
  3741. * @category Array
  3742. * @param {Array} array The array to inspect.
  3743. * @returns {Array} Returns the new duplicate free array.
  3744. * @example
  3745. *
  3746. * _.sortedUniq([1, 1, 2]);
  3747. * // => [1, 2]
  3748. */function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[];}/**
  3749. * This method is like `_.uniqBy` except that it's designed and optimized
  3750. * for sorted arrays.
  3751. *
  3752. * @static
  3753. * @memberOf _
  3754. * @since 4.0.0
  3755. * @category Array
  3756. * @param {Array} array The array to inspect.
  3757. * @param {Function} [iteratee] The iteratee invoked per element.
  3758. * @returns {Array} Returns the new duplicate free array.
  3759. * @example
  3760. *
  3761. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  3762. * // => [1.1, 2.3]
  3763. */function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee,2)):[];}/**
  3764. * Gets all but the first element of `array`.
  3765. *
  3766. * @static
  3767. * @memberOf _
  3768. * @since 4.0.0
  3769. * @category Array
  3770. * @param {Array} array The array to query.
  3771. * @returns {Array} Returns the slice of `array`.
  3772. * @example
  3773. *
  3774. * _.tail([1, 2, 3]);
  3775. * // => [2, 3]
  3776. */function tail(array){var length=array==null?0:array.length;return length?baseSlice(array,1,length):[];}/**
  3777. * Creates a slice of `array` with `n` elements taken from the beginning.
  3778. *
  3779. * @static
  3780. * @memberOf _
  3781. * @since 0.1.0
  3782. * @category Array
  3783. * @param {Array} array The array to query.
  3784. * @param {number} [n=1] The number of elements to take.
  3785. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3786. * @returns {Array} Returns the slice of `array`.
  3787. * @example
  3788. *
  3789. * _.take([1, 2, 3]);
  3790. * // => [1]
  3791. *
  3792. * _.take([1, 2, 3], 2);
  3793. * // => [1, 2]
  3794. *
  3795. * _.take([1, 2, 3], 5);
  3796. * // => [1, 2, 3]
  3797. *
  3798. * _.take([1, 2, 3], 0);
  3799. * // => []
  3800. */function take(array,n,guard){if(!(array&&array.length)){return [];}n=guard||n===undefined$1?1:toInteger(n);return baseSlice(array,0,n<0?0:n);}/**
  3801. * Creates a slice of `array` with `n` elements taken from the end.
  3802. *
  3803. * @static
  3804. * @memberOf _
  3805. * @since 3.0.0
  3806. * @category Array
  3807. * @param {Array} array The array to query.
  3808. * @param {number} [n=1] The number of elements to take.
  3809. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3810. * @returns {Array} Returns the slice of `array`.
  3811. * @example
  3812. *
  3813. * _.takeRight([1, 2, 3]);
  3814. * // => [3]
  3815. *
  3816. * _.takeRight([1, 2, 3], 2);
  3817. * // => [2, 3]
  3818. *
  3819. * _.takeRight([1, 2, 3], 5);
  3820. * // => [1, 2, 3]
  3821. *
  3822. * _.takeRight([1, 2, 3], 0);
  3823. * // => []
  3824. */function takeRight(array,n,guard){var length=array==null?0:array.length;if(!length){return [];}n=guard||n===undefined$1?1:toInteger(n);n=length-n;return baseSlice(array,n<0?0:n,length);}/**
  3825. * Creates a slice of `array` with elements taken from the end. Elements are
  3826. * taken until `predicate` returns falsey. The predicate is invoked with
  3827. * three arguments: (value, index, array).
  3828. *
  3829. * @static
  3830. * @memberOf _
  3831. * @since 3.0.0
  3832. * @category Array
  3833. * @param {Array} array The array to query.
  3834. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3835. * @returns {Array} Returns the slice of `array`.
  3836. * @example
  3837. *
  3838. * var users = [
  3839. * { 'user': 'barney', 'active': true },
  3840. * { 'user': 'fred', 'active': false },
  3841. * { 'user': 'pebbles', 'active': false }
  3842. * ];
  3843. *
  3844. * _.takeRightWhile(users, function(o) { return !o.active; });
  3845. * // => objects for ['fred', 'pebbles']
  3846. *
  3847. * // The `_.matches` iteratee shorthand.
  3848. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  3849. * // => objects for ['pebbles']
  3850. *
  3851. * // The `_.matchesProperty` iteratee shorthand.
  3852. * _.takeRightWhile(users, ['active', false]);
  3853. * // => objects for ['fred', 'pebbles']
  3854. *
  3855. * // The `_.property` iteratee shorthand.
  3856. * _.takeRightWhile(users, 'active');
  3857. * // => []
  3858. */function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[];}/**
  3859. * Creates a slice of `array` with elements taken from the beginning. Elements
  3860. * are taken until `predicate` returns falsey. The predicate is invoked with
  3861. * three arguments: (value, index, array).
  3862. *
  3863. * @static
  3864. * @memberOf _
  3865. * @since 3.0.0
  3866. * @category Array
  3867. * @param {Array} array The array to query.
  3868. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3869. * @returns {Array} Returns the slice of `array`.
  3870. * @example
  3871. *
  3872. * var users = [
  3873. * { 'user': 'barney', 'active': false },
  3874. * { 'user': 'fred', 'active': false },
  3875. * { 'user': 'pebbles', 'active': true }
  3876. * ];
  3877. *
  3878. * _.takeWhile(users, function(o) { return !o.active; });
  3879. * // => objects for ['barney', 'fred']
  3880. *
  3881. * // The `_.matches` iteratee shorthand.
  3882. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  3883. * // => objects for ['barney']
  3884. *
  3885. * // The `_.matchesProperty` iteratee shorthand.
  3886. * _.takeWhile(users, ['active', false]);
  3887. * // => objects for ['barney', 'fred']
  3888. *
  3889. * // The `_.property` iteratee shorthand.
  3890. * _.takeWhile(users, 'active');
  3891. * // => []
  3892. */function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[];}/**
  3893. * Creates an array of unique values, in order, from all given arrays using
  3894. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3895. * for equality comparisons.
  3896. *
  3897. * @static
  3898. * @memberOf _
  3899. * @since 0.1.0
  3900. * @category Array
  3901. * @param {...Array} [arrays] The arrays to inspect.
  3902. * @returns {Array} Returns the new array of combined values.
  3903. * @example
  3904. *
  3905. * _.union([2], [1, 2]);
  3906. * // => [2, 1]
  3907. */var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true));});/**
  3908. * This method is like `_.union` except that it accepts `iteratee` which is
  3909. * invoked for each element of each `arrays` to generate the criterion by
  3910. * which uniqueness is computed. Result values are chosen from the first
  3911. * array in which the value occurs. The iteratee is invoked with one argument:
  3912. * (value).
  3913. *
  3914. * @static
  3915. * @memberOf _
  3916. * @since 4.0.0
  3917. * @category Array
  3918. * @param {...Array} [arrays] The arrays to inspect.
  3919. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3920. * @returns {Array} Returns the new array of combined values.
  3921. * @example
  3922. *
  3923. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  3924. * // => [2.1, 1.2]
  3925. *
  3926. * // The `_.property` iteratee shorthand.
  3927. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  3928. * // => [{ 'x': 1 }, { 'x': 2 }]
  3929. */var unionBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined$1;}return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),getIteratee(iteratee,2));});/**
  3930. * This method is like `_.union` except that it accepts `comparator` which
  3931. * is invoked to compare elements of `arrays`. Result values are chosen from
  3932. * the first array in which the value occurs. The comparator is invoked
  3933. * with two arguments: (arrVal, othVal).
  3934. *
  3935. * @static
  3936. * @memberOf _
  3937. * @since 4.0.0
  3938. * @category Array
  3939. * @param {...Array} [arrays] The arrays to inspect.
  3940. * @param {Function} [comparator] The comparator invoked per element.
  3941. * @returns {Array} Returns the new array of combined values.
  3942. * @example
  3943. *
  3944. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  3945. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  3946. *
  3947. * _.unionWith(objects, others, _.isEqual);
  3948. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  3949. */var unionWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=='function'?comparator:undefined$1;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),undefined$1,comparator);});/**
  3950. * Creates a duplicate-free version of an array, using
  3951. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3952. * for equality comparisons, in which only the first occurrence of each element
  3953. * is kept. The order of result values is determined by the order they occur
  3954. * in the array.
  3955. *
  3956. * @static
  3957. * @memberOf _
  3958. * @since 0.1.0
  3959. * @category Array
  3960. * @param {Array} array The array to inspect.
  3961. * @returns {Array} Returns the new duplicate free array.
  3962. * @example
  3963. *
  3964. * _.uniq([2, 1, 2]);
  3965. * // => [2, 1]
  3966. */function uniq(array){return array&&array.length?baseUniq(array):[];}/**
  3967. * This method is like `_.uniq` except that it accepts `iteratee` which is
  3968. * invoked for each element in `array` to generate the criterion by which
  3969. * uniqueness is computed. The order of result values is determined by the
  3970. * order they occur in the array. The iteratee is invoked with one argument:
  3971. * (value).
  3972. *
  3973. * @static
  3974. * @memberOf _
  3975. * @since 4.0.0
  3976. * @category Array
  3977. * @param {Array} array The array to inspect.
  3978. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3979. * @returns {Array} Returns the new duplicate free array.
  3980. * @example
  3981. *
  3982. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  3983. * // => [2.1, 1.2]
  3984. *
  3985. * // The `_.property` iteratee shorthand.
  3986. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  3987. * // => [{ 'x': 1 }, { 'x': 2 }]
  3988. */function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee,2)):[];}/**
  3989. * This method is like `_.uniq` except that it accepts `comparator` which
  3990. * is invoked to compare elements of `array`. The order of result values is
  3991. * determined by the order they occur in the array.The comparator is invoked
  3992. * with two arguments: (arrVal, othVal).
  3993. *
  3994. * @static
  3995. * @memberOf _
  3996. * @since 4.0.0
  3997. * @category Array
  3998. * @param {Array} array The array to inspect.
  3999. * @param {Function} [comparator] The comparator invoked per element.
  4000. * @returns {Array} Returns the new duplicate free array.
  4001. * @example
  4002. *
  4003. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  4004. *
  4005. * _.uniqWith(objects, _.isEqual);
  4006. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  4007. */function uniqWith(array,comparator){comparator=typeof comparator=='function'?comparator:undefined$1;return array&&array.length?baseUniq(array,undefined$1,comparator):[];}/**
  4008. * This method is like `_.zip` except that it accepts an array of grouped
  4009. * elements and creates an array regrouping the elements to their pre-zip
  4010. * configuration.
  4011. *
  4012. * @static
  4013. * @memberOf _
  4014. * @since 1.2.0
  4015. * @category Array
  4016. * @param {Array} array The array of grouped elements to process.
  4017. * @returns {Array} Returns the new array of regrouped elements.
  4018. * @example
  4019. *
  4020. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  4021. * // => [['a', 1, true], ['b', 2, false]]
  4022. *
  4023. * _.unzip(zipped);
  4024. * // => [['a', 'b'], [1, 2], [true, false]]
  4025. */function unzip(array){if(!(array&&array.length)){return [];}var length=0;array=arrayFilter(array,function(group){if(isArrayLikeObject(group)){length=nativeMax(group.length,length);return true;}});return baseTimes(length,function(index){return arrayMap(array,baseProperty(index));});}/**
  4026. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  4027. * how regrouped values should be combined. The iteratee is invoked with the
  4028. * elements of each group: (...group).
  4029. *
  4030. * @static
  4031. * @memberOf _
  4032. * @since 3.8.0
  4033. * @category Array
  4034. * @param {Array} array The array of grouped elements to process.
  4035. * @param {Function} [iteratee=_.identity] The function to combine
  4036. * regrouped values.
  4037. * @returns {Array} Returns the new array of regrouped elements.
  4038. * @example
  4039. *
  4040. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  4041. * // => [[1, 10, 100], [2, 20, 200]]
  4042. *
  4043. * _.unzipWith(zipped, _.add);
  4044. * // => [3, 30, 300]
  4045. */function unzipWith(array,iteratee){if(!(array&&array.length)){return [];}var result=unzip(array);if(iteratee==null){return result;}return arrayMap(result,function(group){return apply(iteratee,undefined$1,group);});}/**
  4046. * Creates an array excluding all given values using
  4047. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4048. * for equality comparisons.
  4049. *
  4050. * **Note:** Unlike `_.pull`, this method returns a new array.
  4051. *
  4052. * @static
  4053. * @memberOf _
  4054. * @since 0.1.0
  4055. * @category Array
  4056. * @param {Array} array The array to inspect.
  4057. * @param {...*} [values] The values to exclude.
  4058. * @returns {Array} Returns the new array of filtered values.
  4059. * @see _.difference, _.xor
  4060. * @example
  4061. *
  4062. * _.without([2, 1, 2, 3], 1, 2);
  4063. * // => [3]
  4064. */var without=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[];});/**
  4065. * Creates an array of unique values that is the
  4066. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  4067. * of the given arrays. The order of result values is determined by the order
  4068. * they occur in the arrays.
  4069. *
  4070. * @static
  4071. * @memberOf _
  4072. * @since 2.4.0
  4073. * @category Array
  4074. * @param {...Array} [arrays] The arrays to inspect.
  4075. * @returns {Array} Returns the new array of filtered values.
  4076. * @see _.difference, _.without
  4077. * @example
  4078. *
  4079. * _.xor([2, 1], [2, 3]);
  4080. * // => [1, 3]
  4081. */var xor=baseRest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject));});/**
  4082. * This method is like `_.xor` except that it accepts `iteratee` which is
  4083. * invoked for each element of each `arrays` to generate the criterion by
  4084. * which by which they're compared. The order of result values is determined
  4085. * by the order they occur in the arrays. The iteratee is invoked with one
  4086. * argument: (value).
  4087. *
  4088. * @static
  4089. * @memberOf _
  4090. * @since 4.0.0
  4091. * @category Array
  4092. * @param {...Array} [arrays] The arrays to inspect.
  4093. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  4094. * @returns {Array} Returns the new array of filtered values.
  4095. * @example
  4096. *
  4097. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  4098. * // => [1.2, 3.4]
  4099. *
  4100. * // The `_.property` iteratee shorthand.
  4101. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  4102. * // => [{ 'x': 2 }]
  4103. */var xorBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined$1;}return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee,2));});/**
  4104. * This method is like `_.xor` except that it accepts `comparator` which is
  4105. * invoked to compare elements of `arrays`. The order of result values is
  4106. * determined by the order they occur in the arrays. The comparator is invoked
  4107. * with two arguments: (arrVal, othVal).
  4108. *
  4109. * @static
  4110. * @memberOf _
  4111. * @since 4.0.0
  4112. * @category Array
  4113. * @param {...Array} [arrays] The arrays to inspect.
  4114. * @param {Function} [comparator] The comparator invoked per element.
  4115. * @returns {Array} Returns the new array of filtered values.
  4116. * @example
  4117. *
  4118. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  4119. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  4120. *
  4121. * _.xorWith(objects, others, _.isEqual);
  4122. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  4123. */var xorWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=='function'?comparator:undefined$1;return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined$1,comparator);});/**
  4124. * Creates an array of grouped elements, the first of which contains the
  4125. * first elements of the given arrays, the second of which contains the
  4126. * second elements of the given arrays, and so on.
  4127. *
  4128. * @static
  4129. * @memberOf _
  4130. * @since 0.1.0
  4131. * @category Array
  4132. * @param {...Array} [arrays] The arrays to process.
  4133. * @returns {Array} Returns the new array of grouped elements.
  4134. * @example
  4135. *
  4136. * _.zip(['a', 'b'], [1, 2], [true, false]);
  4137. * // => [['a', 1, true], ['b', 2, false]]
  4138. */var zip=baseRest(unzip);/**
  4139. * This method is like `_.fromPairs` except that it accepts two arrays,
  4140. * one of property identifiers and one of corresponding values.
  4141. *
  4142. * @static
  4143. * @memberOf _
  4144. * @since 0.4.0
  4145. * @category Array
  4146. * @param {Array} [props=[]] The property identifiers.
  4147. * @param {Array} [values=[]] The property values.
  4148. * @returns {Object} Returns the new object.
  4149. * @example
  4150. *
  4151. * _.zipObject(['a', 'b'], [1, 2]);
  4152. * // => { 'a': 1, 'b': 2 }
  4153. */function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue);}/**
  4154. * This method is like `_.zipObject` except that it supports property paths.
  4155. *
  4156. * @static
  4157. * @memberOf _
  4158. * @since 4.1.0
  4159. * @category Array
  4160. * @param {Array} [props=[]] The property identifiers.
  4161. * @param {Array} [values=[]] The property values.
  4162. * @returns {Object} Returns the new object.
  4163. * @example
  4164. *
  4165. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  4166. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  4167. */function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet);}/**
  4168. * This method is like `_.zip` except that it accepts `iteratee` to specify
  4169. * how grouped values should be combined. The iteratee is invoked with the
  4170. * elements of each group: (...group).
  4171. *
  4172. * @static
  4173. * @memberOf _
  4174. * @since 3.8.0
  4175. * @category Array
  4176. * @param {...Array} [arrays] The arrays to process.
  4177. * @param {Function} [iteratee=_.identity] The function to combine
  4178. * grouped values.
  4179. * @returns {Array} Returns the new array of grouped elements.
  4180. * @example
  4181. *
  4182. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  4183. * return a + b + c;
  4184. * });
  4185. * // => [111, 222]
  4186. */var zipWith=baseRest(function(arrays){var length=arrays.length,iteratee=length>1?arrays[length-1]:undefined$1;iteratee=typeof iteratee=='function'?(arrays.pop(),iteratee):undefined$1;return unzipWith(arrays,iteratee);});/*------------------------------------------------------------------------*/ /**
  4187. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  4188. * chain sequences enabled. The result of such sequences must be unwrapped
  4189. * with `_#value`.
  4190. *
  4191. * @static
  4192. * @memberOf _
  4193. * @since 1.3.0
  4194. * @category Seq
  4195. * @param {*} value The value to wrap.
  4196. * @returns {Object} Returns the new `lodash` wrapper instance.
  4197. * @example
  4198. *
  4199. * var users = [
  4200. * { 'user': 'barney', 'age': 36 },
  4201. * { 'user': 'fred', 'age': 40 },
  4202. * { 'user': 'pebbles', 'age': 1 }
  4203. * ];
  4204. *
  4205. * var youngest = _
  4206. * .chain(users)
  4207. * .sortBy('age')
  4208. * .map(function(o) {
  4209. * return o.user + ' is ' + o.age;
  4210. * })
  4211. * .head()
  4212. * .value();
  4213. * // => 'pebbles is 1'
  4214. */function chain(value){var result=lodash(value);result.__chain__=true;return result;}/**
  4215. * This method invokes `interceptor` and returns `value`. The interceptor
  4216. * is invoked with one argument; (value). The purpose of this method is to
  4217. * "tap into" a method chain sequence in order to modify intermediate results.
  4218. *
  4219. * @static
  4220. * @memberOf _
  4221. * @since 0.1.0
  4222. * @category Seq
  4223. * @param {*} value The value to provide to `interceptor`.
  4224. * @param {Function} interceptor The function to invoke.
  4225. * @returns {*} Returns `value`.
  4226. * @example
  4227. *
  4228. * _([1, 2, 3])
  4229. * .tap(function(array) {
  4230. * // Mutate input array.
  4231. * array.pop();
  4232. * })
  4233. * .reverse()
  4234. * .value();
  4235. * // => [2, 1]
  4236. */function tap(value,interceptor){interceptor(value);return value;}/**
  4237. * This method is like `_.tap` except that it returns the result of `interceptor`.
  4238. * The purpose of this method is to "pass thru" values replacing intermediate
  4239. * results in a method chain sequence.
  4240. *
  4241. * @static
  4242. * @memberOf _
  4243. * @since 3.0.0
  4244. * @category Seq
  4245. * @param {*} value The value to provide to `interceptor`.
  4246. * @param {Function} interceptor The function to invoke.
  4247. * @returns {*} Returns the result of `interceptor`.
  4248. * @example
  4249. *
  4250. * _(' abc ')
  4251. * .chain()
  4252. * .trim()
  4253. * .thru(function(value) {
  4254. * return [value];
  4255. * })
  4256. * .value();
  4257. * // => ['abc']
  4258. */function thru(value,interceptor){return interceptor(value);}/**
  4259. * This method is the wrapper version of `_.at`.
  4260. *
  4261. * @name at
  4262. * @memberOf _
  4263. * @since 1.0.0
  4264. * @category Seq
  4265. * @param {...(string|string[])} [paths] The property paths to pick.
  4266. * @returns {Object} Returns the new `lodash` wrapper instance.
  4267. * @example
  4268. *
  4269. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  4270. *
  4271. * _(object).at(['a[0].b.c', 'a[1]']).value();
  4272. * // => [3, 4]
  4273. */var wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths);};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start)){return this.thru(interceptor);}value=value.slice(start,+start+(length?1:0));value.__actions__.push({'func':thru,'args':[interceptor],'thisArg':undefined$1});return new LodashWrapper(value,this.__chain__).thru(function(array){if(length&&!array.length){array.push(undefined$1);}return array;});});/**
  4274. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  4275. *
  4276. * @name chain
  4277. * @memberOf _
  4278. * @since 0.1.0
  4279. * @category Seq
  4280. * @returns {Object} Returns the new `lodash` wrapper instance.
  4281. * @example
  4282. *
  4283. * var users = [
  4284. * { 'user': 'barney', 'age': 36 },
  4285. * { 'user': 'fred', 'age': 40 }
  4286. * ];
  4287. *
  4288. * // A sequence without explicit chaining.
  4289. * _(users).head();
  4290. * // => { 'user': 'barney', 'age': 36 }
  4291. *
  4292. * // A sequence with explicit chaining.
  4293. * _(users)
  4294. * .chain()
  4295. * .head()
  4296. * .pick('user')
  4297. * .value();
  4298. * // => { 'user': 'barney' }
  4299. */function wrapperChain(){return chain(this);}/**
  4300. * Executes the chain sequence and returns the wrapped result.
  4301. *
  4302. * @name commit
  4303. * @memberOf _
  4304. * @since 3.2.0
  4305. * @category Seq
  4306. * @returns {Object} Returns the new `lodash` wrapper instance.
  4307. * @example
  4308. *
  4309. * var array = [1, 2];
  4310. * var wrapped = _(array).push(3);
  4311. *
  4312. * console.log(array);
  4313. * // => [1, 2]
  4314. *
  4315. * wrapped = wrapped.commit();
  4316. * console.log(array);
  4317. * // => [1, 2, 3]
  4318. *
  4319. * wrapped.last();
  4320. * // => 3
  4321. *
  4322. * console.log(array);
  4323. * // => [1, 2, 3]
  4324. */function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__);}/**
  4325. * Gets the next value on a wrapped object following the
  4326. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  4327. *
  4328. * @name next
  4329. * @memberOf _
  4330. * @since 4.0.0
  4331. * @category Seq
  4332. * @returns {Object} Returns the next iterator value.
  4333. * @example
  4334. *
  4335. * var wrapped = _([1, 2]);
  4336. *
  4337. * wrapped.next();
  4338. * // => { 'done': false, 'value': 1 }
  4339. *
  4340. * wrapped.next();
  4341. * // => { 'done': false, 'value': 2 }
  4342. *
  4343. * wrapped.next();
  4344. * // => { 'done': true, 'value': undefined }
  4345. */function wrapperNext(){if(this.__values__===undefined$1){this.__values__=toArray(this.value());}var done=this.__index__>=this.__values__.length,value=done?undefined$1:this.__values__[this.__index__++];return {'done':done,'value':value};}/**
  4346. * Enables the wrapper to be iterable.
  4347. *
  4348. * @name Symbol.iterator
  4349. * @memberOf _
  4350. * @since 4.0.0
  4351. * @category Seq
  4352. * @returns {Object} Returns the wrapper object.
  4353. * @example
  4354. *
  4355. * var wrapped = _([1, 2]);
  4356. *
  4357. * wrapped[Symbol.iterator]() === wrapped;
  4358. * // => true
  4359. *
  4360. * Array.from(wrapped);
  4361. * // => [1, 2]
  4362. */function wrapperToIterator(){return this;}/**
  4363. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  4364. *
  4365. * @name plant
  4366. * @memberOf _
  4367. * @since 3.2.0
  4368. * @category Seq
  4369. * @param {*} value The value to plant.
  4370. * @returns {Object} Returns the new `lodash` wrapper instance.
  4371. * @example
  4372. *
  4373. * function square(n) {
  4374. * return n * n;
  4375. * }
  4376. *
  4377. * var wrapped = _([1, 2]).map(square);
  4378. * var other = wrapped.plant([3, 4]);
  4379. *
  4380. * other.value();
  4381. * // => [9, 16]
  4382. *
  4383. * wrapped.value();
  4384. * // => [1, 4]
  4385. */function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined$1;if(result){previous.__wrapped__=clone;}else {result=clone;}var previous=clone;parent=parent.__wrapped__;}previous.__wrapped__=value;return result;}/**
  4386. * This method is the wrapper version of `_.reverse`.
  4387. *
  4388. * **Note:** This method mutates the wrapped array.
  4389. *
  4390. * @name reverse
  4391. * @memberOf _
  4392. * @since 0.1.0
  4393. * @category Seq
  4394. * @returns {Object} Returns the new `lodash` wrapper instance.
  4395. * @example
  4396. *
  4397. * var array = [1, 2, 3];
  4398. *
  4399. * _(array).reverse().value()
  4400. * // => [3, 2, 1]
  4401. *
  4402. * console.log(array);
  4403. * // => [3, 2, 1]
  4404. */function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length){wrapped=new LazyWrapper(this);}wrapped=wrapped.reverse();wrapped.__actions__.push({'func':thru,'args':[reverse],'thisArg':undefined$1});return new LodashWrapper(wrapped,this.__chain__);}return this.thru(reverse);}/**
  4405. * Executes the chain sequence to resolve the unwrapped value.
  4406. *
  4407. * @name value
  4408. * @memberOf _
  4409. * @since 0.1.0
  4410. * @alias toJSON, valueOf
  4411. * @category Seq
  4412. * @returns {*} Returns the resolved unwrapped value.
  4413. * @example
  4414. *
  4415. * _([1, 2, 3]).value();
  4416. * // => [1, 2, 3]
  4417. */function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__);}/*------------------------------------------------------------------------*/ /**
  4418. * Creates an object composed of keys generated from the results of running
  4419. * each element of `collection` thru `iteratee`. The corresponding value of
  4420. * each key is the number of times the key was returned by `iteratee`. The
  4421. * iteratee is invoked with one argument: (value).
  4422. *
  4423. * @static
  4424. * @memberOf _
  4425. * @since 0.5.0
  4426. * @category Collection
  4427. * @param {Array|Object} collection The collection to iterate over.
  4428. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4429. * @returns {Object} Returns the composed aggregate object.
  4430. * @example
  4431. *
  4432. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  4433. * // => { '4': 1, '6': 2 }
  4434. *
  4435. * // The `_.property` iteratee shorthand.
  4436. * _.countBy(['one', 'two', 'three'], 'length');
  4437. * // => { '3': 2, '5': 1 }
  4438. */var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){++result[key];}else {baseAssignValue(result,key,1);}});/**
  4439. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  4440. * Iteration is stopped once `predicate` returns falsey. The predicate is
  4441. * invoked with three arguments: (value, index|key, collection).
  4442. *
  4443. * **Note:** This method returns `true` for
  4444. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  4445. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  4446. * elements of empty collections.
  4447. *
  4448. * @static
  4449. * @memberOf _
  4450. * @since 0.1.0
  4451. * @category Collection
  4452. * @param {Array|Object} collection The collection to iterate over.
  4453. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4454. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  4455. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  4456. * else `false`.
  4457. * @example
  4458. *
  4459. * _.every([true, 1, null, 'yes'], Boolean);
  4460. * // => false
  4461. *
  4462. * var users = [
  4463. * { 'user': 'barney', 'age': 36, 'active': false },
  4464. * { 'user': 'fred', 'age': 40, 'active': false }
  4465. * ];
  4466. *
  4467. * // The `_.matches` iteratee shorthand.
  4468. * _.every(users, { 'user': 'barney', 'active': false });
  4469. * // => false
  4470. *
  4471. * // The `_.matchesProperty` iteratee shorthand.
  4472. * _.every(users, ['active', false]);
  4473. * // => true
  4474. *
  4475. * // The `_.property` iteratee shorthand.
  4476. * _.every(users, 'active');
  4477. * // => false
  4478. */function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined$1;}return func(collection,getIteratee(predicate,3));}/**
  4479. * Iterates over elements of `collection`, returning an array of all elements
  4480. * `predicate` returns truthy for. The predicate is invoked with three
  4481. * arguments: (value, index|key, collection).
  4482. *
  4483. * **Note:** Unlike `_.remove`, this method returns a new array.
  4484. *
  4485. * @static
  4486. * @memberOf _
  4487. * @since 0.1.0
  4488. * @category Collection
  4489. * @param {Array|Object} collection The collection to iterate over.
  4490. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4491. * @returns {Array} Returns the new filtered array.
  4492. * @see _.reject
  4493. * @example
  4494. *
  4495. * var users = [
  4496. * { 'user': 'barney', 'age': 36, 'active': true },
  4497. * { 'user': 'fred', 'age': 40, 'active': false }
  4498. * ];
  4499. *
  4500. * _.filter(users, function(o) { return !o.active; });
  4501. * // => objects for ['fred']
  4502. *
  4503. * // The `_.matches` iteratee shorthand.
  4504. * _.filter(users, { 'age': 36, 'active': true });
  4505. * // => objects for ['barney']
  4506. *
  4507. * // The `_.matchesProperty` iteratee shorthand.
  4508. * _.filter(users, ['active', false]);
  4509. * // => objects for ['fred']
  4510. *
  4511. * // The `_.property` iteratee shorthand.
  4512. * _.filter(users, 'active');
  4513. * // => objects for ['barney']
  4514. *
  4515. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  4516. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  4517. * // => objects for ['fred', 'barney']
  4518. */function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3));}/**
  4519. * Iterates over elements of `collection`, returning the first element
  4520. * `predicate` returns truthy for. The predicate is invoked with three
  4521. * arguments: (value, index|key, collection).
  4522. *
  4523. * @static
  4524. * @memberOf _
  4525. * @since 0.1.0
  4526. * @category Collection
  4527. * @param {Array|Object} collection The collection to inspect.
  4528. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4529. * @param {number} [fromIndex=0] The index to search from.
  4530. * @returns {*} Returns the matched element, else `undefined`.
  4531. * @example
  4532. *
  4533. * var users = [
  4534. * { 'user': 'barney', 'age': 36, 'active': true },
  4535. * { 'user': 'fred', 'age': 40, 'active': false },
  4536. * { 'user': 'pebbles', 'age': 1, 'active': true }
  4537. * ];
  4538. *
  4539. * _.find(users, function(o) { return o.age < 40; });
  4540. * // => object for 'barney'
  4541. *
  4542. * // The `_.matches` iteratee shorthand.
  4543. * _.find(users, { 'age': 1, 'active': true });
  4544. * // => object for 'pebbles'
  4545. *
  4546. * // The `_.matchesProperty` iteratee shorthand.
  4547. * _.find(users, ['active', false]);
  4548. * // => object for 'fred'
  4549. *
  4550. * // The `_.property` iteratee shorthand.
  4551. * _.find(users, 'active');
  4552. * // => object for 'barney'
  4553. */var find=createFind(findIndex);/**
  4554. * This method is like `_.find` except that it iterates over elements of
  4555. * `collection` from right to left.
  4556. *
  4557. * @static
  4558. * @memberOf _
  4559. * @since 2.0.0
  4560. * @category Collection
  4561. * @param {Array|Object} collection The collection to inspect.
  4562. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4563. * @param {number} [fromIndex=collection.length-1] The index to search from.
  4564. * @returns {*} Returns the matched element, else `undefined`.
  4565. * @example
  4566. *
  4567. * _.findLast([1, 2, 3, 4], function(n) {
  4568. * return n % 2 == 1;
  4569. * });
  4570. * // => 3
  4571. */var findLast=createFind(findLastIndex);/**
  4572. * Creates a flattened array of values by running each element in `collection`
  4573. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  4574. * with three arguments: (value, index|key, collection).
  4575. *
  4576. * @static
  4577. * @memberOf _
  4578. * @since 4.0.0
  4579. * @category Collection
  4580. * @param {Array|Object} collection The collection to iterate over.
  4581. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4582. * @returns {Array} Returns the new flattened array.
  4583. * @example
  4584. *
  4585. * function duplicate(n) {
  4586. * return [n, n];
  4587. * }
  4588. *
  4589. * _.flatMap([1, 2], duplicate);
  4590. * // => [1, 1, 2, 2]
  4591. */function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1);}/**
  4592. * This method is like `_.flatMap` except that it recursively flattens the
  4593. * mapped results.
  4594. *
  4595. * @static
  4596. * @memberOf _
  4597. * @since 4.7.0
  4598. * @category Collection
  4599. * @param {Array|Object} collection The collection to iterate over.
  4600. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4601. * @returns {Array} Returns the new flattened array.
  4602. * @example
  4603. *
  4604. * function duplicate(n) {
  4605. * return [[[n, n]]];
  4606. * }
  4607. *
  4608. * _.flatMapDeep([1, 2], duplicate);
  4609. * // => [1, 1, 2, 2]
  4610. */function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY);}/**
  4611. * This method is like `_.flatMap` except that it recursively flattens the
  4612. * mapped results up to `depth` times.
  4613. *
  4614. * @static
  4615. * @memberOf _
  4616. * @since 4.7.0
  4617. * @category Collection
  4618. * @param {Array|Object} collection The collection to iterate over.
  4619. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4620. * @param {number} [depth=1] The maximum recursion depth.
  4621. * @returns {Array} Returns the new flattened array.
  4622. * @example
  4623. *
  4624. * function duplicate(n) {
  4625. * return [[[n, n]]];
  4626. * }
  4627. *
  4628. * _.flatMapDepth([1, 2], duplicate, 2);
  4629. * // => [[1, 1], [2, 2]]
  4630. */function flatMapDepth(collection,iteratee,depth){depth=depth===undefined$1?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth);}/**
  4631. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  4632. * The iteratee is invoked with three arguments: (value, index|key, collection).
  4633. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4634. *
  4635. * **Note:** As with other "Collections" methods, objects with a "length"
  4636. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  4637. * or `_.forOwn` for object iteration.
  4638. *
  4639. * @static
  4640. * @memberOf _
  4641. * @since 0.1.0
  4642. * @alias each
  4643. * @category Collection
  4644. * @param {Array|Object} collection The collection to iterate over.
  4645. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4646. * @returns {Array|Object} Returns `collection`.
  4647. * @see _.forEachRight
  4648. * @example
  4649. *
  4650. * _.forEach([1, 2], function(value) {
  4651. * console.log(value);
  4652. * });
  4653. * // => Logs `1` then `2`.
  4654. *
  4655. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  4656. * console.log(key);
  4657. * });
  4658. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  4659. */function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,3));}/**
  4660. * This method is like `_.forEach` except that it iterates over elements of
  4661. * `collection` from right to left.
  4662. *
  4663. * @static
  4664. * @memberOf _
  4665. * @since 2.0.0
  4666. * @alias eachRight
  4667. * @category Collection
  4668. * @param {Array|Object} collection The collection to iterate over.
  4669. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4670. * @returns {Array|Object} Returns `collection`.
  4671. * @see _.forEach
  4672. * @example
  4673. *
  4674. * _.forEachRight([1, 2], function(value) {
  4675. * console.log(value);
  4676. * });
  4677. * // => Logs `2` then `1`.
  4678. */function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3));}/**
  4679. * Creates an object composed of keys generated from the results of running
  4680. * each element of `collection` thru `iteratee`. The order of grouped values
  4681. * is determined by the order they occur in `collection`. The corresponding
  4682. * value of each key is an array of elements responsible for generating the
  4683. * key. The iteratee is invoked with one argument: (value).
  4684. *
  4685. * @static
  4686. * @memberOf _
  4687. * @since 0.1.0
  4688. * @category Collection
  4689. * @param {Array|Object} collection The collection to iterate over.
  4690. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4691. * @returns {Object} Returns the composed aggregate object.
  4692. * @example
  4693. *
  4694. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  4695. * // => { '4': [4.2], '6': [6.1, 6.3] }
  4696. *
  4697. * // The `_.property` iteratee shorthand.
  4698. * _.groupBy(['one', 'two', 'three'], 'length');
  4699. * // => { '3': ['one', 'two'], '5': ['three'] }
  4700. */var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value);}else {baseAssignValue(result,key,[value]);}});/**
  4701. * Checks if `value` is in `collection`. If `collection` is a string, it's
  4702. * checked for a substring of `value`, otherwise
  4703. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4704. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  4705. * the offset from the end of `collection`.
  4706. *
  4707. * @static
  4708. * @memberOf _
  4709. * @since 0.1.0
  4710. * @category Collection
  4711. * @param {Array|Object|string} collection The collection to inspect.
  4712. * @param {*} value The value to search for.
  4713. * @param {number} [fromIndex=0] The index to search from.
  4714. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  4715. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  4716. * @example
  4717. *
  4718. * _.includes([1, 2, 3], 1);
  4719. * // => true
  4720. *
  4721. * _.includes([1, 2, 3], 1, 2);
  4722. * // => false
  4723. *
  4724. * _.includes({ 'a': 1, 'b': 2 }, 1);
  4725. * // => true
  4726. *
  4727. * _.includes('abcd', 'bc');
  4728. * // => true
  4729. */function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;if(fromIndex<0){fromIndex=nativeMax(length+fromIndex,0);}return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1;}/**
  4730. * Invokes the method at `path` of each element in `collection`, returning
  4731. * an array of the results of each invoked method. Any additional arguments
  4732. * are provided to each invoked method. If `path` is a function, it's invoked
  4733. * for, and `this` bound to, each element in `collection`.
  4734. *
  4735. * @static
  4736. * @memberOf _
  4737. * @since 4.0.0
  4738. * @category Collection
  4739. * @param {Array|Object} collection The collection to iterate over.
  4740. * @param {Array|Function|string} path The path of the method to invoke or
  4741. * the function invoked per iteration.
  4742. * @param {...*} [args] The arguments to invoke each method with.
  4743. * @returns {Array} Returns the array of results.
  4744. * @example
  4745. *
  4746. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  4747. * // => [[1, 5, 7], [1, 2, 3]]
  4748. *
  4749. * _.invokeMap([123, 456], String.prototype.split, '');
  4750. * // => [['1', '2', '3'], ['4', '5', '6']]
  4751. */var invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc=typeof path=='function',result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args);});return result;});/**
  4752. * Creates an object composed of keys generated from the results of running
  4753. * each element of `collection` thru `iteratee`. The corresponding value of
  4754. * each key is the last element responsible for generating the key. The
  4755. * iteratee is invoked with one argument: (value).
  4756. *
  4757. * @static
  4758. * @memberOf _
  4759. * @since 4.0.0
  4760. * @category Collection
  4761. * @param {Array|Object} collection The collection to iterate over.
  4762. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4763. * @returns {Object} Returns the composed aggregate object.
  4764. * @example
  4765. *
  4766. * var array = [
  4767. * { 'dir': 'left', 'code': 97 },
  4768. * { 'dir': 'right', 'code': 100 }
  4769. * ];
  4770. *
  4771. * _.keyBy(array, function(o) {
  4772. * return String.fromCharCode(o.code);
  4773. * });
  4774. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  4775. *
  4776. * _.keyBy(array, 'dir');
  4777. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  4778. */var keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value);});/**
  4779. * Creates an array of values by running each element in `collection` thru
  4780. * `iteratee`. The iteratee is invoked with three arguments:
  4781. * (value, index|key, collection).
  4782. *
  4783. * Many lodash methods are guarded to work as iteratees for methods like
  4784. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  4785. *
  4786. * The guarded methods are:
  4787. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  4788. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  4789. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  4790. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  4791. *
  4792. * @static
  4793. * @memberOf _
  4794. * @since 0.1.0
  4795. * @category Collection
  4796. * @param {Array|Object} collection The collection to iterate over.
  4797. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4798. * @returns {Array} Returns the new mapped array.
  4799. * @example
  4800. *
  4801. * function square(n) {
  4802. * return n * n;
  4803. * }
  4804. *
  4805. * _.map([4, 8], square);
  4806. * // => [16, 64]
  4807. *
  4808. * _.map({ 'a': 4, 'b': 8 }, square);
  4809. * // => [16, 64] (iteration order is not guaranteed)
  4810. *
  4811. * var users = [
  4812. * { 'user': 'barney' },
  4813. * { 'user': 'fred' }
  4814. * ];
  4815. *
  4816. * // The `_.property` iteratee shorthand.
  4817. * _.map(users, 'user');
  4818. * // => ['barney', 'fred']
  4819. */function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3));}/**
  4820. * This method is like `_.sortBy` except that it allows specifying the sort
  4821. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  4822. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  4823. * descending or "asc" for ascending sort order of corresponding values.
  4824. *
  4825. * @static
  4826. * @memberOf _
  4827. * @since 4.0.0
  4828. * @category Collection
  4829. * @param {Array|Object} collection The collection to iterate over.
  4830. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  4831. * The iteratees to sort by.
  4832. * @param {string[]} [orders] The sort orders of `iteratees`.
  4833. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  4834. * @returns {Array} Returns the new sorted array.
  4835. * @example
  4836. *
  4837. * var users = [
  4838. * { 'user': 'fred', 'age': 48 },
  4839. * { 'user': 'barney', 'age': 34 },
  4840. * { 'user': 'fred', 'age': 40 },
  4841. * { 'user': 'barney', 'age': 36 }
  4842. * ];
  4843. *
  4844. * // Sort by `user` in ascending order and by `age` in descending order.
  4845. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  4846. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  4847. */function orderBy(collection,iteratees,orders,guard){if(collection==null){return [];}if(!isArray(iteratees)){iteratees=iteratees==null?[]:[iteratees];}orders=guard?undefined$1:orders;if(!isArray(orders)){orders=orders==null?[]:[orders];}return baseOrderBy(collection,iteratees,orders);}/**
  4848. * Creates an array of elements split into two groups, the first of which
  4849. * contains elements `predicate` returns truthy for, the second of which
  4850. * contains elements `predicate` returns falsey for. The predicate is
  4851. * invoked with one argument: (value).
  4852. *
  4853. * @static
  4854. * @memberOf _
  4855. * @since 3.0.0
  4856. * @category Collection
  4857. * @param {Array|Object} collection The collection to iterate over.
  4858. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4859. * @returns {Array} Returns the array of grouped elements.
  4860. * @example
  4861. *
  4862. * var users = [
  4863. * { 'user': 'barney', 'age': 36, 'active': false },
  4864. * { 'user': 'fred', 'age': 40, 'active': true },
  4865. * { 'user': 'pebbles', 'age': 1, 'active': false }
  4866. * ];
  4867. *
  4868. * _.partition(users, function(o) { return o.active; });
  4869. * // => objects for [['fred'], ['barney', 'pebbles']]
  4870. *
  4871. * // The `_.matches` iteratee shorthand.
  4872. * _.partition(users, { 'age': 1, 'active': false });
  4873. * // => objects for [['pebbles'], ['barney', 'fred']]
  4874. *
  4875. * // The `_.matchesProperty` iteratee shorthand.
  4876. * _.partition(users, ['active', false]);
  4877. * // => objects for [['barney', 'pebbles'], ['fred']]
  4878. *
  4879. * // The `_.property` iteratee shorthand.
  4880. * _.partition(users, 'active');
  4881. * // => objects for [['fred'], ['barney', 'pebbles']]
  4882. */var partition=createAggregator(function(result,value,key){result[key?0:1].push(value);},function(){return [[],[]];});/**
  4883. * Reduces `collection` to a value which is the accumulated result of running
  4884. * each element in `collection` thru `iteratee`, where each successive
  4885. * invocation is supplied the return value of the previous. If `accumulator`
  4886. * is not given, the first element of `collection` is used as the initial
  4887. * value. The iteratee is invoked with four arguments:
  4888. * (accumulator, value, index|key, collection).
  4889. *
  4890. * Many lodash methods are guarded to work as iteratees for methods like
  4891. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  4892. *
  4893. * The guarded methods are:
  4894. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  4895. * and `sortBy`
  4896. *
  4897. * @static
  4898. * @memberOf _
  4899. * @since 0.1.0
  4900. * @category Collection
  4901. * @param {Array|Object} collection The collection to iterate over.
  4902. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4903. * @param {*} [accumulator] The initial value.
  4904. * @returns {*} Returns the accumulated value.
  4905. * @see _.reduceRight
  4906. * @example
  4907. *
  4908. * _.reduce([1, 2], function(sum, n) {
  4909. * return sum + n;
  4910. * }, 0);
  4911. * // => 3
  4912. *
  4913. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  4914. * (result[value] || (result[value] = [])).push(key);
  4915. * return result;
  4916. * }, {});
  4917. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  4918. */function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach);}/**
  4919. * This method is like `_.reduce` except that it iterates over elements of
  4920. * `collection` from right to left.
  4921. *
  4922. * @static
  4923. * @memberOf _
  4924. * @since 0.1.0
  4925. * @category Collection
  4926. * @param {Array|Object} collection The collection to iterate over.
  4927. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4928. * @param {*} [accumulator] The initial value.
  4929. * @returns {*} Returns the accumulated value.
  4930. * @see _.reduce
  4931. * @example
  4932. *
  4933. * var array = [[0, 1], [2, 3], [4, 5]];
  4934. *
  4935. * _.reduceRight(array, function(flattened, other) {
  4936. * return flattened.concat(other);
  4937. * }, []);
  4938. * // => [4, 5, 2, 3, 0, 1]
  4939. */function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight);}/**
  4940. * The opposite of `_.filter`; this method returns the elements of `collection`
  4941. * that `predicate` does **not** return truthy for.
  4942. *
  4943. * @static
  4944. * @memberOf _
  4945. * @since 0.1.0
  4946. * @category Collection
  4947. * @param {Array|Object} collection The collection to iterate over.
  4948. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4949. * @returns {Array} Returns the new filtered array.
  4950. * @see _.filter
  4951. * @example
  4952. *
  4953. * var users = [
  4954. * { 'user': 'barney', 'age': 36, 'active': false },
  4955. * { 'user': 'fred', 'age': 40, 'active': true }
  4956. * ];
  4957. *
  4958. * _.reject(users, function(o) { return !o.active; });
  4959. * // => objects for ['fred']
  4960. *
  4961. * // The `_.matches` iteratee shorthand.
  4962. * _.reject(users, { 'age': 40, 'active': true });
  4963. * // => objects for ['barney']
  4964. *
  4965. * // The `_.matchesProperty` iteratee shorthand.
  4966. * _.reject(users, ['active', false]);
  4967. * // => objects for ['fred']
  4968. *
  4969. * // The `_.property` iteratee shorthand.
  4970. * _.reject(users, 'active');
  4971. * // => objects for ['barney']
  4972. */function reject(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)));}/**
  4973. * Gets a random element from `collection`.
  4974. *
  4975. * @static
  4976. * @memberOf _
  4977. * @since 2.0.0
  4978. * @category Collection
  4979. * @param {Array|Object} collection The collection to sample.
  4980. * @returns {*} Returns the random element.
  4981. * @example
  4982. *
  4983. * _.sample([1, 2, 3, 4]);
  4984. * // => 2
  4985. */function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection);}/**
  4986. * Gets `n` random elements at unique keys from `collection` up to the
  4987. * size of `collection`.
  4988. *
  4989. * @static
  4990. * @memberOf _
  4991. * @since 4.0.0
  4992. * @category Collection
  4993. * @param {Array|Object} collection The collection to sample.
  4994. * @param {number} [n=1] The number of elements to sample.
  4995. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  4996. * @returns {Array} Returns the random elements.
  4997. * @example
  4998. *
  4999. * _.sampleSize([1, 2, 3], 2);
  5000. * // => [3, 1]
  5001. *
  5002. * _.sampleSize([1, 2, 3], 4);
  5003. * // => [2, 3, 1]
  5004. */function sampleSize(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n===undefined$1){n=1;}else {n=toInteger(n);}var func=isArray(collection)?arraySampleSize:baseSampleSize;return func(collection,n);}/**
  5005. * Creates an array of shuffled values, using a version of the
  5006. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  5007. *
  5008. * @static
  5009. * @memberOf _
  5010. * @since 0.1.0
  5011. * @category Collection
  5012. * @param {Array|Object} collection The collection to shuffle.
  5013. * @returns {Array} Returns the new shuffled array.
  5014. * @example
  5015. *
  5016. * _.shuffle([1, 2, 3, 4]);
  5017. * // => [4, 1, 3, 2]
  5018. */function shuffle(collection){var func=isArray(collection)?arrayShuffle:baseShuffle;return func(collection);}/**
  5019. * Gets the size of `collection` by returning its length for array-like
  5020. * values or the number of own enumerable string keyed properties for objects.
  5021. *
  5022. * @static
  5023. * @memberOf _
  5024. * @since 0.1.0
  5025. * @category Collection
  5026. * @param {Array|Object|string} collection The collection to inspect.
  5027. * @returns {number} Returns the collection size.
  5028. * @example
  5029. *
  5030. * _.size([1, 2, 3]);
  5031. * // => 3
  5032. *
  5033. * _.size({ 'a': 1, 'b': 2 });
  5034. * // => 2
  5035. *
  5036. * _.size('pebbles');
  5037. * // => 7
  5038. */function size(collection){if(collection==null){return 0;}if(isArrayLike(collection)){return isString(collection)?stringSize(collection):collection.length;}var tag=getTag(collection);if(tag==mapTag||tag==setTag){return collection.size;}return baseKeys(collection).length;}/**
  5039. * Checks if `predicate` returns truthy for **any** element of `collection`.
  5040. * Iteration is stopped once `predicate` returns truthy. The predicate is
  5041. * invoked with three arguments: (value, index|key, collection).
  5042. *
  5043. * @static
  5044. * @memberOf _
  5045. * @since 0.1.0
  5046. * @category Collection
  5047. * @param {Array|Object} collection The collection to iterate over.
  5048. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  5049. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5050. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5051. * else `false`.
  5052. * @example
  5053. *
  5054. * _.some([null, 0, 'yes', false], Boolean);
  5055. * // => true
  5056. *
  5057. * var users = [
  5058. * { 'user': 'barney', 'active': true },
  5059. * { 'user': 'fred', 'active': false }
  5060. * ];
  5061. *
  5062. * // The `_.matches` iteratee shorthand.
  5063. * _.some(users, { 'user': 'barney', 'active': false });
  5064. * // => false
  5065. *
  5066. * // The `_.matchesProperty` iteratee shorthand.
  5067. * _.some(users, ['active', false]);
  5068. * // => true
  5069. *
  5070. * // The `_.property` iteratee shorthand.
  5071. * _.some(users, 'active');
  5072. * // => true
  5073. */function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined$1;}return func(collection,getIteratee(predicate,3));}/**
  5074. * Creates an array of elements, sorted in ascending order by the results of
  5075. * running each element in a collection thru each iteratee. This method
  5076. * performs a stable sort, that is, it preserves the original sort order of
  5077. * equal elements. The iteratees are invoked with one argument: (value).
  5078. *
  5079. * @static
  5080. * @memberOf _
  5081. * @since 0.1.0
  5082. * @category Collection
  5083. * @param {Array|Object} collection The collection to iterate over.
  5084. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  5085. * The iteratees to sort by.
  5086. * @returns {Array} Returns the new sorted array.
  5087. * @example
  5088. *
  5089. * var users = [
  5090. * { 'user': 'fred', 'age': 48 },
  5091. * { 'user': 'barney', 'age': 36 },
  5092. * { 'user': 'fred', 'age': 30 },
  5093. * { 'user': 'barney', 'age': 34 }
  5094. * ];
  5095. *
  5096. * _.sortBy(users, [function(o) { return o.user; }]);
  5097. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  5098. *
  5099. * _.sortBy(users, ['user', 'age']);
  5100. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  5101. */var sortBy=baseRest(function(collection,iteratees){if(collection==null){return [];}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[];}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]];}return baseOrderBy(collection,baseFlatten(iteratees,1),[]);});/*------------------------------------------------------------------------*/ /**
  5102. * Gets the timestamp of the number of milliseconds that have elapsed since
  5103. * the Unix epoch (1 January 1970 00:00:00 UTC).
  5104. *
  5105. * @static
  5106. * @memberOf _
  5107. * @since 2.4.0
  5108. * @category Date
  5109. * @returns {number} Returns the timestamp.
  5110. * @example
  5111. *
  5112. * _.defer(function(stamp) {
  5113. * console.log(_.now() - stamp);
  5114. * }, _.now());
  5115. * // => Logs the number of milliseconds it took for the deferred invocation.
  5116. */var now=ctxNow||function(){return root.Date.now();};/*------------------------------------------------------------------------*/ /**
  5117. * The opposite of `_.before`; this method creates a function that invokes
  5118. * `func` once it's called `n` or more times.
  5119. *
  5120. * @static
  5121. * @memberOf _
  5122. * @since 0.1.0
  5123. * @category Function
  5124. * @param {number} n The number of calls before `func` is invoked.
  5125. * @param {Function} func The function to restrict.
  5126. * @returns {Function} Returns the new restricted function.
  5127. * @example
  5128. *
  5129. * var saves = ['profile', 'settings'];
  5130. *
  5131. * var done = _.after(saves.length, function() {
  5132. * console.log('done saving!');
  5133. * });
  5134. *
  5135. * _.forEach(saves, function(type) {
  5136. * asyncSave({ 'type': type, 'complete': done });
  5137. * });
  5138. * // => Logs 'done saving!' after the two async saves have completed.
  5139. */function after(n,func){if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}n=toInteger(n);return function(){if(--n<1){return func.apply(this,arguments);}};}/**
  5140. * Creates a function that invokes `func`, with up to `n` arguments,
  5141. * ignoring any additional arguments.
  5142. *
  5143. * @static
  5144. * @memberOf _
  5145. * @since 3.0.0
  5146. * @category Function
  5147. * @param {Function} func The function to cap arguments for.
  5148. * @param {number} [n=func.length] The arity cap.
  5149. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5150. * @returns {Function} Returns the new capped function.
  5151. * @example
  5152. *
  5153. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  5154. * // => [6, 8, 10]
  5155. */function ary(func,n,guard){n=guard?undefined$1:n;n=func&&n==null?func.length:n;return createWrap(func,WRAP_ARY_FLAG,undefined$1,undefined$1,undefined$1,undefined$1,n);}/**
  5156. * Creates a function that invokes `func`, with the `this` binding and arguments
  5157. * of the created function, while it's called less than `n` times. Subsequent
  5158. * calls to the created function return the result of the last `func` invocation.
  5159. *
  5160. * @static
  5161. * @memberOf _
  5162. * @since 3.0.0
  5163. * @category Function
  5164. * @param {number} n The number of calls at which `func` is no longer invoked.
  5165. * @param {Function} func The function to restrict.
  5166. * @returns {Function} Returns the new restricted function.
  5167. * @example
  5168. *
  5169. * jQuery(element).on('click', _.before(5, addContactToList));
  5170. * // => Allows adding up to 4 contacts to the list.
  5171. */function before(n,func){var result;if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}n=toInteger(n);return function(){if(--n>0){result=func.apply(this,arguments);}if(n<=1){func=undefined$1;}return result;};}/**
  5172. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  5173. * and `partials` prepended to the arguments it receives.
  5174. *
  5175. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  5176. * may be used as a placeholder for partially applied arguments.
  5177. *
  5178. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  5179. * property of bound functions.
  5180. *
  5181. * @static
  5182. * @memberOf _
  5183. * @since 0.1.0
  5184. * @category Function
  5185. * @param {Function} func The function to bind.
  5186. * @param {*} thisArg The `this` binding of `func`.
  5187. * @param {...*} [partials] The arguments to be partially applied.
  5188. * @returns {Function} Returns the new bound function.
  5189. * @example
  5190. *
  5191. * function greet(greeting, punctuation) {
  5192. * return greeting + ' ' + this.user + punctuation;
  5193. * }
  5194. *
  5195. * var object = { 'user': 'fred' };
  5196. *
  5197. * var bound = _.bind(greet, object, 'hi');
  5198. * bound('!');
  5199. * // => 'hi fred!'
  5200. *
  5201. * // Bound with placeholders.
  5202. * var bound = _.bind(greet, object, _, '!');
  5203. * bound('hi');
  5204. * // => 'hi fred!'
  5205. */var bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG;}return createWrap(func,bitmask,thisArg,partials,holders);});/**
  5206. * Creates a function that invokes the method at `object[key]` with `partials`
  5207. * prepended to the arguments it receives.
  5208. *
  5209. * This method differs from `_.bind` by allowing bound functions to reference
  5210. * methods that may be redefined or don't yet exist. See
  5211. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  5212. * for more details.
  5213. *
  5214. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  5215. * builds, may be used as a placeholder for partially applied arguments.
  5216. *
  5217. * @static
  5218. * @memberOf _
  5219. * @since 0.10.0
  5220. * @category Function
  5221. * @param {Object} object The object to invoke the method on.
  5222. * @param {string} key The key of the method.
  5223. * @param {...*} [partials] The arguments to be partially applied.
  5224. * @returns {Function} Returns the new bound function.
  5225. * @example
  5226. *
  5227. * var object = {
  5228. * 'user': 'fred',
  5229. * 'greet': function(greeting, punctuation) {
  5230. * return greeting + ' ' + this.user + punctuation;
  5231. * }
  5232. * };
  5233. *
  5234. * var bound = _.bindKey(object, 'greet', 'hi');
  5235. * bound('!');
  5236. * // => 'hi fred!'
  5237. *
  5238. * object.greet = function(greeting, punctuation) {
  5239. * return greeting + 'ya ' + this.user + punctuation;
  5240. * };
  5241. *
  5242. * bound('!');
  5243. * // => 'hiya fred!'
  5244. *
  5245. * // Bound with placeholders.
  5246. * var bound = _.bindKey(object, 'greet', _, '!');
  5247. * bound('hi');
  5248. * // => 'hiya fred!'
  5249. */var bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG;}return createWrap(key,bitmask,object,partials,holders);});/**
  5250. * Creates a function that accepts arguments of `func` and either invokes
  5251. * `func` returning its result, if at least `arity` number of arguments have
  5252. * been provided, or returns a function that accepts the remaining `func`
  5253. * arguments, and so on. The arity of `func` may be specified if `func.length`
  5254. * is not sufficient.
  5255. *
  5256. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  5257. * may be used as a placeholder for provided arguments.
  5258. *
  5259. * **Note:** This method doesn't set the "length" property of curried functions.
  5260. *
  5261. * @static
  5262. * @memberOf _
  5263. * @since 2.0.0
  5264. * @category Function
  5265. * @param {Function} func The function to curry.
  5266. * @param {number} [arity=func.length] The arity of `func`.
  5267. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5268. * @returns {Function} Returns the new curried function.
  5269. * @example
  5270. *
  5271. * var abc = function(a, b, c) {
  5272. * return [a, b, c];
  5273. * };
  5274. *
  5275. * var curried = _.curry(abc);
  5276. *
  5277. * curried(1)(2)(3);
  5278. * // => [1, 2, 3]
  5279. *
  5280. * curried(1, 2)(3);
  5281. * // => [1, 2, 3]
  5282. *
  5283. * curried(1, 2, 3);
  5284. * // => [1, 2, 3]
  5285. *
  5286. * // Curried with placeholders.
  5287. * curried(1)(_, 3)(2);
  5288. * // => [1, 2, 3]
  5289. */function curry(func,arity,guard){arity=guard?undefined$1:arity;var result=createWrap(func,WRAP_CURRY_FLAG,undefined$1,undefined$1,undefined$1,undefined$1,undefined$1,arity);result.placeholder=curry.placeholder;return result;}/**
  5290. * This method is like `_.curry` except that arguments are applied to `func`
  5291. * in the manner of `_.partialRight` instead of `_.partial`.
  5292. *
  5293. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  5294. * builds, may be used as a placeholder for provided arguments.
  5295. *
  5296. * **Note:** This method doesn't set the "length" property of curried functions.
  5297. *
  5298. * @static
  5299. * @memberOf _
  5300. * @since 3.0.0
  5301. * @category Function
  5302. * @param {Function} func The function to curry.
  5303. * @param {number} [arity=func.length] The arity of `func`.
  5304. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5305. * @returns {Function} Returns the new curried function.
  5306. * @example
  5307. *
  5308. * var abc = function(a, b, c) {
  5309. * return [a, b, c];
  5310. * };
  5311. *
  5312. * var curried = _.curryRight(abc);
  5313. *
  5314. * curried(3)(2)(1);
  5315. * // => [1, 2, 3]
  5316. *
  5317. * curried(2, 3)(1);
  5318. * // => [1, 2, 3]
  5319. *
  5320. * curried(1, 2, 3);
  5321. * // => [1, 2, 3]
  5322. *
  5323. * // Curried with placeholders.
  5324. * curried(3)(1, _)(2);
  5325. * // => [1, 2, 3]
  5326. */function curryRight(func,arity,guard){arity=guard?undefined$1:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined$1,undefined$1,undefined$1,undefined$1,undefined$1,arity);result.placeholder=curryRight.placeholder;return result;}/**
  5327. * Creates a debounced function that delays invoking `func` until after `wait`
  5328. * milliseconds have elapsed since the last time the debounced function was
  5329. * invoked. The debounced function comes with a `cancel` method to cancel
  5330. * delayed `func` invocations and a `flush` method to immediately invoke them.
  5331. * Provide `options` to indicate whether `func` should be invoked on the
  5332. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  5333. * with the last arguments provided to the debounced function. Subsequent
  5334. * calls to the debounced function return the result of the last `func`
  5335. * invocation.
  5336. *
  5337. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  5338. * invoked on the trailing edge of the timeout only if the debounced function
  5339. * is invoked more than once during the `wait` timeout.
  5340. *
  5341. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  5342. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  5343. *
  5344. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  5345. * for details over the differences between `_.debounce` and `_.throttle`.
  5346. *
  5347. * @static
  5348. * @memberOf _
  5349. * @since 0.1.0
  5350. * @category Function
  5351. * @param {Function} func The function to debounce.
  5352. * @param {number} [wait=0] The number of milliseconds to delay.
  5353. * @param {Object} [options={}] The options object.
  5354. * @param {boolean} [options.leading=false]
  5355. * Specify invoking on the leading edge of the timeout.
  5356. * @param {number} [options.maxWait]
  5357. * The maximum time `func` is allowed to be delayed before it's invoked.
  5358. * @param {boolean} [options.trailing=true]
  5359. * Specify invoking on the trailing edge of the timeout.
  5360. * @returns {Function} Returns the new debounced function.
  5361. * @example
  5362. *
  5363. * // Avoid costly calculations while the window size is in flux.
  5364. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  5365. *
  5366. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  5367. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  5368. * 'leading': true,
  5369. * 'trailing': false
  5370. * }));
  5371. *
  5372. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  5373. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  5374. * var source = new EventSource('/stream');
  5375. * jQuery(source).on('message', debounced);
  5376. *
  5377. * // Cancel the trailing debounced invocation.
  5378. * jQuery(window).on('popstate', debounced.cancel);
  5379. */function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true;if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing='maxWait'in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing='trailing'in options?!!options.trailing:trailing;}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined$1;lastInvokeTime=time;result=func.apply(thisArg,args);return result;}function leadingEdge(time){// Reset any `maxWait` timer.
  5380. lastInvokeTime=time;// Start the timer for the trailing edge.
  5381. timerId=setTimeout(timerExpired,wait);// Invoke the leading edge.
  5382. return leading?invokeFunc(time):result;}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting;}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;// Either this is the first call, activity has stopped and we're at the
  5383. // trailing edge, the system time has gone backwards and we're treating
  5384. // it as the trailing edge, or we've hit the `maxWait` limit.
  5385. return lastCallTime===undefined$1||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait;}function timerExpired(){var time=now();if(shouldInvoke(time)){return trailingEdge(time);}// Restart the timer.
  5386. timerId=setTimeout(timerExpired,remainingWait(time));}function trailingEdge(time){timerId=undefined$1;// Only invoke if we have `lastArgs` which means `func` has been
  5387. // debounced at least once.
  5388. if(trailing&&lastArgs){return invokeFunc(time);}lastArgs=lastThis=undefined$1;return result;}function cancel(){if(timerId!==undefined$1){clearTimeout(timerId);}lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined$1;}function flush(){return timerId===undefined$1?result:trailingEdge(now());}function debounced(){var time=now(),isInvoking=shouldInvoke(time);lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined$1){return leadingEdge(lastCallTime);}if(maxing){// Handle invocations in a tight loop.
  5389. clearTimeout(timerId);timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime);}}if(timerId===undefined$1){timerId=setTimeout(timerExpired,wait);}return result;}debounced.cancel=cancel;debounced.flush=flush;return debounced;}/**
  5390. * Defers invoking the `func` until the current call stack has cleared. Any
  5391. * additional arguments are provided to `func` when it's invoked.
  5392. *
  5393. * @static
  5394. * @memberOf _
  5395. * @since 0.1.0
  5396. * @category Function
  5397. * @param {Function} func The function to defer.
  5398. * @param {...*} [args] The arguments to invoke `func` with.
  5399. * @returns {number} Returns the timer id.
  5400. * @example
  5401. *
  5402. * _.defer(function(text) {
  5403. * console.log(text);
  5404. * }, 'deferred');
  5405. * // => Logs 'deferred' after one millisecond.
  5406. */var defer=baseRest(function(func,args){return baseDelay(func,1,args);});/**
  5407. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  5408. * provided to `func` when it's invoked.
  5409. *
  5410. * @static
  5411. * @memberOf _
  5412. * @since 0.1.0
  5413. * @category Function
  5414. * @param {Function} func The function to delay.
  5415. * @param {number} wait The number of milliseconds to delay invocation.
  5416. * @param {...*} [args] The arguments to invoke `func` with.
  5417. * @returns {number} Returns the timer id.
  5418. * @example
  5419. *
  5420. * _.delay(function(text) {
  5421. * console.log(text);
  5422. * }, 1000, 'later');
  5423. * // => Logs 'later' after one second.
  5424. */var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args);});/**
  5425. * Creates a function that invokes `func` with arguments reversed.
  5426. *
  5427. * @static
  5428. * @memberOf _
  5429. * @since 4.0.0
  5430. * @category Function
  5431. * @param {Function} func The function to flip arguments for.
  5432. * @returns {Function} Returns the new flipped function.
  5433. * @example
  5434. *
  5435. * var flipped = _.flip(function() {
  5436. * return _.toArray(arguments);
  5437. * });
  5438. *
  5439. * flipped('a', 'b', 'c', 'd');
  5440. * // => ['d', 'c', 'b', 'a']
  5441. */function flip(func){return createWrap(func,WRAP_FLIP_FLAG);}/**
  5442. * Creates a function that memoizes the result of `func`. If `resolver` is
  5443. * provided, it determines the cache key for storing the result based on the
  5444. * arguments provided to the memoized function. By default, the first argument
  5445. * provided to the memoized function is used as the map cache key. The `func`
  5446. * is invoked with the `this` binding of the memoized function.
  5447. *
  5448. * **Note:** The cache is exposed as the `cache` property on the memoized
  5449. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  5450. * constructor with one whose instances implement the
  5451. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  5452. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  5453. *
  5454. * @static
  5455. * @memberOf _
  5456. * @since 0.1.0
  5457. * @category Function
  5458. * @param {Function} func The function to have its output memoized.
  5459. * @param {Function} [resolver] The function to resolve the cache key.
  5460. * @returns {Function} Returns the new memoized function.
  5461. * @example
  5462. *
  5463. * var object = { 'a': 1, 'b': 2 };
  5464. * var other = { 'c': 3, 'd': 4 };
  5465. *
  5466. * var values = _.memoize(_.values);
  5467. * values(object);
  5468. * // => [1, 2]
  5469. *
  5470. * values(other);
  5471. * // => [3, 4]
  5472. *
  5473. * object.a = 2;
  5474. * values(object);
  5475. * // => [1, 2]
  5476. *
  5477. * // Modify the result cache.
  5478. * values.cache.set(object, ['a', 'b']);
  5479. * values(object);
  5480. * // => ['a', 'b']
  5481. *
  5482. * // Replace `_.memoize.Cache`.
  5483. * _.memoize.Cache = WeakMap;
  5484. */function memoize(func,resolver){if(typeof func!='function'||resolver!=null&&typeof resolver!='function'){throw new TypeError(FUNC_ERROR_TEXT);}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key);}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result;};memoized.cache=new(memoize.Cache||MapCache)();return memoized;}// Expose `MapCache`.
  5485. memoize.Cache=MapCache;/**
  5486. * Creates a function that negates the result of the predicate `func`. The
  5487. * `func` predicate is invoked with the `this` binding and arguments of the
  5488. * created function.
  5489. *
  5490. * @static
  5491. * @memberOf _
  5492. * @since 3.0.0
  5493. * @category Function
  5494. * @param {Function} predicate The predicate to negate.
  5495. * @returns {Function} Returns the new negated function.
  5496. * @example
  5497. *
  5498. * function isEven(n) {
  5499. * return n % 2 == 0;
  5500. * }
  5501. *
  5502. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  5503. * // => [1, 3, 5]
  5504. */function negate(predicate){if(typeof predicate!='function'){throw new TypeError(FUNC_ERROR_TEXT);}return function(){var args=arguments;switch(args.length){case 0:return !predicate.call(this);case 1:return !predicate.call(this,args[0]);case 2:return !predicate.call(this,args[0],args[1]);case 3:return !predicate.call(this,args[0],args[1],args[2]);}return !predicate.apply(this,args);};}/**
  5505. * Creates a function that is restricted to invoking `func` once. Repeat calls
  5506. * to the function return the value of the first invocation. The `func` is
  5507. * invoked with the `this` binding and arguments of the created function.
  5508. *
  5509. * @static
  5510. * @memberOf _
  5511. * @since 0.1.0
  5512. * @category Function
  5513. * @param {Function} func The function to restrict.
  5514. * @returns {Function} Returns the new restricted function.
  5515. * @example
  5516. *
  5517. * var initialize = _.once(createApplication);
  5518. * initialize();
  5519. * initialize();
  5520. * // => `createApplication` is invoked once
  5521. */function once(func){return before(2,func);}/**
  5522. * Creates a function that invokes `func` with its arguments transformed.
  5523. *
  5524. * @static
  5525. * @since 4.0.0
  5526. * @memberOf _
  5527. * @category Function
  5528. * @param {Function} func The function to wrap.
  5529. * @param {...(Function|Function[])} [transforms=[_.identity]]
  5530. * The argument transforms.
  5531. * @returns {Function} Returns the new function.
  5532. * @example
  5533. *
  5534. * function doubled(n) {
  5535. * return n * 2;
  5536. * }
  5537. *
  5538. * function square(n) {
  5539. * return n * n;
  5540. * }
  5541. *
  5542. * var func = _.overArgs(function(x, y) {
  5543. * return [x, y];
  5544. * }, [square, doubled]);
  5545. *
  5546. * func(9, 3);
  5547. * // => [81, 6]
  5548. *
  5549. * func(10, 5);
  5550. * // => [100, 10]
  5551. */var overArgs=castRest(function(func,transforms){transforms=transforms.length==1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index<length){args[index]=transforms[index].call(this,args[index]);}return apply(func,this,args);});});/**
  5552. * Creates a function that invokes `func` with `partials` prepended to the
  5553. * arguments it receives. This method is like `_.bind` except it does **not**
  5554. * alter the `this` binding.
  5555. *
  5556. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  5557. * builds, may be used as a placeholder for partially applied arguments.
  5558. *
  5559. * **Note:** This method doesn't set the "length" property of partially
  5560. * applied functions.
  5561. *
  5562. * @static
  5563. * @memberOf _
  5564. * @since 0.2.0
  5565. * @category Function
  5566. * @param {Function} func The function to partially apply arguments to.
  5567. * @param {...*} [partials] The arguments to be partially applied.
  5568. * @returns {Function} Returns the new partially applied function.
  5569. * @example
  5570. *
  5571. * function greet(greeting, name) {
  5572. * return greeting + ' ' + name;
  5573. * }
  5574. *
  5575. * var sayHelloTo = _.partial(greet, 'hello');
  5576. * sayHelloTo('fred');
  5577. * // => 'hello fred'
  5578. *
  5579. * // Partially applied with placeholders.
  5580. * var greetFred = _.partial(greet, _, 'fred');
  5581. * greetFred('hi');
  5582. * // => 'hi fred'
  5583. */var partial=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrap(func,WRAP_PARTIAL_FLAG,undefined$1,partials,holders);});/**
  5584. * This method is like `_.partial` except that partially applied arguments
  5585. * are appended to the arguments it receives.
  5586. *
  5587. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  5588. * builds, may be used as a placeholder for partially applied arguments.
  5589. *
  5590. * **Note:** This method doesn't set the "length" property of partially
  5591. * applied functions.
  5592. *
  5593. * @static
  5594. * @memberOf _
  5595. * @since 1.0.0
  5596. * @category Function
  5597. * @param {Function} func The function to partially apply arguments to.
  5598. * @param {...*} [partials] The arguments to be partially applied.
  5599. * @returns {Function} Returns the new partially applied function.
  5600. * @example
  5601. *
  5602. * function greet(greeting, name) {
  5603. * return greeting + ' ' + name;
  5604. * }
  5605. *
  5606. * var greetFred = _.partialRight(greet, 'fred');
  5607. * greetFred('hi');
  5608. * // => 'hi fred'
  5609. *
  5610. * // Partially applied with placeholders.
  5611. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  5612. * sayHelloTo('fred');
  5613. * // => 'hello fred'
  5614. */var partialRight=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrap(func,WRAP_PARTIAL_RIGHT_FLAG,undefined$1,partials,holders);});/**
  5615. * Creates a function that invokes `func` with arguments arranged according
  5616. * to the specified `indexes` where the argument value at the first index is
  5617. * provided as the first argument, the argument value at the second index is
  5618. * provided as the second argument, and so on.
  5619. *
  5620. * @static
  5621. * @memberOf _
  5622. * @since 3.0.0
  5623. * @category Function
  5624. * @param {Function} func The function to rearrange arguments for.
  5625. * @param {...(number|number[])} indexes The arranged argument indexes.
  5626. * @returns {Function} Returns the new function.
  5627. * @example
  5628. *
  5629. * var rearged = _.rearg(function(a, b, c) {
  5630. * return [a, b, c];
  5631. * }, [2, 0, 1]);
  5632. *
  5633. * rearged('b', 'c', 'a')
  5634. * // => ['a', 'b', 'c']
  5635. */var rearg=flatRest(function(func,indexes){return createWrap(func,WRAP_REARG_FLAG,undefined$1,undefined$1,undefined$1,indexes);});/**
  5636. * Creates a function that invokes `func` with the `this` binding of the
  5637. * created function and arguments from `start` and beyond provided as
  5638. * an array.
  5639. *
  5640. * **Note:** This method is based on the
  5641. * [rest parameter](https://mdn.io/rest_parameters).
  5642. *
  5643. * @static
  5644. * @memberOf _
  5645. * @since 4.0.0
  5646. * @category Function
  5647. * @param {Function} func The function to apply a rest parameter to.
  5648. * @param {number} [start=func.length-1] The start position of the rest parameter.
  5649. * @returns {Function} Returns the new function.
  5650. * @example
  5651. *
  5652. * var say = _.rest(function(what, names) {
  5653. * return what + ' ' + _.initial(names).join(', ') +
  5654. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  5655. * });
  5656. *
  5657. * say('hello', 'fred', 'barney', 'pebbles');
  5658. * // => 'hello fred, barney, & pebbles'
  5659. */function rest(func,start){if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}start=start===undefined$1?start:toInteger(start);return baseRest(func,start);}/**
  5660. * Creates a function that invokes `func` with the `this` binding of the
  5661. * create function and an array of arguments much like
  5662. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  5663. *
  5664. * **Note:** This method is based on the
  5665. * [spread operator](https://mdn.io/spread_operator).
  5666. *
  5667. * @static
  5668. * @memberOf _
  5669. * @since 3.2.0
  5670. * @category Function
  5671. * @param {Function} func The function to spread arguments over.
  5672. * @param {number} [start=0] The start position of the spread.
  5673. * @returns {Function} Returns the new function.
  5674. * @example
  5675. *
  5676. * var say = _.spread(function(who, what) {
  5677. * return who + ' says ' + what;
  5678. * });
  5679. *
  5680. * say(['fred', 'hello']);
  5681. * // => 'fred says hello'
  5682. *
  5683. * var numbers = Promise.all([
  5684. * Promise.resolve(40),
  5685. * Promise.resolve(36)
  5686. * ]);
  5687. *
  5688. * numbers.then(_.spread(function(x, y) {
  5689. * return x + y;
  5690. * }));
  5691. * // => a Promise of 76
  5692. */function spread(func,start){if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}start=start==null?0:nativeMax(toInteger(start),0);return baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);if(array){arrayPush(otherArgs,array);}return apply(func,this,otherArgs);});}/**
  5693. * Creates a throttled function that only invokes `func` at most once per
  5694. * every `wait` milliseconds. The throttled function comes with a `cancel`
  5695. * method to cancel delayed `func` invocations and a `flush` method to
  5696. * immediately invoke them. Provide `options` to indicate whether `func`
  5697. * should be invoked on the leading and/or trailing edge of the `wait`
  5698. * timeout. The `func` is invoked with the last arguments provided to the
  5699. * throttled function. Subsequent calls to the throttled function return the
  5700. * result of the last `func` invocation.
  5701. *
  5702. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  5703. * invoked on the trailing edge of the timeout only if the throttled function
  5704. * is invoked more than once during the `wait` timeout.
  5705. *
  5706. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  5707. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  5708. *
  5709. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  5710. * for details over the differences between `_.throttle` and `_.debounce`.
  5711. *
  5712. * @static
  5713. * @memberOf _
  5714. * @since 0.1.0
  5715. * @category Function
  5716. * @param {Function} func The function to throttle.
  5717. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  5718. * @param {Object} [options={}] The options object.
  5719. * @param {boolean} [options.leading=true]
  5720. * Specify invoking on the leading edge of the timeout.
  5721. * @param {boolean} [options.trailing=true]
  5722. * Specify invoking on the trailing edge of the timeout.
  5723. * @returns {Function} Returns the new throttled function.
  5724. * @example
  5725. *
  5726. * // Avoid excessively updating the position while scrolling.
  5727. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  5728. *
  5729. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  5730. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  5731. * jQuery(element).on('click', throttled);
  5732. *
  5733. * // Cancel the trailing throttled invocation.
  5734. * jQuery(window).on('popstate', throttled.cancel);
  5735. */function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}if(isObject(options)){leading='leading'in options?!!options.leading:leading;trailing='trailing'in options?!!options.trailing:trailing;}return debounce(func,wait,{'leading':leading,'maxWait':wait,'trailing':trailing});}/**
  5736. * Creates a function that accepts up to one argument, ignoring any
  5737. * additional arguments.
  5738. *
  5739. * @static
  5740. * @memberOf _
  5741. * @since 4.0.0
  5742. * @category Function
  5743. * @param {Function} func The function to cap arguments for.
  5744. * @returns {Function} Returns the new capped function.
  5745. * @example
  5746. *
  5747. * _.map(['6', '8', '10'], _.unary(parseInt));
  5748. * // => [6, 8, 10]
  5749. */function unary(func){return ary(func,1);}/**
  5750. * Creates a function that provides `value` to `wrapper` as its first
  5751. * argument. Any additional arguments provided to the function are appended
  5752. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  5753. * binding of the created function.
  5754. *
  5755. * @static
  5756. * @memberOf _
  5757. * @since 0.1.0
  5758. * @category Function
  5759. * @param {*} value The value to wrap.
  5760. * @param {Function} [wrapper=identity] The wrapper function.
  5761. * @returns {Function} Returns the new function.
  5762. * @example
  5763. *
  5764. * var p = _.wrap(_.escape, function(func, text) {
  5765. * return '<p>' + func(text) + '</p>';
  5766. * });
  5767. *
  5768. * p('fred, barney, & pebbles');
  5769. * // => '<p>fred, barney, &amp; pebbles</p>'
  5770. */function wrap(value,wrapper){return partial(castFunction(wrapper),value);}/*------------------------------------------------------------------------*/ /**
  5771. * Casts `value` as an array if it's not one.
  5772. *
  5773. * @static
  5774. * @memberOf _
  5775. * @since 4.4.0
  5776. * @category Lang
  5777. * @param {*} value The value to inspect.
  5778. * @returns {Array} Returns the cast array.
  5779. * @example
  5780. *
  5781. * _.castArray(1);
  5782. * // => [1]
  5783. *
  5784. * _.castArray({ 'a': 1 });
  5785. * // => [{ 'a': 1 }]
  5786. *
  5787. * _.castArray('abc');
  5788. * // => ['abc']
  5789. *
  5790. * _.castArray(null);
  5791. * // => [null]
  5792. *
  5793. * _.castArray(undefined);
  5794. * // => [undefined]
  5795. *
  5796. * _.castArray();
  5797. * // => []
  5798. *
  5799. * var array = [1, 2, 3];
  5800. * console.log(_.castArray(array) === array);
  5801. * // => true
  5802. */function castArray(){if(!arguments.length){return [];}var value=arguments[0];return isArray(value)?value:[value];}/**
  5803. * Creates a shallow clone of `value`.
  5804. *
  5805. * **Note:** This method is loosely based on the
  5806. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  5807. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  5808. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  5809. * arrays. The own enumerable properties of `arguments` objects are cloned
  5810. * as plain objects. An empty object is returned for uncloneable values such
  5811. * as error objects, functions, DOM nodes, and WeakMaps.
  5812. *
  5813. * @static
  5814. * @memberOf _
  5815. * @since 0.1.0
  5816. * @category Lang
  5817. * @param {*} value The value to clone.
  5818. * @returns {*} Returns the cloned value.
  5819. * @see _.cloneDeep
  5820. * @example
  5821. *
  5822. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  5823. *
  5824. * var shallow = _.clone(objects);
  5825. * console.log(shallow[0] === objects[0]);
  5826. * // => true
  5827. */function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG);}/**
  5828. * This method is like `_.clone` except that it accepts `customizer` which
  5829. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  5830. * cloning is handled by the method instead. The `customizer` is invoked with
  5831. * up to four arguments; (value [, index|key, object, stack]).
  5832. *
  5833. * @static
  5834. * @memberOf _
  5835. * @since 4.0.0
  5836. * @category Lang
  5837. * @param {*} value The value to clone.
  5838. * @param {Function} [customizer] The function to customize cloning.
  5839. * @returns {*} Returns the cloned value.
  5840. * @see _.cloneDeepWith
  5841. * @example
  5842. *
  5843. * function customizer(value) {
  5844. * if (_.isElement(value)) {
  5845. * return value.cloneNode(false);
  5846. * }
  5847. * }
  5848. *
  5849. * var el = _.cloneWith(document.body, customizer);
  5850. *
  5851. * console.log(el === document.body);
  5852. * // => false
  5853. * console.log(el.nodeName);
  5854. * // => 'BODY'
  5855. * console.log(el.childNodes.length);
  5856. * // => 0
  5857. */function cloneWith(value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseClone(value,CLONE_SYMBOLS_FLAG,customizer);}/**
  5858. * This method is like `_.clone` except that it recursively clones `value`.
  5859. *
  5860. * @static
  5861. * @memberOf _
  5862. * @since 1.0.0
  5863. * @category Lang
  5864. * @param {*} value The value to recursively clone.
  5865. * @returns {*} Returns the deep cloned value.
  5866. * @see _.clone
  5867. * @example
  5868. *
  5869. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  5870. *
  5871. * var deep = _.cloneDeep(objects);
  5872. * console.log(deep[0] === objects[0]);
  5873. * // => false
  5874. */function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG);}/**
  5875. * This method is like `_.cloneWith` except that it recursively clones `value`.
  5876. *
  5877. * @static
  5878. * @memberOf _
  5879. * @since 4.0.0
  5880. * @category Lang
  5881. * @param {*} value The value to recursively clone.
  5882. * @param {Function} [customizer] The function to customize cloning.
  5883. * @returns {*} Returns the deep cloned value.
  5884. * @see _.cloneWith
  5885. * @example
  5886. *
  5887. * function customizer(value) {
  5888. * if (_.isElement(value)) {
  5889. * return value.cloneNode(true);
  5890. * }
  5891. * }
  5892. *
  5893. * var el = _.cloneDeepWith(document.body, customizer);
  5894. *
  5895. * console.log(el === document.body);
  5896. * // => false
  5897. * console.log(el.nodeName);
  5898. * // => 'BODY'
  5899. * console.log(el.childNodes.length);
  5900. * // => 20
  5901. */function cloneDeepWith(value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer);}/**
  5902. * Checks if `object` conforms to `source` by invoking the predicate
  5903. * properties of `source` with the corresponding property values of `object`.
  5904. *
  5905. * **Note:** This method is equivalent to `_.conforms` when `source` is
  5906. * partially applied.
  5907. *
  5908. * @static
  5909. * @memberOf _
  5910. * @since 4.14.0
  5911. * @category Lang
  5912. * @param {Object} object The object to inspect.
  5913. * @param {Object} source The object of property predicates to conform to.
  5914. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  5915. * @example
  5916. *
  5917. * var object = { 'a': 1, 'b': 2 };
  5918. *
  5919. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  5920. * // => true
  5921. *
  5922. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  5923. * // => false
  5924. */function conformsTo(object,source){return source==null||baseConformsTo(object,source,keys(source));}/**
  5925. * Performs a
  5926. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  5927. * comparison between two values to determine if they are equivalent.
  5928. *
  5929. * @static
  5930. * @memberOf _
  5931. * @since 4.0.0
  5932. * @category Lang
  5933. * @param {*} value The value to compare.
  5934. * @param {*} other The other value to compare.
  5935. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5936. * @example
  5937. *
  5938. * var object = { 'a': 1 };
  5939. * var other = { 'a': 1 };
  5940. *
  5941. * _.eq(object, object);
  5942. * // => true
  5943. *
  5944. * _.eq(object, other);
  5945. * // => false
  5946. *
  5947. * _.eq('a', 'a');
  5948. * // => true
  5949. *
  5950. * _.eq('a', Object('a'));
  5951. * // => false
  5952. *
  5953. * _.eq(NaN, NaN);
  5954. * // => true
  5955. */function eq(value,other){return value===other||value!==value&&other!==other;}/**
  5956. * Checks if `value` is greater than `other`.
  5957. *
  5958. * @static
  5959. * @memberOf _
  5960. * @since 3.9.0
  5961. * @category Lang
  5962. * @param {*} value The value to compare.
  5963. * @param {*} other The other value to compare.
  5964. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  5965. * else `false`.
  5966. * @see _.lt
  5967. * @example
  5968. *
  5969. * _.gt(3, 1);
  5970. * // => true
  5971. *
  5972. * _.gt(3, 3);
  5973. * // => false
  5974. *
  5975. * _.gt(1, 3);
  5976. * // => false
  5977. */var gt=createRelationalOperation(baseGt);/**
  5978. * Checks if `value` is greater than or equal to `other`.
  5979. *
  5980. * @static
  5981. * @memberOf _
  5982. * @since 3.9.0
  5983. * @category Lang
  5984. * @param {*} value The value to compare.
  5985. * @param {*} other The other value to compare.
  5986. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  5987. * `other`, else `false`.
  5988. * @see _.lte
  5989. * @example
  5990. *
  5991. * _.gte(3, 1);
  5992. * // => true
  5993. *
  5994. * _.gte(3, 3);
  5995. * // => true
  5996. *
  5997. * _.gte(1, 3);
  5998. * // => false
  5999. */var gte=createRelationalOperation(function(value,other){return value>=other;});/**
  6000. * Checks if `value` is likely an `arguments` object.
  6001. *
  6002. * @static
  6003. * @memberOf _
  6004. * @since 0.1.0
  6005. * @category Lang
  6006. * @param {*} value The value to check.
  6007. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6008. * else `false`.
  6009. * @example
  6010. *
  6011. * _.isArguments(function() { return arguments; }());
  6012. * // => true
  6013. *
  6014. * _.isArguments([1, 2, 3]);
  6015. * // => false
  6016. */var isArguments=baseIsArguments(function(){return arguments;}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,'callee')&&!propertyIsEnumerable.call(value,'callee');};/**
  6017. * Checks if `value` is classified as an `Array` object.
  6018. *
  6019. * @static
  6020. * @memberOf _
  6021. * @since 0.1.0
  6022. * @category Lang
  6023. * @param {*} value The value to check.
  6024. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6025. * @example
  6026. *
  6027. * _.isArray([1, 2, 3]);
  6028. * // => true
  6029. *
  6030. * _.isArray(document.body.children);
  6031. * // => false
  6032. *
  6033. * _.isArray('abc');
  6034. * // => false
  6035. *
  6036. * _.isArray(_.noop);
  6037. * // => false
  6038. */var isArray=Array.isArray;/**
  6039. * Checks if `value` is classified as an `ArrayBuffer` object.
  6040. *
  6041. * @static
  6042. * @memberOf _
  6043. * @since 4.3.0
  6044. * @category Lang
  6045. * @param {*} value The value to check.
  6046. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  6047. * @example
  6048. *
  6049. * _.isArrayBuffer(new ArrayBuffer(2));
  6050. * // => true
  6051. *
  6052. * _.isArrayBuffer(new Array(2));
  6053. * // => false
  6054. */var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;/**
  6055. * Checks if `value` is array-like. A value is considered array-like if it's
  6056. * not a function and has a `value.length` that's an integer greater than or
  6057. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  6058. *
  6059. * @static
  6060. * @memberOf _
  6061. * @since 4.0.0
  6062. * @category Lang
  6063. * @param {*} value The value to check.
  6064. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  6065. * @example
  6066. *
  6067. * _.isArrayLike([1, 2, 3]);
  6068. * // => true
  6069. *
  6070. * _.isArrayLike(document.body.children);
  6071. * // => true
  6072. *
  6073. * _.isArrayLike('abc');
  6074. * // => true
  6075. *
  6076. * _.isArrayLike(_.noop);
  6077. * // => false
  6078. */function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value);}/**
  6079. * This method is like `_.isArrayLike` except that it also checks if `value`
  6080. * is an object.
  6081. *
  6082. * @static
  6083. * @memberOf _
  6084. * @since 4.0.0
  6085. * @category Lang
  6086. * @param {*} value The value to check.
  6087. * @returns {boolean} Returns `true` if `value` is an array-like object,
  6088. * else `false`.
  6089. * @example
  6090. *
  6091. * _.isArrayLikeObject([1, 2, 3]);
  6092. * // => true
  6093. *
  6094. * _.isArrayLikeObject(document.body.children);
  6095. * // => true
  6096. *
  6097. * _.isArrayLikeObject('abc');
  6098. * // => false
  6099. *
  6100. * _.isArrayLikeObject(_.noop);
  6101. * // => false
  6102. */function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value);}/**
  6103. * Checks if `value` is classified as a boolean primitive or object.
  6104. *
  6105. * @static
  6106. * @memberOf _
  6107. * @since 0.1.0
  6108. * @category Lang
  6109. * @param {*} value The value to check.
  6110. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  6111. * @example
  6112. *
  6113. * _.isBoolean(false);
  6114. * // => true
  6115. *
  6116. * _.isBoolean(null);
  6117. * // => false
  6118. */function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag;}/**
  6119. * Checks if `value` is a buffer.
  6120. *
  6121. * @static
  6122. * @memberOf _
  6123. * @since 4.3.0
  6124. * @category Lang
  6125. * @param {*} value The value to check.
  6126. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  6127. * @example
  6128. *
  6129. * _.isBuffer(new Buffer(2));
  6130. * // => true
  6131. *
  6132. * _.isBuffer(new Uint8Array(2));
  6133. * // => false
  6134. */var isBuffer=nativeIsBuffer||stubFalse;/**
  6135. * Checks if `value` is classified as a `Date` object.
  6136. *
  6137. * @static
  6138. * @memberOf _
  6139. * @since 0.1.0
  6140. * @category Lang
  6141. * @param {*} value The value to check.
  6142. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  6143. * @example
  6144. *
  6145. * _.isDate(new Date);
  6146. * // => true
  6147. *
  6148. * _.isDate('Mon April 23 2012');
  6149. * // => false
  6150. */var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;/**
  6151. * Checks if `value` is likely a DOM element.
  6152. *
  6153. * @static
  6154. * @memberOf _
  6155. * @since 0.1.0
  6156. * @category Lang
  6157. * @param {*} value The value to check.
  6158. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  6159. * @example
  6160. *
  6161. * _.isElement(document.body);
  6162. * // => true
  6163. *
  6164. * _.isElement('<body>');
  6165. * // => false
  6166. */function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value);}/**
  6167. * Checks if `value` is an empty object, collection, map, or set.
  6168. *
  6169. * Objects are considered empty if they have no own enumerable string keyed
  6170. * properties.
  6171. *
  6172. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  6173. * jQuery-like collections are considered empty if they have a `length` of `0`.
  6174. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  6175. *
  6176. * @static
  6177. * @memberOf _
  6178. * @since 0.1.0
  6179. * @category Lang
  6180. * @param {*} value The value to check.
  6181. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  6182. * @example
  6183. *
  6184. * _.isEmpty(null);
  6185. * // => true
  6186. *
  6187. * _.isEmpty(true);
  6188. * // => true
  6189. *
  6190. * _.isEmpty(1);
  6191. * // => true
  6192. *
  6193. * _.isEmpty([1, 2, 3]);
  6194. * // => false
  6195. *
  6196. * _.isEmpty({ 'a': 1 });
  6197. * // => false
  6198. */function isEmpty(value){if(value==null){return true;}if(isArrayLike(value)&&(isArray(value)||typeof value=='string'||typeof value.splice=='function'||isBuffer(value)||isTypedArray(value)||isArguments(value))){return !value.length;}var tag=getTag(value);if(tag==mapTag||tag==setTag){return !value.size;}if(isPrototype(value)){return !baseKeys(value).length;}for(var key in value){if(hasOwnProperty.call(value,key)){return false;}}return true;}/**
  6199. * Performs a deep comparison between two values to determine if they are
  6200. * equivalent.
  6201. *
  6202. * **Note:** This method supports comparing arrays, array buffers, booleans,
  6203. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  6204. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  6205. * by their own, not inherited, enumerable properties. Functions and DOM
  6206. * nodes are compared by strict equality, i.e. `===`.
  6207. *
  6208. * @static
  6209. * @memberOf _
  6210. * @since 0.1.0
  6211. * @category Lang
  6212. * @param {*} value The value to compare.
  6213. * @param {*} other The other value to compare.
  6214. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6215. * @example
  6216. *
  6217. * var object = { 'a': 1 };
  6218. * var other = { 'a': 1 };
  6219. *
  6220. * _.isEqual(object, other);
  6221. * // => true
  6222. *
  6223. * object === other;
  6224. * // => false
  6225. */function isEqual(value,other){return baseIsEqual(value,other);}/**
  6226. * This method is like `_.isEqual` except that it accepts `customizer` which
  6227. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  6228. * are handled by the method instead. The `customizer` is invoked with up to
  6229. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  6230. *
  6231. * @static
  6232. * @memberOf _
  6233. * @since 4.0.0
  6234. * @category Lang
  6235. * @param {*} value The value to compare.
  6236. * @param {*} other The other value to compare.
  6237. * @param {Function} [customizer] The function to customize comparisons.
  6238. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6239. * @example
  6240. *
  6241. * function isGreeting(value) {
  6242. * return /^h(?:i|ello)$/.test(value);
  6243. * }
  6244. *
  6245. * function customizer(objValue, othValue) {
  6246. * if (isGreeting(objValue) && isGreeting(othValue)) {
  6247. * return true;
  6248. * }
  6249. * }
  6250. *
  6251. * var array = ['hello', 'goodbye'];
  6252. * var other = ['hi', 'goodbye'];
  6253. *
  6254. * _.isEqualWith(array, other, customizer);
  6255. * // => true
  6256. */function isEqualWith(value,other,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;var result=customizer?customizer(value,other):undefined$1;return result===undefined$1?baseIsEqual(value,other,undefined$1,customizer):!!result;}/**
  6257. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  6258. * `SyntaxError`, `TypeError`, or `URIError` object.
  6259. *
  6260. * @static
  6261. * @memberOf _
  6262. * @since 3.0.0
  6263. * @category Lang
  6264. * @param {*} value The value to check.
  6265. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  6266. * @example
  6267. *
  6268. * _.isError(new Error);
  6269. * // => true
  6270. *
  6271. * _.isError(Error);
  6272. * // => false
  6273. */function isError(value){if(!isObjectLike(value)){return false;}var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||typeof value.message=='string'&&typeof value.name=='string'&&!isPlainObject(value);}/**
  6274. * Checks if `value` is a finite primitive number.
  6275. *
  6276. * **Note:** This method is based on
  6277. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  6278. *
  6279. * @static
  6280. * @memberOf _
  6281. * @since 0.1.0
  6282. * @category Lang
  6283. * @param {*} value The value to check.
  6284. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  6285. * @example
  6286. *
  6287. * _.isFinite(3);
  6288. * // => true
  6289. *
  6290. * _.isFinite(Number.MIN_VALUE);
  6291. * // => true
  6292. *
  6293. * _.isFinite(Infinity);
  6294. * // => false
  6295. *
  6296. * _.isFinite('3');
  6297. * // => false
  6298. */function isFinite(value){return typeof value=='number'&&nativeIsFinite(value);}/**
  6299. * Checks if `value` is classified as a `Function` object.
  6300. *
  6301. * @static
  6302. * @memberOf _
  6303. * @since 0.1.0
  6304. * @category Lang
  6305. * @param {*} value The value to check.
  6306. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  6307. * @example
  6308. *
  6309. * _.isFunction(_);
  6310. * // => true
  6311. *
  6312. * _.isFunction(/abc/);
  6313. * // => false
  6314. */function isFunction(value){if(!isObject(value)){return false;}// The use of `Object#toString` avoids issues with the `typeof` operator
  6315. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  6316. var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag;}/**
  6317. * Checks if `value` is an integer.
  6318. *
  6319. * **Note:** This method is based on
  6320. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  6321. *
  6322. * @static
  6323. * @memberOf _
  6324. * @since 4.0.0
  6325. * @category Lang
  6326. * @param {*} value The value to check.
  6327. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  6328. * @example
  6329. *
  6330. * _.isInteger(3);
  6331. * // => true
  6332. *
  6333. * _.isInteger(Number.MIN_VALUE);
  6334. * // => false
  6335. *
  6336. * _.isInteger(Infinity);
  6337. * // => false
  6338. *
  6339. * _.isInteger('3');
  6340. * // => false
  6341. */function isInteger(value){return typeof value=='number'&&value==toInteger(value);}/**
  6342. * Checks if `value` is a valid array-like length.
  6343. *
  6344. * **Note:** This method is loosely based on
  6345. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6346. *
  6347. * @static
  6348. * @memberOf _
  6349. * @since 4.0.0
  6350. * @category Lang
  6351. * @param {*} value The value to check.
  6352. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6353. * @example
  6354. *
  6355. * _.isLength(3);
  6356. * // => true
  6357. *
  6358. * _.isLength(Number.MIN_VALUE);
  6359. * // => false
  6360. *
  6361. * _.isLength(Infinity);
  6362. * // => false
  6363. *
  6364. * _.isLength('3');
  6365. * // => false
  6366. */function isLength(value){return typeof value=='number'&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER;}/**
  6367. * Checks if `value` is the
  6368. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6369. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6370. *
  6371. * @static
  6372. * @memberOf _
  6373. * @since 0.1.0
  6374. * @category Lang
  6375. * @param {*} value The value to check.
  6376. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6377. * @example
  6378. *
  6379. * _.isObject({});
  6380. * // => true
  6381. *
  6382. * _.isObject([1, 2, 3]);
  6383. * // => true
  6384. *
  6385. * _.isObject(_.noop);
  6386. * // => true
  6387. *
  6388. * _.isObject(null);
  6389. * // => false
  6390. */function isObject(value){var type=typeof value;return value!=null&&(type=='object'||type=='function');}/**
  6391. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6392. * and has a `typeof` result of "object".
  6393. *
  6394. * @static
  6395. * @memberOf _
  6396. * @since 4.0.0
  6397. * @category Lang
  6398. * @param {*} value The value to check.
  6399. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6400. * @example
  6401. *
  6402. * _.isObjectLike({});
  6403. * // => true
  6404. *
  6405. * _.isObjectLike([1, 2, 3]);
  6406. * // => true
  6407. *
  6408. * _.isObjectLike(_.noop);
  6409. * // => false
  6410. *
  6411. * _.isObjectLike(null);
  6412. * // => false
  6413. */function isObjectLike(value){return value!=null&&typeof value=='object';}/**
  6414. * Checks if `value` is classified as a `Map` object.
  6415. *
  6416. * @static
  6417. * @memberOf _
  6418. * @since 4.3.0
  6419. * @category Lang
  6420. * @param {*} value The value to check.
  6421. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  6422. * @example
  6423. *
  6424. * _.isMap(new Map);
  6425. * // => true
  6426. *
  6427. * _.isMap(new WeakMap);
  6428. * // => false
  6429. */var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;/**
  6430. * Performs a partial deep comparison between `object` and `source` to
  6431. * determine if `object` contains equivalent property values.
  6432. *
  6433. * **Note:** This method is equivalent to `_.matches` when `source` is
  6434. * partially applied.
  6435. *
  6436. * Partial comparisons will match empty array and empty object `source`
  6437. * values against any array or object value, respectively. See `_.isEqual`
  6438. * for a list of supported value comparisons.
  6439. *
  6440. * @static
  6441. * @memberOf _
  6442. * @since 3.0.0
  6443. * @category Lang
  6444. * @param {Object} object The object to inspect.
  6445. * @param {Object} source The object of property values to match.
  6446. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  6447. * @example
  6448. *
  6449. * var object = { 'a': 1, 'b': 2 };
  6450. *
  6451. * _.isMatch(object, { 'b': 2 });
  6452. * // => true
  6453. *
  6454. * _.isMatch(object, { 'b': 1 });
  6455. * // => false
  6456. */function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source));}/**
  6457. * This method is like `_.isMatch` except that it accepts `customizer` which
  6458. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  6459. * are handled by the method instead. The `customizer` is invoked with five
  6460. * arguments: (objValue, srcValue, index|key, object, source).
  6461. *
  6462. * @static
  6463. * @memberOf _
  6464. * @since 4.0.0
  6465. * @category Lang
  6466. * @param {Object} object The object to inspect.
  6467. * @param {Object} source The object of property values to match.
  6468. * @param {Function} [customizer] The function to customize comparisons.
  6469. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  6470. * @example
  6471. *
  6472. * function isGreeting(value) {
  6473. * return /^h(?:i|ello)$/.test(value);
  6474. * }
  6475. *
  6476. * function customizer(objValue, srcValue) {
  6477. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  6478. * return true;
  6479. * }
  6480. * }
  6481. *
  6482. * var object = { 'greeting': 'hello' };
  6483. * var source = { 'greeting': 'hi' };
  6484. *
  6485. * _.isMatchWith(object, source, customizer);
  6486. * // => true
  6487. */function isMatchWith(object,source,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseIsMatch(object,source,getMatchData(source),customizer);}/**
  6488. * Checks if `value` is `NaN`.
  6489. *
  6490. * **Note:** This method is based on
  6491. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  6492. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  6493. * `undefined` and other non-number values.
  6494. *
  6495. * @static
  6496. * @memberOf _
  6497. * @since 0.1.0
  6498. * @category Lang
  6499. * @param {*} value The value to check.
  6500. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  6501. * @example
  6502. *
  6503. * _.isNaN(NaN);
  6504. * // => true
  6505. *
  6506. * _.isNaN(new Number(NaN));
  6507. * // => true
  6508. *
  6509. * isNaN(undefined);
  6510. * // => true
  6511. *
  6512. * _.isNaN(undefined);
  6513. * // => false
  6514. */function isNaN(value){// An `NaN` primitive is the only value that is not equal to itself.
  6515. // Perform the `toStringTag` check first to avoid errors with some
  6516. // ActiveX objects in IE.
  6517. return isNumber(value)&&value!=+value;}/**
  6518. * Checks if `value` is a pristine native function.
  6519. *
  6520. * **Note:** This method can't reliably detect native functions in the presence
  6521. * of the core-js package because core-js circumvents this kind of detection.
  6522. * Despite multiple requests, the core-js maintainer has made it clear: any
  6523. * attempt to fix the detection will be obstructed. As a result, we're left
  6524. * with little choice but to throw an error. Unfortunately, this also affects
  6525. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  6526. * which rely on core-js.
  6527. *
  6528. * @static
  6529. * @memberOf _
  6530. * @since 3.0.0
  6531. * @category Lang
  6532. * @param {*} value The value to check.
  6533. * @returns {boolean} Returns `true` if `value` is a native function,
  6534. * else `false`.
  6535. * @example
  6536. *
  6537. * _.isNative(Array.prototype.push);
  6538. * // => true
  6539. *
  6540. * _.isNative(_);
  6541. * // => false
  6542. */function isNative(value){if(isMaskable(value)){throw new Error(CORE_ERROR_TEXT);}return baseIsNative(value);}/**
  6543. * Checks if `value` is `null`.
  6544. *
  6545. * @static
  6546. * @memberOf _
  6547. * @since 0.1.0
  6548. * @category Lang
  6549. * @param {*} value The value to check.
  6550. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  6551. * @example
  6552. *
  6553. * _.isNull(null);
  6554. * // => true
  6555. *
  6556. * _.isNull(void 0);
  6557. * // => false
  6558. */function isNull(value){return value===null;}/**
  6559. * Checks if `value` is `null` or `undefined`.
  6560. *
  6561. * @static
  6562. * @memberOf _
  6563. * @since 4.0.0
  6564. * @category Lang
  6565. * @param {*} value The value to check.
  6566. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  6567. * @example
  6568. *
  6569. * _.isNil(null);
  6570. * // => true
  6571. *
  6572. * _.isNil(void 0);
  6573. * // => true
  6574. *
  6575. * _.isNil(NaN);
  6576. * // => false
  6577. */function isNil(value){return value==null;}/**
  6578. * Checks if `value` is classified as a `Number` primitive or object.
  6579. *
  6580. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  6581. * classified as numbers, use the `_.isFinite` method.
  6582. *
  6583. * @static
  6584. * @memberOf _
  6585. * @since 0.1.0
  6586. * @category Lang
  6587. * @param {*} value The value to check.
  6588. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  6589. * @example
  6590. *
  6591. * _.isNumber(3);
  6592. * // => true
  6593. *
  6594. * _.isNumber(Number.MIN_VALUE);
  6595. * // => true
  6596. *
  6597. * _.isNumber(Infinity);
  6598. * // => true
  6599. *
  6600. * _.isNumber('3');
  6601. * // => false
  6602. */function isNumber(value){return typeof value=='number'||isObjectLike(value)&&baseGetTag(value)==numberTag;}/**
  6603. * Checks if `value` is a plain object, that is, an object created by the
  6604. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  6605. *
  6606. * @static
  6607. * @memberOf _
  6608. * @since 0.8.0
  6609. * @category Lang
  6610. * @param {*} value The value to check.
  6611. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  6612. * @example
  6613. *
  6614. * function Foo() {
  6615. * this.a = 1;
  6616. * }
  6617. *
  6618. * _.isPlainObject(new Foo);
  6619. * // => false
  6620. *
  6621. * _.isPlainObject([1, 2, 3]);
  6622. * // => false
  6623. *
  6624. * _.isPlainObject({ 'x': 0, 'y': 0 });
  6625. * // => true
  6626. *
  6627. * _.isPlainObject(Object.create(null));
  6628. * // => true
  6629. */function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag){return false;}var proto=getPrototype(value);if(proto===null){return true;}var Ctor=hasOwnProperty.call(proto,'constructor')&&proto.constructor;return typeof Ctor=='function'&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString;}/**
  6630. * Checks if `value` is classified as a `RegExp` object.
  6631. *
  6632. * @static
  6633. * @memberOf _
  6634. * @since 0.1.0
  6635. * @category Lang
  6636. * @param {*} value The value to check.
  6637. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  6638. * @example
  6639. *
  6640. * _.isRegExp(/abc/);
  6641. * // => true
  6642. *
  6643. * _.isRegExp('/abc/');
  6644. * // => false
  6645. */var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;/**
  6646. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  6647. * double precision number which isn't the result of a rounded unsafe integer.
  6648. *
  6649. * **Note:** This method is based on
  6650. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  6651. *
  6652. * @static
  6653. * @memberOf _
  6654. * @since 4.0.0
  6655. * @category Lang
  6656. * @param {*} value The value to check.
  6657. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  6658. * @example
  6659. *
  6660. * _.isSafeInteger(3);
  6661. * // => true
  6662. *
  6663. * _.isSafeInteger(Number.MIN_VALUE);
  6664. * // => false
  6665. *
  6666. * _.isSafeInteger(Infinity);
  6667. * // => false
  6668. *
  6669. * _.isSafeInteger('3');
  6670. * // => false
  6671. */function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER;}/**
  6672. * Checks if `value` is classified as a `Set` object.
  6673. *
  6674. * @static
  6675. * @memberOf _
  6676. * @since 4.3.0
  6677. * @category Lang
  6678. * @param {*} value The value to check.
  6679. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  6680. * @example
  6681. *
  6682. * _.isSet(new Set);
  6683. * // => true
  6684. *
  6685. * _.isSet(new WeakSet);
  6686. * // => false
  6687. */var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;/**
  6688. * Checks if `value` is classified as a `String` primitive or object.
  6689. *
  6690. * @static
  6691. * @since 0.1.0
  6692. * @memberOf _
  6693. * @category Lang
  6694. * @param {*} value The value to check.
  6695. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  6696. * @example
  6697. *
  6698. * _.isString('abc');
  6699. * // => true
  6700. *
  6701. * _.isString(1);
  6702. * // => false
  6703. */function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag;}/**
  6704. * Checks if `value` is classified as a `Symbol` primitive or object.
  6705. *
  6706. * @static
  6707. * @memberOf _
  6708. * @since 4.0.0
  6709. * @category Lang
  6710. * @param {*} value The value to check.
  6711. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6712. * @example
  6713. *
  6714. * _.isSymbol(Symbol.iterator);
  6715. * // => true
  6716. *
  6717. * _.isSymbol('abc');
  6718. * // => false
  6719. */function isSymbol(value){return typeof value=='symbol'||isObjectLike(value)&&baseGetTag(value)==symbolTag;}/**
  6720. * Checks if `value` is classified as a typed array.
  6721. *
  6722. * @static
  6723. * @memberOf _
  6724. * @since 3.0.0
  6725. * @category Lang
  6726. * @param {*} value The value to check.
  6727. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  6728. * @example
  6729. *
  6730. * _.isTypedArray(new Uint8Array);
  6731. * // => true
  6732. *
  6733. * _.isTypedArray([]);
  6734. * // => false
  6735. */var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;/**
  6736. * Checks if `value` is `undefined`.
  6737. *
  6738. * @static
  6739. * @since 0.1.0
  6740. * @memberOf _
  6741. * @category Lang
  6742. * @param {*} value The value to check.
  6743. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  6744. * @example
  6745. *
  6746. * _.isUndefined(void 0);
  6747. * // => true
  6748. *
  6749. * _.isUndefined(null);
  6750. * // => false
  6751. */function isUndefined(value){return value===undefined$1;}/**
  6752. * Checks if `value` is classified as a `WeakMap` object.
  6753. *
  6754. * @static
  6755. * @memberOf _
  6756. * @since 4.3.0
  6757. * @category Lang
  6758. * @param {*} value The value to check.
  6759. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  6760. * @example
  6761. *
  6762. * _.isWeakMap(new WeakMap);
  6763. * // => true
  6764. *
  6765. * _.isWeakMap(new Map);
  6766. * // => false
  6767. */function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag;}/**
  6768. * Checks if `value` is classified as a `WeakSet` object.
  6769. *
  6770. * @static
  6771. * @memberOf _
  6772. * @since 4.3.0
  6773. * @category Lang
  6774. * @param {*} value The value to check.
  6775. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  6776. * @example
  6777. *
  6778. * _.isWeakSet(new WeakSet);
  6779. * // => true
  6780. *
  6781. * _.isWeakSet(new Set);
  6782. * // => false
  6783. */function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag;}/**
  6784. * Checks if `value` is less than `other`.
  6785. *
  6786. * @static
  6787. * @memberOf _
  6788. * @since 3.9.0
  6789. * @category Lang
  6790. * @param {*} value The value to compare.
  6791. * @param {*} other The other value to compare.
  6792. * @returns {boolean} Returns `true` if `value` is less than `other`,
  6793. * else `false`.
  6794. * @see _.gt
  6795. * @example
  6796. *
  6797. * _.lt(1, 3);
  6798. * // => true
  6799. *
  6800. * _.lt(3, 3);
  6801. * // => false
  6802. *
  6803. * _.lt(3, 1);
  6804. * // => false
  6805. */var lt=createRelationalOperation(baseLt);/**
  6806. * Checks if `value` is less than or equal to `other`.
  6807. *
  6808. * @static
  6809. * @memberOf _
  6810. * @since 3.9.0
  6811. * @category Lang
  6812. * @param {*} value The value to compare.
  6813. * @param {*} other The other value to compare.
  6814. * @returns {boolean} Returns `true` if `value` is less than or equal to
  6815. * `other`, else `false`.
  6816. * @see _.gte
  6817. * @example
  6818. *
  6819. * _.lte(1, 3);
  6820. * // => true
  6821. *
  6822. * _.lte(3, 3);
  6823. * // => true
  6824. *
  6825. * _.lte(3, 1);
  6826. * // => false
  6827. */var lte=createRelationalOperation(function(value,other){return value<=other;});/**
  6828. * Converts `value` to an array.
  6829. *
  6830. * @static
  6831. * @since 0.1.0
  6832. * @memberOf _
  6833. * @category Lang
  6834. * @param {*} value The value to convert.
  6835. * @returns {Array} Returns the converted array.
  6836. * @example
  6837. *
  6838. * _.toArray({ 'a': 1, 'b': 2 });
  6839. * // => [1, 2]
  6840. *
  6841. * _.toArray('abc');
  6842. * // => ['a', 'b', 'c']
  6843. *
  6844. * _.toArray(1);
  6845. * // => []
  6846. *
  6847. * _.toArray(null);
  6848. * // => []
  6849. */function toArray(value){if(!value){return [];}if(isArrayLike(value)){return isString(value)?stringToArray(value):copyArray(value);}if(symIterator&&value[symIterator]){return iteratorToArray(value[symIterator]());}var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray:values;return func(value);}/**
  6850. * Converts `value` to a finite number.
  6851. *
  6852. * @static
  6853. * @memberOf _
  6854. * @since 4.12.0
  6855. * @category Lang
  6856. * @param {*} value The value to convert.
  6857. * @returns {number} Returns the converted number.
  6858. * @example
  6859. *
  6860. * _.toFinite(3.2);
  6861. * // => 3.2
  6862. *
  6863. * _.toFinite(Number.MIN_VALUE);
  6864. * // => 5e-324
  6865. *
  6866. * _.toFinite(Infinity);
  6867. * // => 1.7976931348623157e+308
  6868. *
  6869. * _.toFinite('3.2');
  6870. * // => 3.2
  6871. */function toFinite(value){if(!value){return value===0?value:0;}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER;}return value===value?value:0;}/**
  6872. * Converts `value` to an integer.
  6873. *
  6874. * **Note:** This method is loosely based on
  6875. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  6876. *
  6877. * @static
  6878. * @memberOf _
  6879. * @since 4.0.0
  6880. * @category Lang
  6881. * @param {*} value The value to convert.
  6882. * @returns {number} Returns the converted integer.
  6883. * @example
  6884. *
  6885. * _.toInteger(3.2);
  6886. * // => 3
  6887. *
  6888. * _.toInteger(Number.MIN_VALUE);
  6889. * // => 0
  6890. *
  6891. * _.toInteger(Infinity);
  6892. * // => 1.7976931348623157e+308
  6893. *
  6894. * _.toInteger('3.2');
  6895. * // => 3
  6896. */function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0;}/**
  6897. * Converts `value` to an integer suitable for use as the length of an
  6898. * array-like object.
  6899. *
  6900. * **Note:** This method is based on
  6901. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6902. *
  6903. * @static
  6904. * @memberOf _
  6905. * @since 4.0.0
  6906. * @category Lang
  6907. * @param {*} value The value to convert.
  6908. * @returns {number} Returns the converted integer.
  6909. * @example
  6910. *
  6911. * _.toLength(3.2);
  6912. * // => 3
  6913. *
  6914. * _.toLength(Number.MIN_VALUE);
  6915. * // => 0
  6916. *
  6917. * _.toLength(Infinity);
  6918. * // => 4294967295
  6919. *
  6920. * _.toLength('3.2');
  6921. * // => 3
  6922. */function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0;}/**
  6923. * Converts `value` to a number.
  6924. *
  6925. * @static
  6926. * @memberOf _
  6927. * @since 4.0.0
  6928. * @category Lang
  6929. * @param {*} value The value to process.
  6930. * @returns {number} Returns the number.
  6931. * @example
  6932. *
  6933. * _.toNumber(3.2);
  6934. * // => 3.2
  6935. *
  6936. * _.toNumber(Number.MIN_VALUE);
  6937. * // => 5e-324
  6938. *
  6939. * _.toNumber(Infinity);
  6940. * // => Infinity
  6941. *
  6942. * _.toNumber('3.2');
  6943. * // => 3.2
  6944. */function toNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}if(isObject(value)){var other=typeof value.valueOf=='function'?value.valueOf():value;value=isObject(other)?other+'':other;}if(typeof value!='string'){return value===0?value:+value;}value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value;}/**
  6945. * Converts `value` to a plain object flattening inherited enumerable string
  6946. * keyed properties of `value` to own properties of the plain object.
  6947. *
  6948. * @static
  6949. * @memberOf _
  6950. * @since 3.0.0
  6951. * @category Lang
  6952. * @param {*} value The value to convert.
  6953. * @returns {Object} Returns the converted plain object.
  6954. * @example
  6955. *
  6956. * function Foo() {
  6957. * this.b = 2;
  6958. * }
  6959. *
  6960. * Foo.prototype.c = 3;
  6961. *
  6962. * _.assign({ 'a': 1 }, new Foo);
  6963. * // => { 'a': 1, 'b': 2 }
  6964. *
  6965. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  6966. * // => { 'a': 1, 'b': 2, 'c': 3 }
  6967. */function toPlainObject(value){return copyObject(value,keysIn(value));}/**
  6968. * Converts `value` to a safe integer. A safe integer can be compared and
  6969. * represented correctly.
  6970. *
  6971. * @static
  6972. * @memberOf _
  6973. * @since 4.0.0
  6974. * @category Lang
  6975. * @param {*} value The value to convert.
  6976. * @returns {number} Returns the converted integer.
  6977. * @example
  6978. *
  6979. * _.toSafeInteger(3.2);
  6980. * // => 3
  6981. *
  6982. * _.toSafeInteger(Number.MIN_VALUE);
  6983. * // => 0
  6984. *
  6985. * _.toSafeInteger(Infinity);
  6986. * // => 9007199254740991
  6987. *
  6988. * _.toSafeInteger('3.2');
  6989. * // => 3
  6990. */function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0;}/**
  6991. * Converts `value` to a string. An empty string is returned for `null`
  6992. * and `undefined` values. The sign of `-0` is preserved.
  6993. *
  6994. * @static
  6995. * @memberOf _
  6996. * @since 4.0.0
  6997. * @category Lang
  6998. * @param {*} value The value to convert.
  6999. * @returns {string} Returns the converted string.
  7000. * @example
  7001. *
  7002. * _.toString(null);
  7003. * // => ''
  7004. *
  7005. * _.toString(-0);
  7006. * // => '-0'
  7007. *
  7008. * _.toString([1, 2, 3]);
  7009. * // => '1,2,3'
  7010. */function toString(value){return value==null?'':baseToString(value);}/*------------------------------------------------------------------------*/ /**
  7011. * Assigns own enumerable string keyed properties of source objects to the
  7012. * destination object. Source objects are applied from left to right.
  7013. * Subsequent sources overwrite property assignments of previous sources.
  7014. *
  7015. * **Note:** This method mutates `object` and is loosely based on
  7016. * [`Object.assign`](https://mdn.io/Object/assign).
  7017. *
  7018. * @static
  7019. * @memberOf _
  7020. * @since 0.10.0
  7021. * @category Object
  7022. * @param {Object} object The destination object.
  7023. * @param {...Object} [sources] The source objects.
  7024. * @returns {Object} Returns `object`.
  7025. * @see _.assignIn
  7026. * @example
  7027. *
  7028. * function Foo() {
  7029. * this.a = 1;
  7030. * }
  7031. *
  7032. * function Bar() {
  7033. * this.c = 3;
  7034. * }
  7035. *
  7036. * Foo.prototype.b = 2;
  7037. * Bar.prototype.d = 4;
  7038. *
  7039. * _.assign({ 'a': 0 }, new Foo, new Bar);
  7040. * // => { 'a': 1, 'c': 3 }
  7041. */var assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return;}for(var key in source){if(hasOwnProperty.call(source,key)){assignValue(object,key,source[key]);}}});/**
  7042. * This method is like `_.assign` except that it iterates over own and
  7043. * inherited source properties.
  7044. *
  7045. * **Note:** This method mutates `object`.
  7046. *
  7047. * @static
  7048. * @memberOf _
  7049. * @since 4.0.0
  7050. * @alias extend
  7051. * @category Object
  7052. * @param {Object} object The destination object.
  7053. * @param {...Object} [sources] The source objects.
  7054. * @returns {Object} Returns `object`.
  7055. * @see _.assign
  7056. * @example
  7057. *
  7058. * function Foo() {
  7059. * this.a = 1;
  7060. * }
  7061. *
  7062. * function Bar() {
  7063. * this.c = 3;
  7064. * }
  7065. *
  7066. * Foo.prototype.b = 2;
  7067. * Bar.prototype.d = 4;
  7068. *
  7069. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  7070. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  7071. */var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object);});/**
  7072. * This method is like `_.assignIn` except that it accepts `customizer`
  7073. * which is invoked to produce the assigned values. If `customizer` returns
  7074. * `undefined`, assignment is handled by the method instead. The `customizer`
  7075. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  7076. *
  7077. * **Note:** This method mutates `object`.
  7078. *
  7079. * @static
  7080. * @memberOf _
  7081. * @since 4.0.0
  7082. * @alias extendWith
  7083. * @category Object
  7084. * @param {Object} object The destination object.
  7085. * @param {...Object} sources The source objects.
  7086. * @param {Function} [customizer] The function to customize assigned values.
  7087. * @returns {Object} Returns `object`.
  7088. * @see _.assignWith
  7089. * @example
  7090. *
  7091. * function customizer(objValue, srcValue) {
  7092. * return _.isUndefined(objValue) ? srcValue : objValue;
  7093. * }
  7094. *
  7095. * var defaults = _.partialRight(_.assignInWith, customizer);
  7096. *
  7097. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7098. * // => { 'a': 1, 'b': 2 }
  7099. */var assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer);});/**
  7100. * This method is like `_.assign` except that it accepts `customizer`
  7101. * which is invoked to produce the assigned values. If `customizer` returns
  7102. * `undefined`, assignment is handled by the method instead. The `customizer`
  7103. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  7104. *
  7105. * **Note:** This method mutates `object`.
  7106. *
  7107. * @static
  7108. * @memberOf _
  7109. * @since 4.0.0
  7110. * @category Object
  7111. * @param {Object} object The destination object.
  7112. * @param {...Object} sources The source objects.
  7113. * @param {Function} [customizer] The function to customize assigned values.
  7114. * @returns {Object} Returns `object`.
  7115. * @see _.assignInWith
  7116. * @example
  7117. *
  7118. * function customizer(objValue, srcValue) {
  7119. * return _.isUndefined(objValue) ? srcValue : objValue;
  7120. * }
  7121. *
  7122. * var defaults = _.partialRight(_.assignWith, customizer);
  7123. *
  7124. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7125. * // => { 'a': 1, 'b': 2 }
  7126. */var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer);});/**
  7127. * Creates an array of values corresponding to `paths` of `object`.
  7128. *
  7129. * @static
  7130. * @memberOf _
  7131. * @since 1.0.0
  7132. * @category Object
  7133. * @param {Object} object The object to iterate over.
  7134. * @param {...(string|string[])} [paths] The property paths to pick.
  7135. * @returns {Array} Returns the picked values.
  7136. * @example
  7137. *
  7138. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  7139. *
  7140. * _.at(object, ['a[0].b.c', 'a[1]']);
  7141. * // => [3, 4]
  7142. */var at=flatRest(baseAt);/**
  7143. * Creates an object that inherits from the `prototype` object. If a
  7144. * `properties` object is given, its own enumerable string keyed properties
  7145. * are assigned to the created object.
  7146. *
  7147. * @static
  7148. * @memberOf _
  7149. * @since 2.3.0
  7150. * @category Object
  7151. * @param {Object} prototype The object to inherit from.
  7152. * @param {Object} [properties] The properties to assign to the object.
  7153. * @returns {Object} Returns the new object.
  7154. * @example
  7155. *
  7156. * function Shape() {
  7157. * this.x = 0;
  7158. * this.y = 0;
  7159. * }
  7160. *
  7161. * function Circle() {
  7162. * Shape.call(this);
  7163. * }
  7164. *
  7165. * Circle.prototype = _.create(Shape.prototype, {
  7166. * 'constructor': Circle
  7167. * });
  7168. *
  7169. * var circle = new Circle;
  7170. * circle instanceof Circle;
  7171. * // => true
  7172. *
  7173. * circle instanceof Shape;
  7174. * // => true
  7175. */function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties);}/**
  7176. * Assigns own and inherited enumerable string keyed properties of source
  7177. * objects to the destination object for all destination properties that
  7178. * resolve to `undefined`. Source objects are applied from left to right.
  7179. * Once a property is set, additional values of the same property are ignored.
  7180. *
  7181. * **Note:** This method mutates `object`.
  7182. *
  7183. * @static
  7184. * @since 0.1.0
  7185. * @memberOf _
  7186. * @category Object
  7187. * @param {Object} object The destination object.
  7188. * @param {...Object} [sources] The source objects.
  7189. * @returns {Object} Returns `object`.
  7190. * @see _.defaultsDeep
  7191. * @example
  7192. *
  7193. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7194. * // => { 'a': 1, 'b': 2 }
  7195. */var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]:undefined$1;if(guard&&isIterateeCall(sources[0],sources[1],guard)){length=1;}while(++index<length){var source=sources[index];var props=keysIn(source);var propsIndex=-1;var propsLength=props.length;while(++propsIndex<propsLength){var key=props[propsIndex];var value=object[key];if(value===undefined$1||eq(value,objectProto[key])&&!hasOwnProperty.call(object,key)){object[key]=source[key];}}}return object;});/**
  7196. * This method is like `_.defaults` except that it recursively assigns
  7197. * default properties.
  7198. *
  7199. * **Note:** This method mutates `object`.
  7200. *
  7201. * @static
  7202. * @memberOf _
  7203. * @since 3.10.0
  7204. * @category Object
  7205. * @param {Object} object The destination object.
  7206. * @param {...Object} [sources] The source objects.
  7207. * @returns {Object} Returns `object`.
  7208. * @see _.defaults
  7209. * @example
  7210. *
  7211. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  7212. * // => { 'a': { 'b': 2, 'c': 3 } }
  7213. */var defaultsDeep=baseRest(function(args){args.push(undefined$1,customDefaultsMerge);return apply(mergeWith,undefined$1,args);});/**
  7214. * This method is like `_.find` except that it returns the key of the first
  7215. * element `predicate` returns truthy for instead of the element itself.
  7216. *
  7217. * @static
  7218. * @memberOf _
  7219. * @since 1.1.0
  7220. * @category Object
  7221. * @param {Object} object The object to inspect.
  7222. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7223. * @returns {string|undefined} Returns the key of the matched element,
  7224. * else `undefined`.
  7225. * @example
  7226. *
  7227. * var users = {
  7228. * 'barney': { 'age': 36, 'active': true },
  7229. * 'fred': { 'age': 40, 'active': false },
  7230. * 'pebbles': { 'age': 1, 'active': true }
  7231. * };
  7232. *
  7233. * _.findKey(users, function(o) { return o.age < 40; });
  7234. * // => 'barney' (iteration order is not guaranteed)
  7235. *
  7236. * // The `_.matches` iteratee shorthand.
  7237. * _.findKey(users, { 'age': 1, 'active': true });
  7238. * // => 'pebbles'
  7239. *
  7240. * // The `_.matchesProperty` iteratee shorthand.
  7241. * _.findKey(users, ['active', false]);
  7242. * // => 'fred'
  7243. *
  7244. * // The `_.property` iteratee shorthand.
  7245. * _.findKey(users, 'active');
  7246. * // => 'barney'
  7247. */function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn);}/**
  7248. * This method is like `_.findKey` except that it iterates over elements of
  7249. * a collection in the opposite order.
  7250. *
  7251. * @static
  7252. * @memberOf _
  7253. * @since 2.0.0
  7254. * @category Object
  7255. * @param {Object} object The object to inspect.
  7256. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7257. * @returns {string|undefined} Returns the key of the matched element,
  7258. * else `undefined`.
  7259. * @example
  7260. *
  7261. * var users = {
  7262. * 'barney': { 'age': 36, 'active': true },
  7263. * 'fred': { 'age': 40, 'active': false },
  7264. * 'pebbles': { 'age': 1, 'active': true }
  7265. * };
  7266. *
  7267. * _.findLastKey(users, function(o) { return o.age < 40; });
  7268. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  7269. *
  7270. * // The `_.matches` iteratee shorthand.
  7271. * _.findLastKey(users, { 'age': 36, 'active': true });
  7272. * // => 'barney'
  7273. *
  7274. * // The `_.matchesProperty` iteratee shorthand.
  7275. * _.findLastKey(users, ['active', false]);
  7276. * // => 'fred'
  7277. *
  7278. * // The `_.property` iteratee shorthand.
  7279. * _.findLastKey(users, 'active');
  7280. * // => 'pebbles'
  7281. */function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight);}/**
  7282. * Iterates over own and inherited enumerable string keyed properties of an
  7283. * object and invokes `iteratee` for each property. The iteratee is invoked
  7284. * with three arguments: (value, key, object). Iteratee functions may exit
  7285. * iteration early by explicitly returning `false`.
  7286. *
  7287. * @static
  7288. * @memberOf _
  7289. * @since 0.3.0
  7290. * @category Object
  7291. * @param {Object} object The object to iterate over.
  7292. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7293. * @returns {Object} Returns `object`.
  7294. * @see _.forInRight
  7295. * @example
  7296. *
  7297. * function Foo() {
  7298. * this.a = 1;
  7299. * this.b = 2;
  7300. * }
  7301. *
  7302. * Foo.prototype.c = 3;
  7303. *
  7304. * _.forIn(new Foo, function(value, key) {
  7305. * console.log(key);
  7306. * });
  7307. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  7308. */function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn);}/**
  7309. * This method is like `_.forIn` except that it iterates over properties of
  7310. * `object` in the opposite order.
  7311. *
  7312. * @static
  7313. * @memberOf _
  7314. * @since 2.0.0
  7315. * @category Object
  7316. * @param {Object} object The object to iterate over.
  7317. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7318. * @returns {Object} Returns `object`.
  7319. * @see _.forIn
  7320. * @example
  7321. *
  7322. * function Foo() {
  7323. * this.a = 1;
  7324. * this.b = 2;
  7325. * }
  7326. *
  7327. * Foo.prototype.c = 3;
  7328. *
  7329. * _.forInRight(new Foo, function(value, key) {
  7330. * console.log(key);
  7331. * });
  7332. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  7333. */function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn);}/**
  7334. * Iterates over own enumerable string keyed properties of an object and
  7335. * invokes `iteratee` for each property. The iteratee is invoked with three
  7336. * arguments: (value, key, object). Iteratee functions may exit iteration
  7337. * early by explicitly returning `false`.
  7338. *
  7339. * @static
  7340. * @memberOf _
  7341. * @since 0.3.0
  7342. * @category Object
  7343. * @param {Object} object The object to iterate over.
  7344. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7345. * @returns {Object} Returns `object`.
  7346. * @see _.forOwnRight
  7347. * @example
  7348. *
  7349. * function Foo() {
  7350. * this.a = 1;
  7351. * this.b = 2;
  7352. * }
  7353. *
  7354. * Foo.prototype.c = 3;
  7355. *
  7356. * _.forOwn(new Foo, function(value, key) {
  7357. * console.log(key);
  7358. * });
  7359. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  7360. */function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3));}/**
  7361. * This method is like `_.forOwn` except that it iterates over properties of
  7362. * `object` in the opposite order.
  7363. *
  7364. * @static
  7365. * @memberOf _
  7366. * @since 2.0.0
  7367. * @category Object
  7368. * @param {Object} object The object to iterate over.
  7369. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7370. * @returns {Object} Returns `object`.
  7371. * @see _.forOwn
  7372. * @example
  7373. *
  7374. * function Foo() {
  7375. * this.a = 1;
  7376. * this.b = 2;
  7377. * }
  7378. *
  7379. * Foo.prototype.c = 3;
  7380. *
  7381. * _.forOwnRight(new Foo, function(value, key) {
  7382. * console.log(key);
  7383. * });
  7384. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  7385. */function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3));}/**
  7386. * Creates an array of function property names from own enumerable properties
  7387. * of `object`.
  7388. *
  7389. * @static
  7390. * @since 0.1.0
  7391. * @memberOf _
  7392. * @category Object
  7393. * @param {Object} object The object to inspect.
  7394. * @returns {Array} Returns the function names.
  7395. * @see _.functionsIn
  7396. * @example
  7397. *
  7398. * function Foo() {
  7399. * this.a = _.constant('a');
  7400. * this.b = _.constant('b');
  7401. * }
  7402. *
  7403. * Foo.prototype.c = _.constant('c');
  7404. *
  7405. * _.functions(new Foo);
  7406. * // => ['a', 'b']
  7407. */function functions(object){return object==null?[]:baseFunctions(object,keys(object));}/**
  7408. * Creates an array of function property names from own and inherited
  7409. * enumerable properties of `object`.
  7410. *
  7411. * @static
  7412. * @memberOf _
  7413. * @since 4.0.0
  7414. * @category Object
  7415. * @param {Object} object The object to inspect.
  7416. * @returns {Array} Returns the function names.
  7417. * @see _.functions
  7418. * @example
  7419. *
  7420. * function Foo() {
  7421. * this.a = _.constant('a');
  7422. * this.b = _.constant('b');
  7423. * }
  7424. *
  7425. * Foo.prototype.c = _.constant('c');
  7426. *
  7427. * _.functionsIn(new Foo);
  7428. * // => ['a', 'b', 'c']
  7429. */function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object));}/**
  7430. * Gets the value at `path` of `object`. If the resolved value is
  7431. * `undefined`, the `defaultValue` is returned in its place.
  7432. *
  7433. * @static
  7434. * @memberOf _
  7435. * @since 3.7.0
  7436. * @category Object
  7437. * @param {Object} object The object to query.
  7438. * @param {Array|string} path The path of the property to get.
  7439. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  7440. * @returns {*} Returns the resolved value.
  7441. * @example
  7442. *
  7443. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  7444. *
  7445. * _.get(object, 'a[0].b.c');
  7446. * // => 3
  7447. *
  7448. * _.get(object, ['a', '0', 'b', 'c']);
  7449. * // => 3
  7450. *
  7451. * _.get(object, 'a.b.c', 'default');
  7452. * // => 'default'
  7453. */function get(object,path,defaultValue){var result=object==null?undefined$1:baseGet(object,path);return result===undefined$1?defaultValue:result;}/**
  7454. * Checks if `path` is a direct property of `object`.
  7455. *
  7456. * @static
  7457. * @since 0.1.0
  7458. * @memberOf _
  7459. * @category Object
  7460. * @param {Object} object The object to query.
  7461. * @param {Array|string} path The path to check.
  7462. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7463. * @example
  7464. *
  7465. * var object = { 'a': { 'b': 2 } };
  7466. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  7467. *
  7468. * _.has(object, 'a');
  7469. * // => true
  7470. *
  7471. * _.has(object, 'a.b');
  7472. * // => true
  7473. *
  7474. * _.has(object, ['a', 'b']);
  7475. * // => true
  7476. *
  7477. * _.has(other, 'a');
  7478. * // => false
  7479. */function has(object,path){return object!=null&&hasPath(object,path,baseHas);}/**
  7480. * Checks if `path` is a direct or inherited property of `object`.
  7481. *
  7482. * @static
  7483. * @memberOf _
  7484. * @since 4.0.0
  7485. * @category Object
  7486. * @param {Object} object The object to query.
  7487. * @param {Array|string} path The path to check.
  7488. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7489. * @example
  7490. *
  7491. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  7492. *
  7493. * _.hasIn(object, 'a');
  7494. * // => true
  7495. *
  7496. * _.hasIn(object, 'a.b');
  7497. * // => true
  7498. *
  7499. * _.hasIn(object, ['a', 'b']);
  7500. * // => true
  7501. *
  7502. * _.hasIn(object, 'b');
  7503. * // => false
  7504. */function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn);}/**
  7505. * Creates an object composed of the inverted keys and values of `object`.
  7506. * If `object` contains duplicate values, subsequent values overwrite
  7507. * property assignments of previous values.
  7508. *
  7509. * @static
  7510. * @memberOf _
  7511. * @since 0.7.0
  7512. * @category Object
  7513. * @param {Object} object The object to invert.
  7514. * @returns {Object} Returns the new inverted object.
  7515. * @example
  7516. *
  7517. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  7518. *
  7519. * _.invert(object);
  7520. * // => { '1': 'c', '2': 'b' }
  7521. */var invert=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!='function'){value=nativeObjectToString.call(value);}result[value]=key;},constant(identity));/**
  7522. * This method is like `_.invert` except that the inverted object is generated
  7523. * from the results of running each element of `object` thru `iteratee`. The
  7524. * corresponding inverted value of each inverted key is an array of keys
  7525. * responsible for generating the inverted value. The iteratee is invoked
  7526. * with one argument: (value).
  7527. *
  7528. * @static
  7529. * @memberOf _
  7530. * @since 4.1.0
  7531. * @category Object
  7532. * @param {Object} object The object to invert.
  7533. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7534. * @returns {Object} Returns the new inverted object.
  7535. * @example
  7536. *
  7537. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  7538. *
  7539. * _.invertBy(object);
  7540. * // => { '1': ['a', 'c'], '2': ['b'] }
  7541. *
  7542. * _.invertBy(object, function(value) {
  7543. * return 'group' + value;
  7544. * });
  7545. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  7546. */var invertBy=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!='function'){value=nativeObjectToString.call(value);}if(hasOwnProperty.call(result,value)){result[value].push(key);}else {result[value]=[key];}},getIteratee);/**
  7547. * Invokes the method at `path` of `object`.
  7548. *
  7549. * @static
  7550. * @memberOf _
  7551. * @since 4.0.0
  7552. * @category Object
  7553. * @param {Object} object The object to query.
  7554. * @param {Array|string} path The path of the method to invoke.
  7555. * @param {...*} [args] The arguments to invoke the method with.
  7556. * @returns {*} Returns the result of the invoked method.
  7557. * @example
  7558. *
  7559. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  7560. *
  7561. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  7562. * // => [2, 3]
  7563. */var invoke=baseRest(baseInvoke);/**
  7564. * Creates an array of the own enumerable property names of `object`.
  7565. *
  7566. * **Note:** Non-object values are coerced to objects. See the
  7567. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7568. * for more details.
  7569. *
  7570. * @static
  7571. * @since 0.1.0
  7572. * @memberOf _
  7573. * @category Object
  7574. * @param {Object} object The object to query.
  7575. * @returns {Array} Returns the array of property names.
  7576. * @example
  7577. *
  7578. * function Foo() {
  7579. * this.a = 1;
  7580. * this.b = 2;
  7581. * }
  7582. *
  7583. * Foo.prototype.c = 3;
  7584. *
  7585. * _.keys(new Foo);
  7586. * // => ['a', 'b'] (iteration order is not guaranteed)
  7587. *
  7588. * _.keys('hi');
  7589. * // => ['0', '1']
  7590. */function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object);}/**
  7591. * Creates an array of the own and inherited enumerable property names of `object`.
  7592. *
  7593. * **Note:** Non-object values are coerced to objects.
  7594. *
  7595. * @static
  7596. * @memberOf _
  7597. * @since 3.0.0
  7598. * @category Object
  7599. * @param {Object} object The object to query.
  7600. * @returns {Array} Returns the array of property names.
  7601. * @example
  7602. *
  7603. * function Foo() {
  7604. * this.a = 1;
  7605. * this.b = 2;
  7606. * }
  7607. *
  7608. * Foo.prototype.c = 3;
  7609. *
  7610. * _.keysIn(new Foo);
  7611. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  7612. */function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object);}/**
  7613. * The opposite of `_.mapValues`; this method creates an object with the
  7614. * same values as `object` and keys generated by running each own enumerable
  7615. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  7616. * with three arguments: (value, key, object).
  7617. *
  7618. * @static
  7619. * @memberOf _
  7620. * @since 3.8.0
  7621. * @category Object
  7622. * @param {Object} object The object to iterate over.
  7623. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7624. * @returns {Object} Returns the new mapped object.
  7625. * @see _.mapValues
  7626. * @example
  7627. *
  7628. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  7629. * return key + value;
  7630. * });
  7631. * // => { 'a1': 1, 'b2': 2 }
  7632. */function mapKeys(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value);});return result;}/**
  7633. * Creates an object with the same keys as `object` and values generated
  7634. * by running each own enumerable string keyed property of `object` thru
  7635. * `iteratee`. The iteratee is invoked with three arguments:
  7636. * (value, key, object).
  7637. *
  7638. * @static
  7639. * @memberOf _
  7640. * @since 2.4.0
  7641. * @category Object
  7642. * @param {Object} object The object to iterate over.
  7643. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7644. * @returns {Object} Returns the new mapped object.
  7645. * @see _.mapKeys
  7646. * @example
  7647. *
  7648. * var users = {
  7649. * 'fred': { 'user': 'fred', 'age': 40 },
  7650. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  7651. * };
  7652. *
  7653. * _.mapValues(users, function(o) { return o.age; });
  7654. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  7655. *
  7656. * // The `_.property` iteratee shorthand.
  7657. * _.mapValues(users, 'age');
  7658. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  7659. */function mapValues(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object));});return result;}/**
  7660. * This method is like `_.assign` except that it recursively merges own and
  7661. * inherited enumerable string keyed properties of source objects into the
  7662. * destination object. Source properties that resolve to `undefined` are
  7663. * skipped if a destination value exists. Array and plain object properties
  7664. * are merged recursively. Other objects and value types are overridden by
  7665. * assignment. Source objects are applied from left to right. Subsequent
  7666. * sources overwrite property assignments of previous sources.
  7667. *
  7668. * **Note:** This method mutates `object`.
  7669. *
  7670. * @static
  7671. * @memberOf _
  7672. * @since 0.5.0
  7673. * @category Object
  7674. * @param {Object} object The destination object.
  7675. * @param {...Object} [sources] The source objects.
  7676. * @returns {Object} Returns `object`.
  7677. * @example
  7678. *
  7679. * var object = {
  7680. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  7681. * };
  7682. *
  7683. * var other = {
  7684. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  7685. * };
  7686. *
  7687. * _.merge(object, other);
  7688. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  7689. */var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex);});/**
  7690. * This method is like `_.merge` except that it accepts `customizer` which
  7691. * is invoked to produce the merged values of the destination and source
  7692. * properties. If `customizer` returns `undefined`, merging is handled by the
  7693. * method instead. The `customizer` is invoked with six arguments:
  7694. * (objValue, srcValue, key, object, source, stack).
  7695. *
  7696. * **Note:** This method mutates `object`.
  7697. *
  7698. * @static
  7699. * @memberOf _
  7700. * @since 4.0.0
  7701. * @category Object
  7702. * @param {Object} object The destination object.
  7703. * @param {...Object} sources The source objects.
  7704. * @param {Function} customizer The function to customize assigned values.
  7705. * @returns {Object} Returns `object`.
  7706. * @example
  7707. *
  7708. * function customizer(objValue, srcValue) {
  7709. * if (_.isArray(objValue)) {
  7710. * return objValue.concat(srcValue);
  7711. * }
  7712. * }
  7713. *
  7714. * var object = { 'a': [1], 'b': [2] };
  7715. * var other = { 'a': [3], 'b': [4] };
  7716. *
  7717. * _.mergeWith(object, other, customizer);
  7718. * // => { 'a': [1, 3], 'b': [2, 4] }
  7719. */var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer);});/**
  7720. * The opposite of `_.pick`; this method creates an object composed of the
  7721. * own and inherited enumerable property paths of `object` that are not omitted.
  7722. *
  7723. * **Note:** This method is considerably slower than `_.pick`.
  7724. *
  7725. * @static
  7726. * @since 0.1.0
  7727. * @memberOf _
  7728. * @category Object
  7729. * @param {Object} object The source object.
  7730. * @param {...(string|string[])} [paths] The property paths to omit.
  7731. * @returns {Object} Returns the new object.
  7732. * @example
  7733. *
  7734. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  7735. *
  7736. * _.omit(object, ['a', 'c']);
  7737. * // => { 'b': '2' }
  7738. */var omit=flatRest(function(object,paths){var result={};if(object==null){return result;}var isDeep=false;paths=arrayMap(paths,function(path){path=castPath(path,object);isDeep||(isDeep=path.length>1);return path;});copyObject(object,getAllKeysIn(object),result);if(isDeep){result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone);}var length=paths.length;while(length--){baseUnset(result,paths[length]);}return result;});/**
  7739. * The opposite of `_.pickBy`; this method creates an object composed of
  7740. * the own and inherited enumerable string keyed properties of `object` that
  7741. * `predicate` doesn't return truthy for. The predicate is invoked with two
  7742. * arguments: (value, key).
  7743. *
  7744. * @static
  7745. * @memberOf _
  7746. * @since 4.0.0
  7747. * @category Object
  7748. * @param {Object} object The source object.
  7749. * @param {Function} [predicate=_.identity] The function invoked per property.
  7750. * @returns {Object} Returns the new object.
  7751. * @example
  7752. *
  7753. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  7754. *
  7755. * _.omitBy(object, _.isNumber);
  7756. * // => { 'b': '2' }
  7757. */function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)));}/**
  7758. * Creates an object composed of the picked `object` properties.
  7759. *
  7760. * @static
  7761. * @since 0.1.0
  7762. * @memberOf _
  7763. * @category Object
  7764. * @param {Object} object The source object.
  7765. * @param {...(string|string[])} [paths] The property paths to pick.
  7766. * @returns {Object} Returns the new object.
  7767. * @example
  7768. *
  7769. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  7770. *
  7771. * _.pick(object, ['a', 'c']);
  7772. * // => { 'a': 1, 'c': 3 }
  7773. */var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths);});/**
  7774. * Creates an object composed of the `object` properties `predicate` returns
  7775. * truthy for. The predicate is invoked with two arguments: (value, key).
  7776. *
  7777. * @static
  7778. * @memberOf _
  7779. * @since 4.0.0
  7780. * @category Object
  7781. * @param {Object} object The source object.
  7782. * @param {Function} [predicate=_.identity] The function invoked per property.
  7783. * @returns {Object} Returns the new object.
  7784. * @example
  7785. *
  7786. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  7787. *
  7788. * _.pickBy(object, _.isNumber);
  7789. * // => { 'a': 1, 'c': 3 }
  7790. */function pickBy(object,predicate){if(object==null){return {};}var props=arrayMap(getAllKeysIn(object),function(prop){return [prop];});predicate=getIteratee(predicate);return basePickBy(object,props,function(value,path){return predicate(value,path[0]);});}/**
  7791. * This method is like `_.get` except that if the resolved value is a
  7792. * function it's invoked with the `this` binding of its parent object and
  7793. * its result is returned.
  7794. *
  7795. * @static
  7796. * @since 0.1.0
  7797. * @memberOf _
  7798. * @category Object
  7799. * @param {Object} object The object to query.
  7800. * @param {Array|string} path The path of the property to resolve.
  7801. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  7802. * @returns {*} Returns the resolved value.
  7803. * @example
  7804. *
  7805. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  7806. *
  7807. * _.result(object, 'a[0].b.c1');
  7808. * // => 3
  7809. *
  7810. * _.result(object, 'a[0].b.c2');
  7811. * // => 4
  7812. *
  7813. * _.result(object, 'a[0].b.c3', 'default');
  7814. * // => 'default'
  7815. *
  7816. * _.result(object, 'a[0].b.c3', _.constant('default'));
  7817. * // => 'default'
  7818. */function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;// Ensure the loop is entered when path is empty.
  7819. if(!length){length=1;object=undefined$1;}while(++index<length){var value=object==null?undefined$1:object[toKey(path[index])];if(value===undefined$1){index=length;value=defaultValue;}object=isFunction(value)?value.call(object):value;}return object;}/**
  7820. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  7821. * it's created. Arrays are created for missing index properties while objects
  7822. * are created for all other missing properties. Use `_.setWith` to customize
  7823. * `path` creation.
  7824. *
  7825. * **Note:** This method mutates `object`.
  7826. *
  7827. * @static
  7828. * @memberOf _
  7829. * @since 3.7.0
  7830. * @category Object
  7831. * @param {Object} object The object to modify.
  7832. * @param {Array|string} path The path of the property to set.
  7833. * @param {*} value The value to set.
  7834. * @returns {Object} Returns `object`.
  7835. * @example
  7836. *
  7837. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  7838. *
  7839. * _.set(object, 'a[0].b.c', 4);
  7840. * console.log(object.a[0].b.c);
  7841. * // => 4
  7842. *
  7843. * _.set(object, ['x', '0', 'y', 'z'], 5);
  7844. * console.log(object.x[0].y.z);
  7845. * // => 5
  7846. */function set(object,path,value){return object==null?object:baseSet(object,path,value);}/**
  7847. * This method is like `_.set` except that it accepts `customizer` which is
  7848. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  7849. * path creation is handled by the method instead. The `customizer` is invoked
  7850. * with three arguments: (nsValue, key, nsObject).
  7851. *
  7852. * **Note:** This method mutates `object`.
  7853. *
  7854. * @static
  7855. * @memberOf _
  7856. * @since 4.0.0
  7857. * @category Object
  7858. * @param {Object} object The object to modify.
  7859. * @param {Array|string} path The path of the property to set.
  7860. * @param {*} value The value to set.
  7861. * @param {Function} [customizer] The function to customize assigned values.
  7862. * @returns {Object} Returns `object`.
  7863. * @example
  7864. *
  7865. * var object = {};
  7866. *
  7867. * _.setWith(object, '[0][1]', 'a', Object);
  7868. * // => { '0': { '1': 'a' } }
  7869. */function setWith(object,path,value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return object==null?object:baseSet(object,path,value,customizer);}/**
  7870. * Creates an array of own enumerable string keyed-value pairs for `object`
  7871. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  7872. * entries are returned.
  7873. *
  7874. * @static
  7875. * @memberOf _
  7876. * @since 4.0.0
  7877. * @alias entries
  7878. * @category Object
  7879. * @param {Object} object The object to query.
  7880. * @returns {Array} Returns the key-value pairs.
  7881. * @example
  7882. *
  7883. * function Foo() {
  7884. * this.a = 1;
  7885. * this.b = 2;
  7886. * }
  7887. *
  7888. * Foo.prototype.c = 3;
  7889. *
  7890. * _.toPairs(new Foo);
  7891. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  7892. */var toPairs=createToPairs(keys);/**
  7893. * Creates an array of own and inherited enumerable string keyed-value pairs
  7894. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  7895. * or set, its entries are returned.
  7896. *
  7897. * @static
  7898. * @memberOf _
  7899. * @since 4.0.0
  7900. * @alias entriesIn
  7901. * @category Object
  7902. * @param {Object} object The object to query.
  7903. * @returns {Array} Returns the key-value pairs.
  7904. * @example
  7905. *
  7906. * function Foo() {
  7907. * this.a = 1;
  7908. * this.b = 2;
  7909. * }
  7910. *
  7911. * Foo.prototype.c = 3;
  7912. *
  7913. * _.toPairsIn(new Foo);
  7914. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  7915. */var toPairsIn=createToPairs(keysIn);/**
  7916. * An alternative to `_.reduce`; this method transforms `object` to a new
  7917. * `accumulator` object which is the result of running each of its own
  7918. * enumerable string keyed properties thru `iteratee`, with each invocation
  7919. * potentially mutating the `accumulator` object. If `accumulator` is not
  7920. * provided, a new object with the same `[[Prototype]]` will be used. The
  7921. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  7922. * Iteratee functions may exit iteration early by explicitly returning `false`.
  7923. *
  7924. * @static
  7925. * @memberOf _
  7926. * @since 1.3.0
  7927. * @category Object
  7928. * @param {Object} object The object to iterate over.
  7929. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7930. * @param {*} [accumulator] The custom accumulator value.
  7931. * @returns {*} Returns the accumulated value.
  7932. * @example
  7933. *
  7934. * _.transform([2, 3, 4], function(result, n) {
  7935. * result.push(n *= n);
  7936. * return n % 2 == 0;
  7937. * }, []);
  7938. * // => [4, 9]
  7939. *
  7940. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  7941. * (result[value] || (result[value] = [])).push(key);
  7942. * }, {});
  7943. * // => { '1': ['a', 'c'], '2': ['b'] }
  7944. */function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);iteratee=getIteratee(iteratee,4);if(accumulator==null){var Ctor=object&&object.constructor;if(isArrLike){accumulator=isArr?new Ctor():[];}else if(isObject(object)){accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{};}else {accumulator={};}}(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object);});return accumulator;}/**
  7945. * Removes the property at `path` of `object`.
  7946. *
  7947. * **Note:** This method mutates `object`.
  7948. *
  7949. * @static
  7950. * @memberOf _
  7951. * @since 4.0.0
  7952. * @category Object
  7953. * @param {Object} object The object to modify.
  7954. * @param {Array|string} path The path of the property to unset.
  7955. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  7956. * @example
  7957. *
  7958. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  7959. * _.unset(object, 'a[0].b.c');
  7960. * // => true
  7961. *
  7962. * console.log(object);
  7963. * // => { 'a': [{ 'b': {} }] };
  7964. *
  7965. * _.unset(object, ['a', '0', 'b', 'c']);
  7966. * // => true
  7967. *
  7968. * console.log(object);
  7969. * // => { 'a': [{ 'b': {} }] };
  7970. */function unset(object,path){return object==null?true:baseUnset(object,path);}/**
  7971. * This method is like `_.set` except that accepts `updater` to produce the
  7972. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  7973. * is invoked with one argument: (value).
  7974. *
  7975. * **Note:** This method mutates `object`.
  7976. *
  7977. * @static
  7978. * @memberOf _
  7979. * @since 4.6.0
  7980. * @category Object
  7981. * @param {Object} object The object to modify.
  7982. * @param {Array|string} path The path of the property to set.
  7983. * @param {Function} updater The function to produce the updated value.
  7984. * @returns {Object} Returns `object`.
  7985. * @example
  7986. *
  7987. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  7988. *
  7989. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  7990. * console.log(object.a[0].b.c);
  7991. * // => 9
  7992. *
  7993. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  7994. * console.log(object.x[0].y.z);
  7995. * // => 0
  7996. */function update(object,path,updater){return object==null?object:baseUpdate(object,path,castFunction(updater));}/**
  7997. * This method is like `_.update` except that it accepts `customizer` which is
  7998. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  7999. * path creation is handled by the method instead. The `customizer` is invoked
  8000. * with three arguments: (nsValue, key, nsObject).
  8001. *
  8002. * **Note:** This method mutates `object`.
  8003. *
  8004. * @static
  8005. * @memberOf _
  8006. * @since 4.6.0
  8007. * @category Object
  8008. * @param {Object} object The object to modify.
  8009. * @param {Array|string} path The path of the property to set.
  8010. * @param {Function} updater The function to produce the updated value.
  8011. * @param {Function} [customizer] The function to customize assigned values.
  8012. * @returns {Object} Returns `object`.
  8013. * @example
  8014. *
  8015. * var object = {};
  8016. *
  8017. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  8018. * // => { '0': { '1': 'a' } }
  8019. */function updateWith(object,path,updater,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer);}/**
  8020. * Creates an array of the own enumerable string keyed property values of `object`.
  8021. *
  8022. * **Note:** Non-object values are coerced to objects.
  8023. *
  8024. * @static
  8025. * @since 0.1.0
  8026. * @memberOf _
  8027. * @category Object
  8028. * @param {Object} object The object to query.
  8029. * @returns {Array} Returns the array of property values.
  8030. * @example
  8031. *
  8032. * function Foo() {
  8033. * this.a = 1;
  8034. * this.b = 2;
  8035. * }
  8036. *
  8037. * Foo.prototype.c = 3;
  8038. *
  8039. * _.values(new Foo);
  8040. * // => [1, 2] (iteration order is not guaranteed)
  8041. *
  8042. * _.values('hi');
  8043. * // => ['h', 'i']
  8044. */function values(object){return object==null?[]:baseValues(object,keys(object));}/**
  8045. * Creates an array of the own and inherited enumerable string keyed property
  8046. * values of `object`.
  8047. *
  8048. * **Note:** Non-object values are coerced to objects.
  8049. *
  8050. * @static
  8051. * @memberOf _
  8052. * @since 3.0.0
  8053. * @category Object
  8054. * @param {Object} object The object to query.
  8055. * @returns {Array} Returns the array of property values.
  8056. * @example
  8057. *
  8058. * function Foo() {
  8059. * this.a = 1;
  8060. * this.b = 2;
  8061. * }
  8062. *
  8063. * Foo.prototype.c = 3;
  8064. *
  8065. * _.valuesIn(new Foo);
  8066. * // => [1, 2, 3] (iteration order is not guaranteed)
  8067. */function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object));}/*------------------------------------------------------------------------*/ /**
  8068. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  8069. *
  8070. * @static
  8071. * @memberOf _
  8072. * @since 4.0.0
  8073. * @category Number
  8074. * @param {number} number The number to clamp.
  8075. * @param {number} [lower] The lower bound.
  8076. * @param {number} upper The upper bound.
  8077. * @returns {number} Returns the clamped number.
  8078. * @example
  8079. *
  8080. * _.clamp(-10, -5, 5);
  8081. * // => -5
  8082. *
  8083. * _.clamp(10, -5, 5);
  8084. * // => 5
  8085. */function clamp(number,lower,upper){if(upper===undefined$1){upper=lower;lower=undefined$1;}if(upper!==undefined$1){upper=toNumber(upper);upper=upper===upper?upper:0;}if(lower!==undefined$1){lower=toNumber(lower);lower=lower===lower?lower:0;}return baseClamp(toNumber(number),lower,upper);}/**
  8086. * Checks if `n` is between `start` and up to, but not including, `end`. If
  8087. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  8088. * If `start` is greater than `end` the params are swapped to support
  8089. * negative ranges.
  8090. *
  8091. * @static
  8092. * @memberOf _
  8093. * @since 3.3.0
  8094. * @category Number
  8095. * @param {number} number The number to check.
  8096. * @param {number} [start=0] The start of the range.
  8097. * @param {number} end The end of the range.
  8098. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  8099. * @see _.range, _.rangeRight
  8100. * @example
  8101. *
  8102. * _.inRange(3, 2, 4);
  8103. * // => true
  8104. *
  8105. * _.inRange(4, 8);
  8106. * // => true
  8107. *
  8108. * _.inRange(4, 2);
  8109. * // => false
  8110. *
  8111. * _.inRange(2, 2);
  8112. * // => false
  8113. *
  8114. * _.inRange(1.2, 2);
  8115. * // => true
  8116. *
  8117. * _.inRange(5.2, 4);
  8118. * // => false
  8119. *
  8120. * _.inRange(-3, -2, -6);
  8121. * // => true
  8122. */function inRange(number,start,end){start=toFinite(start);if(end===undefined$1){end=start;start=0;}else {end=toFinite(end);}number=toNumber(number);return baseInRange(number,start,end);}/**
  8123. * Produces a random number between the inclusive `lower` and `upper` bounds.
  8124. * If only one argument is provided a number between `0` and the given number
  8125. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  8126. * floats, a floating-point number is returned instead of an integer.
  8127. *
  8128. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  8129. * floating-point values which can produce unexpected results.
  8130. *
  8131. * @static
  8132. * @memberOf _
  8133. * @since 0.7.0
  8134. * @category Number
  8135. * @param {number} [lower=0] The lower bound.
  8136. * @param {number} [upper=1] The upper bound.
  8137. * @param {boolean} [floating] Specify returning a floating-point number.
  8138. * @returns {number} Returns the random number.
  8139. * @example
  8140. *
  8141. * _.random(0, 5);
  8142. * // => an integer between 0 and 5
  8143. *
  8144. * _.random(5);
  8145. * // => also an integer between 0 and 5
  8146. *
  8147. * _.random(5, true);
  8148. * // => a floating-point number between 0 and 5
  8149. *
  8150. * _.random(1.2, 5.2);
  8151. * // => a floating-point number between 1.2 and 5.2
  8152. */function random(lower,upper,floating){if(floating&&typeof floating!='boolean'&&isIterateeCall(lower,upper,floating)){upper=floating=undefined$1;}if(floating===undefined$1){if(typeof upper=='boolean'){floating=upper;upper=undefined$1;}else if(typeof lower=='boolean'){floating=lower;lower=undefined$1;}}if(lower===undefined$1&&upper===undefined$1){lower=0;upper=1;}else {lower=toFinite(lower);if(upper===undefined$1){upper=lower;lower=0;}else {upper=toFinite(upper);}}if(lower>upper){var temp=lower;lower=upper;upper=temp;}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat('1e-'+((rand+'').length-1))),upper);}return baseRandom(lower,upper);}/*------------------------------------------------------------------------*/ /**
  8153. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8154. *
  8155. * @static
  8156. * @memberOf _
  8157. * @since 3.0.0
  8158. * @category String
  8159. * @param {string} [string=''] The string to convert.
  8160. * @returns {string} Returns the camel cased string.
  8161. * @example
  8162. *
  8163. * _.camelCase('Foo Bar');
  8164. * // => 'fooBar'
  8165. *
  8166. * _.camelCase('--foo-bar--');
  8167. * // => 'fooBar'
  8168. *
  8169. * _.camelCase('__FOO_BAR__');
  8170. * // => 'fooBar'
  8171. */var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word);});/**
  8172. * Converts the first character of `string` to upper case and the remaining
  8173. * to lower case.
  8174. *
  8175. * @static
  8176. * @memberOf _
  8177. * @since 3.0.0
  8178. * @category String
  8179. * @param {string} [string=''] The string to capitalize.
  8180. * @returns {string} Returns the capitalized string.
  8181. * @example
  8182. *
  8183. * _.capitalize('FRED');
  8184. * // => 'Fred'
  8185. */function capitalize(string){return upperFirst(toString(string).toLowerCase());}/**
  8186. * Deburrs `string` by converting
  8187. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8188. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8189. * letters to basic Latin letters and removing
  8190. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8191. *
  8192. * @static
  8193. * @memberOf _
  8194. * @since 3.0.0
  8195. * @category String
  8196. * @param {string} [string=''] The string to deburr.
  8197. * @returns {string} Returns the deburred string.
  8198. * @example
  8199. *
  8200. * _.deburr('déjà vu');
  8201. * // => 'deja vu'
  8202. */function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,'');}/**
  8203. * Checks if `string` ends with the given target string.
  8204. *
  8205. * @static
  8206. * @memberOf _
  8207. * @since 3.0.0
  8208. * @category String
  8209. * @param {string} [string=''] The string to inspect.
  8210. * @param {string} [target] The string to search for.
  8211. * @param {number} [position=string.length] The position to search up to.
  8212. * @returns {boolean} Returns `true` if `string` ends with `target`,
  8213. * else `false`.
  8214. * @example
  8215. *
  8216. * _.endsWith('abc', 'c');
  8217. * // => true
  8218. *
  8219. * _.endsWith('abc', 'b');
  8220. * // => false
  8221. *
  8222. * _.endsWith('abc', 'b', 2);
  8223. * // => true
  8224. */function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined$1?length:baseClamp(toInteger(position),0,length);var end=position;position-=target.length;return position>=0&&string.slice(position,end)==target;}/**
  8225. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  8226. * corresponding HTML entities.
  8227. *
  8228. * **Note:** No other characters are escaped. To escape additional
  8229. * characters use a third-party library like [_he_](https://mths.be/he).
  8230. *
  8231. * Though the ">" character is escaped for symmetry, characters like
  8232. * ">" and "/" don't need escaping in HTML and have no special meaning
  8233. * unless they're part of a tag or unquoted attribute value. See
  8234. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  8235. * (under "semi-related fun fact") for more details.
  8236. *
  8237. * When working with HTML you should always
  8238. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  8239. * XSS vectors.
  8240. *
  8241. * @static
  8242. * @since 0.1.0
  8243. * @memberOf _
  8244. * @category String
  8245. * @param {string} [string=''] The string to escape.
  8246. * @returns {string} Returns the escaped string.
  8247. * @example
  8248. *
  8249. * _.escape('fred, barney, & pebbles');
  8250. * // => 'fred, barney, &amp; pebbles'
  8251. */function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string;}/**
  8252. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  8253. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  8254. *
  8255. * @static
  8256. * @memberOf _
  8257. * @since 3.0.0
  8258. * @category String
  8259. * @param {string} [string=''] The string to escape.
  8260. * @returns {string} Returns the escaped string.
  8261. * @example
  8262. *
  8263. * _.escapeRegExp('[lodash](https://lodash.com/)');
  8264. * // => '\[lodash\]\(https://lodash\.com/\)'
  8265. */function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,'\\$&'):string;}/**
  8266. * Converts `string` to
  8267. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  8268. *
  8269. * @static
  8270. * @memberOf _
  8271. * @since 3.0.0
  8272. * @category String
  8273. * @param {string} [string=''] The string to convert.
  8274. * @returns {string} Returns the kebab cased string.
  8275. * @example
  8276. *
  8277. * _.kebabCase('Foo Bar');
  8278. * // => 'foo-bar'
  8279. *
  8280. * _.kebabCase('fooBar');
  8281. * // => 'foo-bar'
  8282. *
  8283. * _.kebabCase('__FOO_BAR__');
  8284. * // => 'foo-bar'
  8285. */var kebabCase=createCompounder(function(result,word,index){return result+(index?'-':'')+word.toLowerCase();});/**
  8286. * Converts `string`, as space separated words, to lower case.
  8287. *
  8288. * @static
  8289. * @memberOf _
  8290. * @since 4.0.0
  8291. * @category String
  8292. * @param {string} [string=''] The string to convert.
  8293. * @returns {string} Returns the lower cased string.
  8294. * @example
  8295. *
  8296. * _.lowerCase('--Foo-Bar--');
  8297. * // => 'foo bar'
  8298. *
  8299. * _.lowerCase('fooBar');
  8300. * // => 'foo bar'
  8301. *
  8302. * _.lowerCase('__FOO_BAR__');
  8303. * // => 'foo bar'
  8304. */var lowerCase=createCompounder(function(result,word,index){return result+(index?' ':'')+word.toLowerCase();});/**
  8305. * Converts the first character of `string` to lower case.
  8306. *
  8307. * @static
  8308. * @memberOf _
  8309. * @since 4.0.0
  8310. * @category String
  8311. * @param {string} [string=''] The string to convert.
  8312. * @returns {string} Returns the converted string.
  8313. * @example
  8314. *
  8315. * _.lowerFirst('Fred');
  8316. * // => 'fred'
  8317. *
  8318. * _.lowerFirst('FRED');
  8319. * // => 'fRED'
  8320. */var lowerFirst=createCaseFirst('toLowerCase');/**
  8321. * Pads `string` on the left and right sides if it's shorter than `length`.
  8322. * Padding characters are truncated if they can't be evenly divided by `length`.
  8323. *
  8324. * @static
  8325. * @memberOf _
  8326. * @since 3.0.0
  8327. * @category String
  8328. * @param {string} [string=''] The string to pad.
  8329. * @param {number} [length=0] The padding length.
  8330. * @param {string} [chars=' '] The string used as padding.
  8331. * @returns {string} Returns the padded string.
  8332. * @example
  8333. *
  8334. * _.pad('abc', 8);
  8335. * // => ' abc '
  8336. *
  8337. * _.pad('abc', 8, '_-');
  8338. * // => '_-abc_-_'
  8339. *
  8340. * _.pad('abc', 3);
  8341. * // => 'abc'
  8342. */function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length){return string;}var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars);}/**
  8343. * Pads `string` on the right side if it's shorter than `length`. Padding
  8344. * characters are truncated if they exceed `length`.
  8345. *
  8346. * @static
  8347. * @memberOf _
  8348. * @since 4.0.0
  8349. * @category String
  8350. * @param {string} [string=''] The string to pad.
  8351. * @param {number} [length=0] The padding length.
  8352. * @param {string} [chars=' '] The string used as padding.
  8353. * @returns {string} Returns the padded string.
  8354. * @example
  8355. *
  8356. * _.padEnd('abc', 6);
  8357. * // => 'abc '
  8358. *
  8359. * _.padEnd('abc', 6, '_-');
  8360. * // => 'abc_-_'
  8361. *
  8362. * _.padEnd('abc', 3);
  8363. * // => 'abc'
  8364. */function padEnd(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?string+createPadding(length-strLength,chars):string;}/**
  8365. * Pads `string` on the left side if it's shorter than `length`. Padding
  8366. * characters are truncated if they exceed `length`.
  8367. *
  8368. * @static
  8369. * @memberOf _
  8370. * @since 4.0.0
  8371. * @category String
  8372. * @param {string} [string=''] The string to pad.
  8373. * @param {number} [length=0] The padding length.
  8374. * @param {string} [chars=' '] The string used as padding.
  8375. * @returns {string} Returns the padded string.
  8376. * @example
  8377. *
  8378. * _.padStart('abc', 6);
  8379. * // => ' abc'
  8380. *
  8381. * _.padStart('abc', 6, '_-');
  8382. * // => '_-_abc'
  8383. *
  8384. * _.padStart('abc', 3);
  8385. * // => 'abc'
  8386. */function padStart(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?createPadding(length-strLength,chars)+string:string;}/**
  8387. * Converts `string` to an integer of the specified radix. If `radix` is
  8388. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  8389. * hexadecimal, in which case a `radix` of `16` is used.
  8390. *
  8391. * **Note:** This method aligns with the
  8392. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  8393. *
  8394. * @static
  8395. * @memberOf _
  8396. * @since 1.1.0
  8397. * @category String
  8398. * @param {string} string The string to convert.
  8399. * @param {number} [radix=10] The radix to interpret `value` by.
  8400. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8401. * @returns {number} Returns the converted integer.
  8402. * @example
  8403. *
  8404. * _.parseInt('08');
  8405. * // => 8
  8406. *
  8407. * _.map(['6', '08', '10'], _.parseInt);
  8408. * // => [6, 8, 10]
  8409. */function parseInt(string,radix,guard){if(guard||radix==null){radix=0;}else if(radix){radix=+radix;}return nativeParseInt(toString(string).replace(reTrimStart,''),radix||0);}/**
  8410. * Repeats the given string `n` times.
  8411. *
  8412. * @static
  8413. * @memberOf _
  8414. * @since 3.0.0
  8415. * @category String
  8416. * @param {string} [string=''] The string to repeat.
  8417. * @param {number} [n=1] The number of times to repeat the string.
  8418. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8419. * @returns {string} Returns the repeated string.
  8420. * @example
  8421. *
  8422. * _.repeat('*', 3);
  8423. * // => '***'
  8424. *
  8425. * _.repeat('abc', 2);
  8426. * // => 'abcabc'
  8427. *
  8428. * _.repeat('abc', 0);
  8429. * // => ''
  8430. */function repeat(string,n,guard){if(guard?isIterateeCall(string,n,guard):n===undefined$1){n=1;}else {n=toInteger(n);}return baseRepeat(toString(string),n);}/**
  8431. * Replaces matches for `pattern` in `string` with `replacement`.
  8432. *
  8433. * **Note:** This method is based on
  8434. * [`String#replace`](https://mdn.io/String/replace).
  8435. *
  8436. * @static
  8437. * @memberOf _
  8438. * @since 4.0.0
  8439. * @category String
  8440. * @param {string} [string=''] The string to modify.
  8441. * @param {RegExp|string} pattern The pattern to replace.
  8442. * @param {Function|string} replacement The match replacement.
  8443. * @returns {string} Returns the modified string.
  8444. * @example
  8445. *
  8446. * _.replace('Hi Fred', 'Fred', 'Barney');
  8447. * // => 'Hi Barney'
  8448. */function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:string.replace(args[1],args[2]);}/**
  8449. * Converts `string` to
  8450. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  8451. *
  8452. * @static
  8453. * @memberOf _
  8454. * @since 3.0.0
  8455. * @category String
  8456. * @param {string} [string=''] The string to convert.
  8457. * @returns {string} Returns the snake cased string.
  8458. * @example
  8459. *
  8460. * _.snakeCase('Foo Bar');
  8461. * // => 'foo_bar'
  8462. *
  8463. * _.snakeCase('fooBar');
  8464. * // => 'foo_bar'
  8465. *
  8466. * _.snakeCase('--FOO-BAR--');
  8467. * // => 'foo_bar'
  8468. */var snakeCase=createCompounder(function(result,word,index){return result+(index?'_':'')+word.toLowerCase();});/**
  8469. * Splits `string` by `separator`.
  8470. *
  8471. * **Note:** This method is based on
  8472. * [`String#split`](https://mdn.io/String/split).
  8473. *
  8474. * @static
  8475. * @memberOf _
  8476. * @since 4.0.0
  8477. * @category String
  8478. * @param {string} [string=''] The string to split.
  8479. * @param {RegExp|string} separator The separator pattern to split by.
  8480. * @param {number} [limit] The length to truncate results to.
  8481. * @returns {Array} Returns the string segments.
  8482. * @example
  8483. *
  8484. * _.split('a-b-c', '-', 2);
  8485. * // => ['a', 'b']
  8486. */function split(string,separator,limit){if(limit&&typeof limit!='number'&&isIterateeCall(string,separator,limit)){separator=limit=undefined$1;}limit=limit===undefined$1?MAX_ARRAY_LENGTH:limit>>>0;if(!limit){return [];}string=toString(string);if(string&&(typeof separator=='string'||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(!separator&&hasUnicode(string)){return castSlice(stringToArray(string),0,limit);}}return string.split(separator,limit);}/**
  8487. * Converts `string` to
  8488. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  8489. *
  8490. * @static
  8491. * @memberOf _
  8492. * @since 3.1.0
  8493. * @category String
  8494. * @param {string} [string=''] The string to convert.
  8495. * @returns {string} Returns the start cased string.
  8496. * @example
  8497. *
  8498. * _.startCase('--foo-bar--');
  8499. * // => 'Foo Bar'
  8500. *
  8501. * _.startCase('fooBar');
  8502. * // => 'Foo Bar'
  8503. *
  8504. * _.startCase('__FOO_BAR__');
  8505. * // => 'FOO BAR'
  8506. */var startCase=createCompounder(function(result,word,index){return result+(index?' ':'')+upperFirst(word);});/**
  8507. * Checks if `string` starts with the given target string.
  8508. *
  8509. * @static
  8510. * @memberOf _
  8511. * @since 3.0.0
  8512. * @category String
  8513. * @param {string} [string=''] The string to inspect.
  8514. * @param {string} [target] The string to search for.
  8515. * @param {number} [position=0] The position to search from.
  8516. * @returns {boolean} Returns `true` if `string` starts with `target`,
  8517. * else `false`.
  8518. * @example
  8519. *
  8520. * _.startsWith('abc', 'a');
  8521. * // => true
  8522. *
  8523. * _.startsWith('abc', 'b');
  8524. * // => false
  8525. *
  8526. * _.startsWith('abc', 'b', 1);
  8527. * // => true
  8528. */function startsWith(string,target,position){string=toString(string);position=position==null?0:baseClamp(toInteger(position),0,string.length);target=baseToString(target);return string.slice(position,position+target.length)==target;}/**
  8529. * Creates a compiled template function that can interpolate data properties
  8530. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  8531. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  8532. * properties may be accessed as free variables in the template. If a setting
  8533. * object is given, it takes precedence over `_.templateSettings` values.
  8534. *
  8535. * **Note:** In the development build `_.template` utilizes
  8536. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  8537. * for easier debugging.
  8538. *
  8539. * For more information on precompiling templates see
  8540. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  8541. *
  8542. * For more information on Chrome extension sandboxes see
  8543. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  8544. *
  8545. * @static
  8546. * @since 0.1.0
  8547. * @memberOf _
  8548. * @category String
  8549. * @param {string} [string=''] The template string.
  8550. * @param {Object} [options={}] The options object.
  8551. * @param {RegExp} [options.escape=_.templateSettings.escape]
  8552. * The HTML "escape" delimiter.
  8553. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  8554. * The "evaluate" delimiter.
  8555. * @param {Object} [options.imports=_.templateSettings.imports]
  8556. * An object to import into the template as free variables.
  8557. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  8558. * The "interpolate" delimiter.
  8559. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  8560. * The sourceURL of the compiled template.
  8561. * @param {string} [options.variable='obj']
  8562. * The data object variable name.
  8563. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8564. * @returns {Function} Returns the compiled template function.
  8565. * @example
  8566. *
  8567. * // Use the "interpolate" delimiter to create a compiled template.
  8568. * var compiled = _.template('hello <%= user %>!');
  8569. * compiled({ 'user': 'fred' });
  8570. * // => 'hello fred!'
  8571. *
  8572. * // Use the HTML "escape" delimiter to escape data property values.
  8573. * var compiled = _.template('<b><%- value %></b>');
  8574. * compiled({ 'value': '<script>' });
  8575. * // => '<b>&lt;script&gt;</b>'
  8576. *
  8577. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  8578. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  8579. * compiled({ 'users': ['fred', 'barney'] });
  8580. * // => '<li>fred</li><li>barney</li>'
  8581. *
  8582. * // Use the internal `print` function in "evaluate" delimiters.
  8583. * var compiled = _.template('<% print("hello " + user); %>!');
  8584. * compiled({ 'user': 'barney' });
  8585. * // => 'hello barney!'
  8586. *
  8587. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  8588. * // Disable support by replacing the "interpolate" delimiter.
  8589. * var compiled = _.template('hello ${ user }!');
  8590. * compiled({ 'user': 'pebbles' });
  8591. * // => 'hello pebbles!'
  8592. *
  8593. * // Use backslashes to treat delimiters as plain text.
  8594. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  8595. * compiled({ 'value': 'ignored' });
  8596. * // => '<%- value %>'
  8597. *
  8598. * // Use the `imports` option to import `jQuery` as `jq`.
  8599. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  8600. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  8601. * compiled({ 'users': ['fred', 'barney'] });
  8602. * // => '<li>fred</li><li>barney</li>'
  8603. *
  8604. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  8605. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  8606. * compiled(data);
  8607. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  8608. *
  8609. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  8610. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  8611. * compiled.source;
  8612. * // => function(data) {
  8613. * // var __t, __p = '';
  8614. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  8615. * // return __p;
  8616. * // }
  8617. *
  8618. * // Use custom template delimiters.
  8619. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  8620. * var compiled = _.template('hello {{ user }}!');
  8621. * compiled({ 'user': 'mustache' });
  8622. * // => 'hello mustache!'
  8623. *
  8624. * // Use the `source` property to inline compiled templates for meaningful
  8625. * // line numbers in error messages and stack traces.
  8626. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  8627. * var JST = {\
  8628. * "main": ' + _.template(mainText).source + '\
  8629. * };\
  8630. * ');
  8631. */function template(string,options,guard){// Based on John Resig's `tmpl` implementation
  8632. // (http://ejohn.org/blog/javascript-micro-templating/)
  8633. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  8634. var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard)){options=undefined$1;}string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";// Compile the regexp to match each delimiter.
  8635. var reDelimiters=RegExp((options.escape||reNoMatch).source+'|'+interpolate.source+'|'+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+'|'+(options.evaluate||reNoMatch).source+'|$','g');// Use a sourceURL for easier debugging.
  8636. // The sourceURL gets injected into the source that's eval-ed, so be careful
  8637. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  8638. // and escape the comment, thus injecting code that gets evaled.
  8639. var sourceURL='//# sourceURL='+(hasOwnProperty.call(options,'sourceURL')?(options.sourceURL+'').replace(/\s/g,' '):'lodash.templateSources['+ ++templateCounter+']')+'\n';string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);// Escape characters that can't be included in string literals.
  8640. source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);// Replace delimiters with snippets.
  8641. if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'";}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '";}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'";}index=offset+match.length;// The JS engine embedded in Adobe products needs `match` returned in
  8642. // order to produce the correct `offset` value.
  8643. return match;});source+="';\n";// If `variable` is not specified wrap a with-statement around the generated
  8644. // code to add the data object to the top of the scope chain.
  8645. var variable=hasOwnProperty.call(options,'variable')&&options.variable;if(!variable){source='with (obj) {\n'+source+'\n}\n';}// Throw an error if a forbidden character was found in `variable`, to prevent
  8646. // potential command injection attacks.
  8647. else if(reForbiddenIdentifierChars.test(variable)){throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);}// Cleanup code by stripping empty strings.
  8648. source=(isEvaluating?source.replace(reEmptyStringLeading,''):source).replace(reEmptyStringMiddle,'$1').replace(reEmptyStringTrailing,'$1;');// Frame code as the function body.
  8649. source='function('+(variable||'obj')+') {\n'+(variable?'':'obj || (obj = {});\n')+"var __t, __p = ''"+(isEscaping?', __e = _.escape':'')+(isEvaluating?', __j = Array.prototype.join;\n'+"function print() { __p += __j.call(arguments, '') }\n":';\n')+source+'return __p\n}';var result=attempt(function(){return Function(importsKeys,sourceURL+'return '+source).apply(undefined$1,importsValues);});// Provide the compiled function's source by its `toString` method or
  8650. // the `source` property as a convenience for inlining compiled templates.
  8651. result.source=source;if(isError(result)){throw result;}return result;}/**
  8652. * Converts `string`, as a whole, to lower case just like
  8653. * [String#toLowerCase](https://mdn.io/toLowerCase).
  8654. *
  8655. * @static
  8656. * @memberOf _
  8657. * @since 4.0.0
  8658. * @category String
  8659. * @param {string} [string=''] The string to convert.
  8660. * @returns {string} Returns the lower cased string.
  8661. * @example
  8662. *
  8663. * _.toLower('--Foo-Bar--');
  8664. * // => '--foo-bar--'
  8665. *
  8666. * _.toLower('fooBar');
  8667. * // => 'foobar'
  8668. *
  8669. * _.toLower('__FOO_BAR__');
  8670. * // => '__foo_bar__'
  8671. */function toLower(value){return toString(value).toLowerCase();}/**
  8672. * Converts `string`, as a whole, to upper case just like
  8673. * [String#toUpperCase](https://mdn.io/toUpperCase).
  8674. *
  8675. * @static
  8676. * @memberOf _
  8677. * @since 4.0.0
  8678. * @category String
  8679. * @param {string} [string=''] The string to convert.
  8680. * @returns {string} Returns the upper cased string.
  8681. * @example
  8682. *
  8683. * _.toUpper('--foo-bar--');
  8684. * // => '--FOO-BAR--'
  8685. *
  8686. * _.toUpper('fooBar');
  8687. * // => 'FOOBAR'
  8688. *
  8689. * _.toUpper('__foo_bar__');
  8690. * // => '__FOO_BAR__'
  8691. */function toUpper(value){return toString(value).toUpperCase();}/**
  8692. * Removes leading and trailing whitespace or specified characters from `string`.
  8693. *
  8694. * @static
  8695. * @memberOf _
  8696. * @since 3.0.0
  8697. * @category String
  8698. * @param {string} [string=''] The string to trim.
  8699. * @param {string} [chars=whitespace] The characters to trim.
  8700. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8701. * @returns {string} Returns the trimmed string.
  8702. * @example
  8703. *
  8704. * _.trim(' abc ');
  8705. * // => 'abc'
  8706. *
  8707. * _.trim('-_-abc-_-', '_-');
  8708. * // => 'abc'
  8709. *
  8710. * _.map([' foo ', ' bar '], _.trim);
  8711. * // => ['foo', 'bar']
  8712. */function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return baseTrim(string);}if(!string||!(chars=baseToString(chars))){return string;}var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join('');}/**
  8713. * Removes trailing whitespace or specified characters from `string`.
  8714. *
  8715. * @static
  8716. * @memberOf _
  8717. * @since 4.0.0
  8718. * @category String
  8719. * @param {string} [string=''] The string to trim.
  8720. * @param {string} [chars=whitespace] The characters to trim.
  8721. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8722. * @returns {string} Returns the trimmed string.
  8723. * @example
  8724. *
  8725. * _.trimEnd(' abc ');
  8726. * // => ' abc'
  8727. *
  8728. * _.trimEnd('-_-abc-_-', '_-');
  8729. * // => '-_-abc'
  8730. */function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return string.slice(0,trimmedEndIndex(string)+1);}if(!string||!(chars=baseToString(chars))){return string;}var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,0,end).join('');}/**
  8731. * Removes leading whitespace or specified characters from `string`.
  8732. *
  8733. * @static
  8734. * @memberOf _
  8735. * @since 4.0.0
  8736. * @category String
  8737. * @param {string} [string=''] The string to trim.
  8738. * @param {string} [chars=whitespace] The characters to trim.
  8739. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8740. * @returns {string} Returns the trimmed string.
  8741. * @example
  8742. *
  8743. * _.trimStart(' abc ');
  8744. * // => 'abc '
  8745. *
  8746. * _.trimStart('-_-abc-_-', '_-');
  8747. * // => 'abc-_-'
  8748. */function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return string.replace(reTrimStart,'');}if(!string||!(chars=baseToString(chars))){return string;}var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join('');}/**
  8749. * Truncates `string` if it's longer than the given maximum string length.
  8750. * The last characters of the truncated string are replaced with the omission
  8751. * string which defaults to "...".
  8752. *
  8753. * @static
  8754. * @memberOf _
  8755. * @since 4.0.0
  8756. * @category String
  8757. * @param {string} [string=''] The string to truncate.
  8758. * @param {Object} [options={}] The options object.
  8759. * @param {number} [options.length=30] The maximum string length.
  8760. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  8761. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  8762. * @returns {string} Returns the truncated string.
  8763. * @example
  8764. *
  8765. * _.truncate('hi-diddly-ho there, neighborino');
  8766. * // => 'hi-diddly-ho there, neighbo...'
  8767. *
  8768. * _.truncate('hi-diddly-ho there, neighborino', {
  8769. * 'length': 24,
  8770. * 'separator': ' '
  8771. * });
  8772. * // => 'hi-diddly-ho there,...'
  8773. *
  8774. * _.truncate('hi-diddly-ho there, neighborino', {
  8775. * 'length': 24,
  8776. * 'separator': /,? +/
  8777. * });
  8778. * // => 'hi-diddly-ho there...'
  8779. *
  8780. * _.truncate('hi-diddly-ho there, neighborino', {
  8781. * 'omission': ' [...]'
  8782. * });
  8783. * // => 'hi-diddly-ho there, neig [...]'
  8784. */function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator='separator'in options?options.separator:separator;length='length'in options?toInteger(options.length):length;omission='omission'in options?baseToString(options.omission):omission;}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length;}if(length>=strLength){return string;}var end=length-stringSize(omission);if(end<1){return omission;}var result=strSymbols?castSlice(strSymbols,0,end).join(''):string.slice(0,end);if(separator===undefined$1){return result+omission;}if(strSymbols){end+=result.length-end;}if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global){separator=RegExp(separator.source,toString(reFlags.exec(separator))+'g');}separator.lastIndex=0;while(match=separator.exec(substring)){var newEnd=match.index;}result=result.slice(0,newEnd===undefined$1?end:newEnd);}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1){result=result.slice(0,index);}}return result+omission;}/**
  8785. * The inverse of `_.escape`; this method converts the HTML entities
  8786. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  8787. * their corresponding characters.
  8788. *
  8789. * **Note:** No other HTML entities are unescaped. To unescape additional
  8790. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  8791. *
  8792. * @static
  8793. * @memberOf _
  8794. * @since 0.6.0
  8795. * @category String
  8796. * @param {string} [string=''] The string to unescape.
  8797. * @returns {string} Returns the unescaped string.
  8798. * @example
  8799. *
  8800. * _.unescape('fred, barney, &amp; pebbles');
  8801. * // => 'fred, barney, & pebbles'
  8802. */function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string;}/**
  8803. * Converts `string`, as space separated words, to upper case.
  8804. *
  8805. * @static
  8806. * @memberOf _
  8807. * @since 4.0.0
  8808. * @category String
  8809. * @param {string} [string=''] The string to convert.
  8810. * @returns {string} Returns the upper cased string.
  8811. * @example
  8812. *
  8813. * _.upperCase('--foo-bar');
  8814. * // => 'FOO BAR'
  8815. *
  8816. * _.upperCase('fooBar');
  8817. * // => 'FOO BAR'
  8818. *
  8819. * _.upperCase('__foo_bar__');
  8820. * // => 'FOO BAR'
  8821. */var upperCase=createCompounder(function(result,word,index){return result+(index?' ':'')+word.toUpperCase();});/**
  8822. * Converts the first character of `string` to upper case.
  8823. *
  8824. * @static
  8825. * @memberOf _
  8826. * @since 4.0.0
  8827. * @category String
  8828. * @param {string} [string=''] The string to convert.
  8829. * @returns {string} Returns the converted string.
  8830. * @example
  8831. *
  8832. * _.upperFirst('fred');
  8833. * // => 'Fred'
  8834. *
  8835. * _.upperFirst('FRED');
  8836. * // => 'FRED'
  8837. */var upperFirst=createCaseFirst('toUpperCase');/**
  8838. * Splits `string` into an array of its words.
  8839. *
  8840. * @static
  8841. * @memberOf _
  8842. * @since 3.0.0
  8843. * @category String
  8844. * @param {string} [string=''] The string to inspect.
  8845. * @param {RegExp|string} [pattern] The pattern to match words.
  8846. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8847. * @returns {Array} Returns the words of `string`.
  8848. * @example
  8849. *
  8850. * _.words('fred, barney, & pebbles');
  8851. * // => ['fred', 'barney', 'pebbles']
  8852. *
  8853. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  8854. * // => ['fred', 'barney', '&', 'pebbles']
  8855. */function words(string,pattern,guard){string=toString(string);pattern=guard?undefined$1:pattern;if(pattern===undefined$1){return hasUnicodeWord(string)?unicodeWords(string):asciiWords(string);}return string.match(pattern)||[];}/*------------------------------------------------------------------------*/ /**
  8856. * Attempts to invoke `func`, returning either the result or the caught error
  8857. * object. Any additional arguments are provided to `func` when it's invoked.
  8858. *
  8859. * @static
  8860. * @memberOf _
  8861. * @since 3.0.0
  8862. * @category Util
  8863. * @param {Function} func The function to attempt.
  8864. * @param {...*} [args] The arguments to invoke `func` with.
  8865. * @returns {*} Returns the `func` result or error object.
  8866. * @example
  8867. *
  8868. * // Avoid throwing errors for invalid selectors.
  8869. * var elements = _.attempt(function(selector) {
  8870. * return document.querySelectorAll(selector);
  8871. * }, '>_>');
  8872. *
  8873. * if (_.isError(elements)) {
  8874. * elements = [];
  8875. * }
  8876. */var attempt=baseRest(function(func,args){try{return apply(func,undefined$1,args);}catch(e){return isError(e)?e:new Error(e);}});/**
  8877. * Binds methods of an object to the object itself, overwriting the existing
  8878. * method.
  8879. *
  8880. * **Note:** This method doesn't set the "length" property of bound functions.
  8881. *
  8882. * @static
  8883. * @since 0.1.0
  8884. * @memberOf _
  8885. * @category Util
  8886. * @param {Object} object The object to bind and assign the bound methods to.
  8887. * @param {...(string|string[])} methodNames The object method names to bind.
  8888. * @returns {Object} Returns `object`.
  8889. * @example
  8890. *
  8891. * var view = {
  8892. * 'label': 'docs',
  8893. * 'click': function() {
  8894. * console.log('clicked ' + this.label);
  8895. * }
  8896. * };
  8897. *
  8898. * _.bindAll(view, ['click']);
  8899. * jQuery(element).on('click', view.click);
  8900. * // => Logs 'clicked docs' when clicked.
  8901. */var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object));});return object;});/**
  8902. * Creates a function that iterates over `pairs` and invokes the corresponding
  8903. * function of the first predicate to return truthy. The predicate-function
  8904. * pairs are invoked with the `this` binding and arguments of the created
  8905. * function.
  8906. *
  8907. * @static
  8908. * @memberOf _
  8909. * @since 4.0.0
  8910. * @category Util
  8911. * @param {Array} pairs The predicate-function pairs.
  8912. * @returns {Function} Returns the new composite function.
  8913. * @example
  8914. *
  8915. * var func = _.cond([
  8916. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  8917. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  8918. * [_.stubTrue, _.constant('no match')]
  8919. * ]);
  8920. *
  8921. * func({ 'a': 1, 'b': 2 });
  8922. * // => 'matches A'
  8923. *
  8924. * func({ 'a': 0, 'b': 1 });
  8925. * // => 'matches B'
  8926. *
  8927. * func({ 'a': '1', 'b': '2' });
  8928. * // => 'no match'
  8929. */function cond(pairs){var length=pairs==null?0:pairs.length,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!='function'){throw new TypeError(FUNC_ERROR_TEXT);}return [toIteratee(pair[0]),pair[1]];});return baseRest(function(args){var index=-1;while(++index<length){var pair=pairs[index];if(apply(pair[0],this,args)){return apply(pair[1],this,args);}}});}/**
  8930. * Creates a function that invokes the predicate properties of `source` with
  8931. * the corresponding property values of a given object, returning `true` if
  8932. * all predicates return truthy, else `false`.
  8933. *
  8934. * **Note:** The created function is equivalent to `_.conformsTo` with
  8935. * `source` partially applied.
  8936. *
  8937. * @static
  8938. * @memberOf _
  8939. * @since 4.0.0
  8940. * @category Util
  8941. * @param {Object} source The object of property predicates to conform to.
  8942. * @returns {Function} Returns the new spec function.
  8943. * @example
  8944. *
  8945. * var objects = [
  8946. * { 'a': 2, 'b': 1 },
  8947. * { 'a': 1, 'b': 2 }
  8948. * ];
  8949. *
  8950. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  8951. * // => [{ 'a': 1, 'b': 2 }]
  8952. */function conforms(source){return baseConforms(baseClone(source,CLONE_DEEP_FLAG));}/**
  8953. * Creates a function that returns `value`.
  8954. *
  8955. * @static
  8956. * @memberOf _
  8957. * @since 2.4.0
  8958. * @category Util
  8959. * @param {*} value The value to return from the new function.
  8960. * @returns {Function} Returns the new constant function.
  8961. * @example
  8962. *
  8963. * var objects = _.times(2, _.constant({ 'a': 1 }));
  8964. *
  8965. * console.log(objects);
  8966. * // => [{ 'a': 1 }, { 'a': 1 }]
  8967. *
  8968. * console.log(objects[0] === objects[1]);
  8969. * // => true
  8970. */function constant(value){return function(){return value;};}/**
  8971. * Checks `value` to determine whether a default value should be returned in
  8972. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  8973. * or `undefined`.
  8974. *
  8975. * @static
  8976. * @memberOf _
  8977. * @since 4.14.0
  8978. * @category Util
  8979. * @param {*} value The value to check.
  8980. * @param {*} defaultValue The default value.
  8981. * @returns {*} Returns the resolved value.
  8982. * @example
  8983. *
  8984. * _.defaultTo(1, 10);
  8985. * // => 1
  8986. *
  8987. * _.defaultTo(undefined, 10);
  8988. * // => 10
  8989. */function defaultTo(value,defaultValue){return value==null||value!==value?defaultValue:value;}/**
  8990. * Creates a function that returns the result of invoking the given functions
  8991. * with the `this` binding of the created function, where each successive
  8992. * invocation is supplied the return value of the previous.
  8993. *
  8994. * @static
  8995. * @memberOf _
  8996. * @since 3.0.0
  8997. * @category Util
  8998. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  8999. * @returns {Function} Returns the new composite function.
  9000. * @see _.flowRight
  9001. * @example
  9002. *
  9003. * function square(n) {
  9004. * return n * n;
  9005. * }
  9006. *
  9007. * var addSquare = _.flow([_.add, square]);
  9008. * addSquare(1, 2);
  9009. * // => 9
  9010. */var flow=createFlow();/**
  9011. * This method is like `_.flow` except that it creates a function that
  9012. * invokes the given functions from right to left.
  9013. *
  9014. * @static
  9015. * @since 3.0.0
  9016. * @memberOf _
  9017. * @category Util
  9018. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  9019. * @returns {Function} Returns the new composite function.
  9020. * @see _.flow
  9021. * @example
  9022. *
  9023. * function square(n) {
  9024. * return n * n;
  9025. * }
  9026. *
  9027. * var addSquare = _.flowRight([square, _.add]);
  9028. * addSquare(1, 2);
  9029. * // => 9
  9030. */var flowRight=createFlow(true);/**
  9031. * This method returns the first argument it receives.
  9032. *
  9033. * @static
  9034. * @since 0.1.0
  9035. * @memberOf _
  9036. * @category Util
  9037. * @param {*} value Any value.
  9038. * @returns {*} Returns `value`.
  9039. * @example
  9040. *
  9041. * var object = { 'a': 1 };
  9042. *
  9043. * console.log(_.identity(object) === object);
  9044. * // => true
  9045. */function identity(value){return value;}/**
  9046. * Creates a function that invokes `func` with the arguments of the created
  9047. * function. If `func` is a property name, the created function returns the
  9048. * property value for a given element. If `func` is an array or object, the
  9049. * created function returns `true` for elements that contain the equivalent
  9050. * source properties, otherwise it returns `false`.
  9051. *
  9052. * @static
  9053. * @since 4.0.0
  9054. * @memberOf _
  9055. * @category Util
  9056. * @param {*} [func=_.identity] The value to convert to a callback.
  9057. * @returns {Function} Returns the callback.
  9058. * @example
  9059. *
  9060. * var users = [
  9061. * { 'user': 'barney', 'age': 36, 'active': true },
  9062. * { 'user': 'fred', 'age': 40, 'active': false }
  9063. * ];
  9064. *
  9065. * // The `_.matches` iteratee shorthand.
  9066. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  9067. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  9068. *
  9069. * // The `_.matchesProperty` iteratee shorthand.
  9070. * _.filter(users, _.iteratee(['user', 'fred']));
  9071. * // => [{ 'user': 'fred', 'age': 40 }]
  9072. *
  9073. * // The `_.property` iteratee shorthand.
  9074. * _.map(users, _.iteratee('user'));
  9075. * // => ['barney', 'fred']
  9076. *
  9077. * // Create custom iteratee shorthands.
  9078. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  9079. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  9080. * return func.test(string);
  9081. * };
  9082. * });
  9083. *
  9084. * _.filter(['abc', 'def'], /ef/);
  9085. * // => ['def']
  9086. */function iteratee(func){return baseIteratee(typeof func=='function'?func:baseClone(func,CLONE_DEEP_FLAG));}/**
  9087. * Creates a function that performs a partial deep comparison between a given
  9088. * object and `source`, returning `true` if the given object has equivalent
  9089. * property values, else `false`.
  9090. *
  9091. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  9092. * partially applied.
  9093. *
  9094. * Partial comparisons will match empty array and empty object `source`
  9095. * values against any array or object value, respectively. See `_.isEqual`
  9096. * for a list of supported value comparisons.
  9097. *
  9098. * **Note:** Multiple values can be checked by combining several matchers
  9099. * using `_.overSome`
  9100. *
  9101. * @static
  9102. * @memberOf _
  9103. * @since 3.0.0
  9104. * @category Util
  9105. * @param {Object} source The object of property values to match.
  9106. * @returns {Function} Returns the new spec function.
  9107. * @example
  9108. *
  9109. * var objects = [
  9110. * { 'a': 1, 'b': 2, 'c': 3 },
  9111. * { 'a': 4, 'b': 5, 'c': 6 }
  9112. * ];
  9113. *
  9114. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  9115. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  9116. *
  9117. * // Checking for several possible values
  9118. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  9119. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  9120. */function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG));}/**
  9121. * Creates a function that performs a partial deep comparison between the
  9122. * value at `path` of a given object to `srcValue`, returning `true` if the
  9123. * object value is equivalent, else `false`.
  9124. *
  9125. * **Note:** Partial comparisons will match empty array and empty object
  9126. * `srcValue` values against any array or object value, respectively. See
  9127. * `_.isEqual` for a list of supported value comparisons.
  9128. *
  9129. * **Note:** Multiple values can be checked by combining several matchers
  9130. * using `_.overSome`
  9131. *
  9132. * @static
  9133. * @memberOf _
  9134. * @since 3.2.0
  9135. * @category Util
  9136. * @param {Array|string} path The path of the property to get.
  9137. * @param {*} srcValue The value to match.
  9138. * @returns {Function} Returns the new spec function.
  9139. * @example
  9140. *
  9141. * var objects = [
  9142. * { 'a': 1, 'b': 2, 'c': 3 },
  9143. * { 'a': 4, 'b': 5, 'c': 6 }
  9144. * ];
  9145. *
  9146. * _.find(objects, _.matchesProperty('a', 4));
  9147. * // => { 'a': 4, 'b': 5, 'c': 6 }
  9148. *
  9149. * // Checking for several possible values
  9150. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  9151. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  9152. */function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG));}/**
  9153. * Creates a function that invokes the method at `path` of a given object.
  9154. * Any additional arguments are provided to the invoked method.
  9155. *
  9156. * @static
  9157. * @memberOf _
  9158. * @since 3.7.0
  9159. * @category Util
  9160. * @param {Array|string} path The path of the method to invoke.
  9161. * @param {...*} [args] The arguments to invoke the method with.
  9162. * @returns {Function} Returns the new invoker function.
  9163. * @example
  9164. *
  9165. * var objects = [
  9166. * { 'a': { 'b': _.constant(2) } },
  9167. * { 'a': { 'b': _.constant(1) } }
  9168. * ];
  9169. *
  9170. * _.map(objects, _.method('a.b'));
  9171. * // => [2, 1]
  9172. *
  9173. * _.map(objects, _.method(['a', 'b']));
  9174. * // => [2, 1]
  9175. */var method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args);};});/**
  9176. * The opposite of `_.method`; this method creates a function that invokes
  9177. * the method at a given path of `object`. Any additional arguments are
  9178. * provided to the invoked method.
  9179. *
  9180. * @static
  9181. * @memberOf _
  9182. * @since 3.7.0
  9183. * @category Util
  9184. * @param {Object} object The object to query.
  9185. * @param {...*} [args] The arguments to invoke the method with.
  9186. * @returns {Function} Returns the new invoker function.
  9187. * @example
  9188. *
  9189. * var array = _.times(3, _.constant),
  9190. * object = { 'a': array, 'b': array, 'c': array };
  9191. *
  9192. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  9193. * // => [2, 0]
  9194. *
  9195. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  9196. * // => [2, 0]
  9197. */var methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args);};});/**
  9198. * Adds all own enumerable string keyed function properties of a source
  9199. * object to the destination object. If `object` is a function, then methods
  9200. * are added to its prototype as well.
  9201. *
  9202. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  9203. * avoid conflicts caused by modifying the original.
  9204. *
  9205. * @static
  9206. * @since 0.1.0
  9207. * @memberOf _
  9208. * @category Util
  9209. * @param {Function|Object} [object=lodash] The destination object.
  9210. * @param {Object} source The object of functions to add.
  9211. * @param {Object} [options={}] The options object.
  9212. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  9213. * @returns {Function|Object} Returns `object`.
  9214. * @example
  9215. *
  9216. * function vowels(string) {
  9217. * return _.filter(string, function(v) {
  9218. * return /[aeiou]/i.test(v);
  9219. * });
  9220. * }
  9221. *
  9222. * _.mixin({ 'vowels': vowels });
  9223. * _.vowels('fred');
  9224. * // => ['e']
  9225. *
  9226. * _('fred').vowels().value();
  9227. * // => ['e']
  9228. *
  9229. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  9230. * _('fred').vowels();
  9231. * // => ['e']
  9232. */function mixin(object,source,options){var props=keys(source),methodNames=baseFunctions(source,props);if(options==null&&!(isObject(source)&&(methodNames.length||!props.length))){options=source;source=object;object=this;methodNames=baseFunctions(source,keys(source));}var chain=!(isObject(options)&&'chain'in options)||!!options.chain,isFunc=isFunction(object);arrayEach(methodNames,function(methodName){var func=source[methodName];object[methodName]=func;if(isFunc){object.prototype[methodName]=function(){var chainAll=this.__chain__;if(chain||chainAll){var result=object(this.__wrapped__),actions=result.__actions__=copyArray(this.__actions__);actions.push({'func':func,'args':arguments,'thisArg':object});result.__chain__=chainAll;return result;}return func.apply(object,arrayPush([this.value()],arguments));};}});return object;}/**
  9233. * Reverts the `_` variable to its previous value and returns a reference to
  9234. * the `lodash` function.
  9235. *
  9236. * @static
  9237. * @since 0.1.0
  9238. * @memberOf _
  9239. * @category Util
  9240. * @returns {Function} Returns the `lodash` function.
  9241. * @example
  9242. *
  9243. * var lodash = _.noConflict();
  9244. */function noConflict(){if(root._===this){root._=oldDash;}return this;}/**
  9245. * This method returns `undefined`.
  9246. *
  9247. * @static
  9248. * @memberOf _
  9249. * @since 2.3.0
  9250. * @category Util
  9251. * @example
  9252. *
  9253. * _.times(2, _.noop);
  9254. * // => [undefined, undefined]
  9255. */function noop(){// No operation performed.
  9256. }/**
  9257. * Creates a function that gets the argument at index `n`. If `n` is negative,
  9258. * the nth argument from the end is returned.
  9259. *
  9260. * @static
  9261. * @memberOf _
  9262. * @since 4.0.0
  9263. * @category Util
  9264. * @param {number} [n=0] The index of the argument to return.
  9265. * @returns {Function} Returns the new pass-thru function.
  9266. * @example
  9267. *
  9268. * var func = _.nthArg(1);
  9269. * func('a', 'b', 'c', 'd');
  9270. * // => 'b'
  9271. *
  9272. * var func = _.nthArg(-2);
  9273. * func('a', 'b', 'c', 'd');
  9274. * // => 'c'
  9275. */function nthArg(n){n=toInteger(n);return baseRest(function(args){return baseNth(args,n);});}/**
  9276. * Creates a function that invokes `iteratees` with the arguments it receives
  9277. * and returns their results.
  9278. *
  9279. * @static
  9280. * @memberOf _
  9281. * @since 4.0.0
  9282. * @category Util
  9283. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  9284. * The iteratees to invoke.
  9285. * @returns {Function} Returns the new function.
  9286. * @example
  9287. *
  9288. * var func = _.over([Math.max, Math.min]);
  9289. *
  9290. * func(1, 2, 3, 4);
  9291. * // => [4, 1]
  9292. */var over=createOver(arrayMap);/**
  9293. * Creates a function that checks if **all** of the `predicates` return
  9294. * truthy when invoked with the arguments it receives.
  9295. *
  9296. * Following shorthands are possible for providing predicates.
  9297. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  9298. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  9299. *
  9300. * @static
  9301. * @memberOf _
  9302. * @since 4.0.0
  9303. * @category Util
  9304. * @param {...(Function|Function[])} [predicates=[_.identity]]
  9305. * The predicates to check.
  9306. * @returns {Function} Returns the new function.
  9307. * @example
  9308. *
  9309. * var func = _.overEvery([Boolean, isFinite]);
  9310. *
  9311. * func('1');
  9312. * // => true
  9313. *
  9314. * func(null);
  9315. * // => false
  9316. *
  9317. * func(NaN);
  9318. * // => false
  9319. */var overEvery=createOver(arrayEvery);/**
  9320. * Creates a function that checks if **any** of the `predicates` return
  9321. * truthy when invoked with the arguments it receives.
  9322. *
  9323. * Following shorthands are possible for providing predicates.
  9324. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  9325. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  9326. *
  9327. * @static
  9328. * @memberOf _
  9329. * @since 4.0.0
  9330. * @category Util
  9331. * @param {...(Function|Function[])} [predicates=[_.identity]]
  9332. * The predicates to check.
  9333. * @returns {Function} Returns the new function.
  9334. * @example
  9335. *
  9336. * var func = _.overSome([Boolean, isFinite]);
  9337. *
  9338. * func('1');
  9339. * // => true
  9340. *
  9341. * func(null);
  9342. * // => true
  9343. *
  9344. * func(NaN);
  9345. * // => false
  9346. *
  9347. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  9348. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  9349. */var overSome=createOver(arraySome);/**
  9350. * Creates a function that returns the value at `path` of a given object.
  9351. *
  9352. * @static
  9353. * @memberOf _
  9354. * @since 2.4.0
  9355. * @category Util
  9356. * @param {Array|string} path The path of the property to get.
  9357. * @returns {Function} Returns the new accessor function.
  9358. * @example
  9359. *
  9360. * var objects = [
  9361. * { 'a': { 'b': 2 } },
  9362. * { 'a': { 'b': 1 } }
  9363. * ];
  9364. *
  9365. * _.map(objects, _.property('a.b'));
  9366. * // => [2, 1]
  9367. *
  9368. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  9369. * // => [1, 2]
  9370. */function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path);}/**
  9371. * The opposite of `_.property`; this method creates a function that returns
  9372. * the value at a given path of `object`.
  9373. *
  9374. * @static
  9375. * @memberOf _
  9376. * @since 3.0.0
  9377. * @category Util
  9378. * @param {Object} object The object to query.
  9379. * @returns {Function} Returns the new accessor function.
  9380. * @example
  9381. *
  9382. * var array = [0, 1, 2],
  9383. * object = { 'a': array, 'b': array, 'c': array };
  9384. *
  9385. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  9386. * // => [2, 0]
  9387. *
  9388. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  9389. * // => [2, 0]
  9390. */function propertyOf(object){return function(path){return object==null?undefined$1:baseGet(object,path);};}/**
  9391. * Creates an array of numbers (positive and/or negative) progressing from
  9392. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  9393. * `start` is specified without an `end` or `step`. If `end` is not specified,
  9394. * it's set to `start` with `start` then set to `0`.
  9395. *
  9396. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  9397. * floating-point values which can produce unexpected results.
  9398. *
  9399. * @static
  9400. * @since 0.1.0
  9401. * @memberOf _
  9402. * @category Util
  9403. * @param {number} [start=0] The start of the range.
  9404. * @param {number} end The end of the range.
  9405. * @param {number} [step=1] The value to increment or decrement by.
  9406. * @returns {Array} Returns the range of numbers.
  9407. * @see _.inRange, _.rangeRight
  9408. * @example
  9409. *
  9410. * _.range(4);
  9411. * // => [0, 1, 2, 3]
  9412. *
  9413. * _.range(-4);
  9414. * // => [0, -1, -2, -3]
  9415. *
  9416. * _.range(1, 5);
  9417. * // => [1, 2, 3, 4]
  9418. *
  9419. * _.range(0, 20, 5);
  9420. * // => [0, 5, 10, 15]
  9421. *
  9422. * _.range(0, -4, -1);
  9423. * // => [0, -1, -2, -3]
  9424. *
  9425. * _.range(1, 4, 0);
  9426. * // => [1, 1, 1]
  9427. *
  9428. * _.range(0);
  9429. * // => []
  9430. */var range=createRange();/**
  9431. * This method is like `_.range` except that it populates values in
  9432. * descending order.
  9433. *
  9434. * @static
  9435. * @memberOf _
  9436. * @since 4.0.0
  9437. * @category Util
  9438. * @param {number} [start=0] The start of the range.
  9439. * @param {number} end The end of the range.
  9440. * @param {number} [step=1] The value to increment or decrement by.
  9441. * @returns {Array} Returns the range of numbers.
  9442. * @see _.inRange, _.range
  9443. * @example
  9444. *
  9445. * _.rangeRight(4);
  9446. * // => [3, 2, 1, 0]
  9447. *
  9448. * _.rangeRight(-4);
  9449. * // => [-3, -2, -1, 0]
  9450. *
  9451. * _.rangeRight(1, 5);
  9452. * // => [4, 3, 2, 1]
  9453. *
  9454. * _.rangeRight(0, 20, 5);
  9455. * // => [15, 10, 5, 0]
  9456. *
  9457. * _.rangeRight(0, -4, -1);
  9458. * // => [-3, -2, -1, 0]
  9459. *
  9460. * _.rangeRight(1, 4, 0);
  9461. * // => [1, 1, 1]
  9462. *
  9463. * _.rangeRight(0);
  9464. * // => []
  9465. */var rangeRight=createRange(true);/**
  9466. * This method returns a new empty array.
  9467. *
  9468. * @static
  9469. * @memberOf _
  9470. * @since 4.13.0
  9471. * @category Util
  9472. * @returns {Array} Returns the new empty array.
  9473. * @example
  9474. *
  9475. * var arrays = _.times(2, _.stubArray);
  9476. *
  9477. * console.log(arrays);
  9478. * // => [[], []]
  9479. *
  9480. * console.log(arrays[0] === arrays[1]);
  9481. * // => false
  9482. */function stubArray(){return [];}/**
  9483. * This method returns `false`.
  9484. *
  9485. * @static
  9486. * @memberOf _
  9487. * @since 4.13.0
  9488. * @category Util
  9489. * @returns {boolean} Returns `false`.
  9490. * @example
  9491. *
  9492. * _.times(2, _.stubFalse);
  9493. * // => [false, false]
  9494. */function stubFalse(){return false;}/**
  9495. * This method returns a new empty object.
  9496. *
  9497. * @static
  9498. * @memberOf _
  9499. * @since 4.13.0
  9500. * @category Util
  9501. * @returns {Object} Returns the new empty object.
  9502. * @example
  9503. *
  9504. * var objects = _.times(2, _.stubObject);
  9505. *
  9506. * console.log(objects);
  9507. * // => [{}, {}]
  9508. *
  9509. * console.log(objects[0] === objects[1]);
  9510. * // => false
  9511. */function stubObject(){return {};}/**
  9512. * This method returns an empty string.
  9513. *
  9514. * @static
  9515. * @memberOf _
  9516. * @since 4.13.0
  9517. * @category Util
  9518. * @returns {string} Returns the empty string.
  9519. * @example
  9520. *
  9521. * _.times(2, _.stubString);
  9522. * // => ['', '']
  9523. */function stubString(){return '';}/**
  9524. * This method returns `true`.
  9525. *
  9526. * @static
  9527. * @memberOf _
  9528. * @since 4.13.0
  9529. * @category Util
  9530. * @returns {boolean} Returns `true`.
  9531. * @example
  9532. *
  9533. * _.times(2, _.stubTrue);
  9534. * // => [true, true]
  9535. */function stubTrue(){return true;}/**
  9536. * Invokes the iteratee `n` times, returning an array of the results of
  9537. * each invocation. The iteratee is invoked with one argument; (index).
  9538. *
  9539. * @static
  9540. * @since 0.1.0
  9541. * @memberOf _
  9542. * @category Util
  9543. * @param {number} n The number of times to invoke `iteratee`.
  9544. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9545. * @returns {Array} Returns the array of results.
  9546. * @example
  9547. *
  9548. * _.times(3, String);
  9549. * // => ['0', '1', '2']
  9550. *
  9551. * _.times(4, _.constant(0));
  9552. * // => [0, 0, 0, 0]
  9553. */function times(n,iteratee){n=toInteger(n);if(n<1||n>MAX_SAFE_INTEGER){return [];}var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index<n){iteratee(index);}return result;}/**
  9554. * Converts `value` to a property path array.
  9555. *
  9556. * @static
  9557. * @memberOf _
  9558. * @since 4.0.0
  9559. * @category Util
  9560. * @param {*} value The value to convert.
  9561. * @returns {Array} Returns the new property path array.
  9562. * @example
  9563. *
  9564. * _.toPath('a.b.c');
  9565. * // => ['a', 'b', 'c']
  9566. *
  9567. * _.toPath('a[0].b.c');
  9568. * // => ['a', '0', 'b', 'c']
  9569. */function toPath(value){if(isArray(value)){return arrayMap(value,toKey);}return isSymbol(value)?[value]:copyArray(stringToPath(toString(value)));}/**
  9570. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  9571. *
  9572. * @static
  9573. * @since 0.1.0
  9574. * @memberOf _
  9575. * @category Util
  9576. * @param {string} [prefix=''] The value to prefix the ID with.
  9577. * @returns {string} Returns the unique ID.
  9578. * @example
  9579. *
  9580. * _.uniqueId('contact_');
  9581. * // => 'contact_104'
  9582. *
  9583. * _.uniqueId();
  9584. * // => '105'
  9585. */function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id;}/*------------------------------------------------------------------------*/ /**
  9586. * Adds two numbers.
  9587. *
  9588. * @static
  9589. * @memberOf _
  9590. * @since 3.4.0
  9591. * @category Math
  9592. * @param {number} augend The first number in an addition.
  9593. * @param {number} addend The second number in an addition.
  9594. * @returns {number} Returns the total.
  9595. * @example
  9596. *
  9597. * _.add(6, 4);
  9598. * // => 10
  9599. */var add=createMathOperation(function(augend,addend){return augend+addend;},0);/**
  9600. * Computes `number` rounded up to `precision`.
  9601. *
  9602. * @static
  9603. * @memberOf _
  9604. * @since 3.10.0
  9605. * @category Math
  9606. * @param {number} number The number to round up.
  9607. * @param {number} [precision=0] The precision to round up to.
  9608. * @returns {number} Returns the rounded up number.
  9609. * @example
  9610. *
  9611. * _.ceil(4.006);
  9612. * // => 5
  9613. *
  9614. * _.ceil(6.004, 2);
  9615. * // => 6.01
  9616. *
  9617. * _.ceil(6040, -2);
  9618. * // => 6100
  9619. */var ceil=createRound('ceil');/**
  9620. * Divide two numbers.
  9621. *
  9622. * @static
  9623. * @memberOf _
  9624. * @since 4.7.0
  9625. * @category Math
  9626. * @param {number} dividend The first number in a division.
  9627. * @param {number} divisor The second number in a division.
  9628. * @returns {number} Returns the quotient.
  9629. * @example
  9630. *
  9631. * _.divide(6, 4);
  9632. * // => 1.5
  9633. */var divide=createMathOperation(function(dividend,divisor){return dividend/divisor;},1);/**
  9634. * Computes `number` rounded down to `precision`.
  9635. *
  9636. * @static
  9637. * @memberOf _
  9638. * @since 3.10.0
  9639. * @category Math
  9640. * @param {number} number The number to round down.
  9641. * @param {number} [precision=0] The precision to round down to.
  9642. * @returns {number} Returns the rounded down number.
  9643. * @example
  9644. *
  9645. * _.floor(4.006);
  9646. * // => 4
  9647. *
  9648. * _.floor(0.046, 2);
  9649. * // => 0.04
  9650. *
  9651. * _.floor(4060, -2);
  9652. * // => 4000
  9653. */var floor=createRound('floor');/**
  9654. * Computes the maximum value of `array`. If `array` is empty or falsey,
  9655. * `undefined` is returned.
  9656. *
  9657. * @static
  9658. * @since 0.1.0
  9659. * @memberOf _
  9660. * @category Math
  9661. * @param {Array} array The array to iterate over.
  9662. * @returns {*} Returns the maximum value.
  9663. * @example
  9664. *
  9665. * _.max([4, 2, 8, 6]);
  9666. * // => 8
  9667. *
  9668. * _.max([]);
  9669. * // => undefined
  9670. */function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined$1;}/**
  9671. * This method is like `_.max` except that it accepts `iteratee` which is
  9672. * invoked for each element in `array` to generate the criterion by which
  9673. * the value is ranked. The iteratee is invoked with one argument: (value).
  9674. *
  9675. * @static
  9676. * @memberOf _
  9677. * @since 4.0.0
  9678. * @category Math
  9679. * @param {Array} array The array to iterate over.
  9680. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9681. * @returns {*} Returns the maximum value.
  9682. * @example
  9683. *
  9684. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  9685. *
  9686. * _.maxBy(objects, function(o) { return o.n; });
  9687. * // => { 'n': 2 }
  9688. *
  9689. * // The `_.property` iteratee shorthand.
  9690. * _.maxBy(objects, 'n');
  9691. * // => { 'n': 2 }
  9692. */function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseGt):undefined$1;}/**
  9693. * Computes the mean of the values in `array`.
  9694. *
  9695. * @static
  9696. * @memberOf _
  9697. * @since 4.0.0
  9698. * @category Math
  9699. * @param {Array} array The array to iterate over.
  9700. * @returns {number} Returns the mean.
  9701. * @example
  9702. *
  9703. * _.mean([4, 2, 8, 6]);
  9704. * // => 5
  9705. */function mean(array){return baseMean(array,identity);}/**
  9706. * This method is like `_.mean` except that it accepts `iteratee` which is
  9707. * invoked for each element in `array` to generate the value to be averaged.
  9708. * The iteratee is invoked with one argument: (value).
  9709. *
  9710. * @static
  9711. * @memberOf _
  9712. * @since 4.7.0
  9713. * @category Math
  9714. * @param {Array} array The array to iterate over.
  9715. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9716. * @returns {number} Returns the mean.
  9717. * @example
  9718. *
  9719. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  9720. *
  9721. * _.meanBy(objects, function(o) { return o.n; });
  9722. * // => 5
  9723. *
  9724. * // The `_.property` iteratee shorthand.
  9725. * _.meanBy(objects, 'n');
  9726. * // => 5
  9727. */function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee,2));}/**
  9728. * Computes the minimum value of `array`. If `array` is empty or falsey,
  9729. * `undefined` is returned.
  9730. *
  9731. * @static
  9732. * @since 0.1.0
  9733. * @memberOf _
  9734. * @category Math
  9735. * @param {Array} array The array to iterate over.
  9736. * @returns {*} Returns the minimum value.
  9737. * @example
  9738. *
  9739. * _.min([4, 2, 8, 6]);
  9740. * // => 2
  9741. *
  9742. * _.min([]);
  9743. * // => undefined
  9744. */function min(array){return array&&array.length?baseExtremum(array,identity,baseLt):undefined$1;}/**
  9745. * This method is like `_.min` except that it accepts `iteratee` which is
  9746. * invoked for each element in `array` to generate the criterion by which
  9747. * the value is ranked. The iteratee is invoked with one argument: (value).
  9748. *
  9749. * @static
  9750. * @memberOf _
  9751. * @since 4.0.0
  9752. * @category Math
  9753. * @param {Array} array The array to iterate over.
  9754. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9755. * @returns {*} Returns the minimum value.
  9756. * @example
  9757. *
  9758. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  9759. *
  9760. * _.minBy(objects, function(o) { return o.n; });
  9761. * // => { 'n': 1 }
  9762. *
  9763. * // The `_.property` iteratee shorthand.
  9764. * _.minBy(objects, 'n');
  9765. * // => { 'n': 1 }
  9766. */function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseLt):undefined$1;}/**
  9767. * Multiply two numbers.
  9768. *
  9769. * @static
  9770. * @memberOf _
  9771. * @since 4.7.0
  9772. * @category Math
  9773. * @param {number} multiplier The first number in a multiplication.
  9774. * @param {number} multiplicand The second number in a multiplication.
  9775. * @returns {number} Returns the product.
  9776. * @example
  9777. *
  9778. * _.multiply(6, 4);
  9779. * // => 24
  9780. */var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand;},1);/**
  9781. * Computes `number` rounded to `precision`.
  9782. *
  9783. * @static
  9784. * @memberOf _
  9785. * @since 3.10.0
  9786. * @category Math
  9787. * @param {number} number The number to round.
  9788. * @param {number} [precision=0] The precision to round to.
  9789. * @returns {number} Returns the rounded number.
  9790. * @example
  9791. *
  9792. * _.round(4.006);
  9793. * // => 4
  9794. *
  9795. * _.round(4.006, 2);
  9796. * // => 4.01
  9797. *
  9798. * _.round(4060, -2);
  9799. * // => 4100
  9800. */var round=createRound('round');/**
  9801. * Subtract two numbers.
  9802. *
  9803. * @static
  9804. * @memberOf _
  9805. * @since 4.0.0
  9806. * @category Math
  9807. * @param {number} minuend The first number in a subtraction.
  9808. * @param {number} subtrahend The second number in a subtraction.
  9809. * @returns {number} Returns the difference.
  9810. * @example
  9811. *
  9812. * _.subtract(6, 4);
  9813. * // => 2
  9814. */var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend;},0);/**
  9815. * Computes the sum of the values in `array`.
  9816. *
  9817. * @static
  9818. * @memberOf _
  9819. * @since 3.4.0
  9820. * @category Math
  9821. * @param {Array} array The array to iterate over.
  9822. * @returns {number} Returns the sum.
  9823. * @example
  9824. *
  9825. * _.sum([4, 2, 8, 6]);
  9826. * // => 20
  9827. */function sum(array){return array&&array.length?baseSum(array,identity):0;}/**
  9828. * This method is like `_.sum` except that it accepts `iteratee` which is
  9829. * invoked for each element in `array` to generate the value to be summed.
  9830. * The iteratee is invoked with one argument: (value).
  9831. *
  9832. * @static
  9833. * @memberOf _
  9834. * @since 4.0.0
  9835. * @category Math
  9836. * @param {Array} array The array to iterate over.
  9837. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9838. * @returns {number} Returns the sum.
  9839. * @example
  9840. *
  9841. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  9842. *
  9843. * _.sumBy(objects, function(o) { return o.n; });
  9844. * // => 20
  9845. *
  9846. * // The `_.property` iteratee shorthand.
  9847. * _.sumBy(objects, 'n');
  9848. * // => 20
  9849. */function sumBy(array,iteratee){return array&&array.length?baseSum(array,getIteratee(iteratee,2)):0;}/*------------------------------------------------------------------------*/ // Add methods that return wrapped values in chain sequences.
  9850. lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.assignIn=assignIn;lodash.assignInWith=assignInWith;lodash.assignWith=assignWith;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.castArray=castArray;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.concat=concat;lodash.cond=cond;lodash.conforms=conforms;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defaultsDeep=defaultsDeep;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.differenceBy=differenceBy;lodash.differenceWith=differenceWith;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.fill=fill;lodash.filter=filter;lodash.flatMap=flatMap;lodash.flatMapDeep=flatMapDeep;lodash.flatMapDepth=flatMapDepth;lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flattenDepth=flattenDepth;lodash.flip=flip;lodash.flow=flow;lodash.flowRight=flowRight;lodash.fromPairs=fromPairs;lodash.functions=functions;lodash.functionsIn=functionsIn;lodash.groupBy=groupBy;lodash.initial=initial;lodash.intersection=intersection;lodash.intersectionBy=intersectionBy;lodash.intersectionWith=intersectionWith;lodash.invert=invert;lodash.invertBy=invertBy;lodash.invokeMap=invokeMap;lodash.iteratee=iteratee;lodash.keyBy=keyBy;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapKeys=mapKeys;lodash.mapValues=mapValues;lodash.matches=matches;lodash.matchesProperty=matchesProperty;lodash.memoize=memoize;lodash.merge=merge;lodash.mergeWith=mergeWith;lodash.method=method;lodash.methodOf=methodOf;lodash.mixin=mixin;lodash.negate=negate;lodash.nthArg=nthArg;lodash.omit=omit;lodash.omitBy=omitBy;lodash.once=once;lodash.orderBy=orderBy;lodash.over=over;lodash.overArgs=overArgs;lodash.overEvery=overEvery;lodash.overSome=overSome;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pickBy=pickBy;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAll=pullAll;lodash.pullAllBy=pullAllBy;lodash.pullAllWith=pullAllWith;lodash.pullAt=pullAt;lodash.range=range;lodash.rangeRight=rangeRight;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.reverse=reverse;lodash.sampleSize=sampleSize;lodash.set=set;lodash.setWith=setWith;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortedUniq=sortedUniq;lodash.sortedUniqBy=sortedUniqBy;lodash.split=split;lodash.spread=spread;lodash.tail=tail;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.toArray=toArray;lodash.toPairs=toPairs;lodash.toPairsIn=toPairsIn;lodash.toPath=toPath;lodash.toPlainObject=toPlainObject;lodash.transform=transform;lodash.unary=unary;lodash.union=union;lodash.unionBy=unionBy;lodash.unionWith=unionWith;lodash.uniq=uniq;lodash.uniqBy=uniqBy;lodash.uniqWith=uniqWith;lodash.unset=unset;lodash.unzip=unzip;lodash.unzipWith=unzipWith;lodash.update=update;lodash.updateWith=updateWith;lodash.values=values;lodash.valuesIn=valuesIn;lodash.without=without;lodash.words=words;lodash.wrap=wrap;lodash.xor=xor;lodash.xorBy=xorBy;lodash.xorWith=xorWith;lodash.zip=zip;lodash.zipObject=zipObject;lodash.zipObjectDeep=zipObjectDeep;lodash.zipWith=zipWith;// Add aliases.
  9851. lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;// Add methods to `lodash.prototype`.
  9852. mixin(lodash,lodash);/*------------------------------------------------------------------------*/ // Add methods that return unwrapped values in chain sequences.
  9853. lodash.add=add;lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.ceil=ceil;lodash.clamp=clamp;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.cloneDeepWith=cloneDeepWith;lodash.cloneWith=cloneWith;lodash.conformsTo=conformsTo;lodash.deburr=deburr;lodash.defaultTo=defaultTo;lodash.divide=divide;lodash.endsWith=endsWith;lodash.eq=eq;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.floor=floor;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.get=get;lodash.gt=gt;lodash.gte=gte;lodash.has=has;lodash.hasIn=hasIn;lodash.head=head;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.inRange=inRange;lodash.invoke=invoke;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isArrayBuffer=isArrayBuffer;lodash.isArrayLike=isArrayLike;lodash.isArrayLikeObject=isArrayLikeObject;lodash.isBoolean=isBoolean;lodash.isBuffer=isBuffer;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isEqualWith=isEqualWith;lodash.isError=isError;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isInteger=isInteger;lodash.isLength=isLength;lodash.isMap=isMap;lodash.isMatch=isMatch;lodash.isMatchWith=isMatchWith;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNil=isNil;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isObjectLike=isObjectLike;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isSafeInteger=isSafeInteger;lodash.isSet=isSet;lodash.isString=isString;lodash.isSymbol=isSymbol;lodash.isTypedArray=isTypedArray;lodash.isUndefined=isUndefined;lodash.isWeakMap=isWeakMap;lodash.isWeakSet=isWeakSet;lodash.join=join;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.lowerCase=lowerCase;lodash.lowerFirst=lowerFirst;lodash.lt=lt;lodash.lte=lte;lodash.max=max;lodash.maxBy=maxBy;lodash.mean=mean;lodash.meanBy=meanBy;lodash.min=min;lodash.minBy=minBy;lodash.stubArray=stubArray;lodash.stubFalse=stubFalse;lodash.stubObject=stubObject;lodash.stubString=stubString;lodash.stubTrue=stubTrue;lodash.multiply=multiply;lodash.nth=nth;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padEnd=padEnd;lodash.padStart=padStart;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.replace=replace;lodash.result=result;lodash.round=round;lodash.runInContext=runInContext;lodash.sample=sample;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedIndexBy=sortedIndexBy;lodash.sortedIndexOf=sortedIndexOf;lodash.sortedLastIndex=sortedLastIndex;lodash.sortedLastIndexBy=sortedLastIndexBy;lodash.sortedLastIndexOf=sortedLastIndexOf;lodash.startCase=startCase;lodash.startsWith=startsWith;lodash.subtract=subtract;lodash.sum=sum;lodash.sumBy=sumBy;lodash.template=template;lodash.times=times;lodash.toFinite=toFinite;lodash.toInteger=toInteger;lodash.toLength=toLength;lodash.toLower=toLower;lodash.toNumber=toNumber;lodash.toSafeInteger=toSafeInteger;lodash.toString=toString;lodash.toUpper=toUpper;lodash.trim=trim;lodash.trimEnd=trimEnd;lodash.trimStart=trimStart;lodash.truncate=truncate;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.upperCase=upperCase;lodash.upperFirst=upperFirst;// Add aliases.
  9854. lodash.each=forEach;lodash.eachRight=forEachRight;lodash.first=head;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!hasOwnProperty.call(lodash.prototype,methodName)){source[methodName]=func;}});return source;}(),{'chain':false});/*------------------------------------------------------------------------*/ /**
  9855. * The semantic version number.
  9856. *
  9857. * @static
  9858. * @memberOf _
  9859. * @type {string}
  9860. */lodash.VERSION=VERSION;// Assign default placeholders.
  9861. arrayEach(['bind','bindKey','curry','curryRight','partial','partialRight'],function(methodName){lodash[methodName].placeholder=lodash;});// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  9862. arrayEach(['drop','take'],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined$1?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();if(result.__filtered__){result.__takeCount__=nativeMin(n,result.__takeCount__);}else {result.__views__.push({'size':nativeMin(n,MAX_ARRAY_LENGTH),'type':methodName+(result.__dir__<0?'Right':'')});}return result;};LazyWrapper.prototype[methodName+'Right']=function(n){return this.reverse()[methodName](n).reverse();};});// Add `LazyWrapper` methods that accept an `iteratee` value.
  9863. arrayEach(['filter','map','takeWhile'],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||type==LAZY_WHILE_FLAG;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();result.__iteratees__.push({'iteratee':getIteratee(iteratee,3),'type':type});result.__filtered__=result.__filtered__||isFilter;return result;};});// Add `LazyWrapper` methods for `_.head` and `_.last`.
  9864. arrayEach(['head','last'],function(methodName,index){var takeName='take'+(index?'Right':'');LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0];};});// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  9865. arrayEach(['initial','tail'],function(methodName,index){var dropName='drop'+(index?'':'Right');LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1);};});LazyWrapper.prototype.compact=function(){return this.filter(identity);};LazyWrapper.prototype.find=function(predicate){return this.filter(predicate).head();};LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate);};LazyWrapper.prototype.invokeMap=baseRest(function(path,args){if(typeof path=='function'){return new LazyWrapper(this);}return this.map(function(value){return baseInvoke(value,path,args);});});LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)));};LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);var result=this;if(result.__filtered__&&(start>0||end<0)){return new LazyWrapper(result);}if(start<0){result=result.takeRight(-start);}else if(start){result=result.drop(start);}if(end!==undefined$1){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start);}return result;};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse();};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH);};// Add `LazyWrapper` methods to `lodash.prototype`.
  9866. baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?'take'+(methodName=='last'?'Right':''):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc){return;}lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result;};if(useLazy&&checkIteratee&&typeof iteratee=='function'&&iteratee.length!=1){// Avoid lazy use if the iteratee has a "length" value other than `1`.
  9867. isLazy=useLazy=false;}var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({'func':thru,'args':[interceptor],'thisArg':undefined$1});return new LodashWrapper(result,chainAll);}if(isUnwrapped&&onlyLazy){return func.apply(this,args);}result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result;};});// Add `Array` methods to `lodash.prototype`.
  9868. arrayEach(['pop','push','shift','sort','splice','unshift'],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?'tap':'thru',retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args);}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args);});};});// Map minified method names to their real names.
  9869. baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+'';if(!hasOwnProperty.call(realNames,key)){realNames[key]=[];}realNames[key].push({'name':methodName,'func':lodashFunc});}});realNames[createHybrid(undefined$1,WRAP_BIND_KEY_FLAG).name]=[{'name':'wrapper','func':undefined$1}];// Add methods to `LazyWrapper`.
  9870. LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;// Add chain sequence methods to the `lodash` wrapper.
  9871. lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;// Add lazy aliases.
  9872. lodash.prototype.first=lodash.prototype.head;if(symIterator){lodash.prototype[symIterator]=wrapperToIterator;}return lodash;};/*--------------------------------------------------------------------------*/ // Export lodash.
  9873. var _=runInContext();// Some AMD build optimizers, like r.js, check for condition patterns like:
  9874. if(freeModule){// Export for Node.js.
  9875. (freeModule.exports=_)._=_;// Export for CommonJS support.
  9876. freeExports._=_;}else {// Export to the global object.
  9877. root._=_;}}).call(commonjsGlobal);
  9878. });
  9879. /* eslint-disable valid-jsdoc */
  9880. /** insertAfter */
  9881. function insertAfter(newElement, targetElement) {
  9882. var parent = targetElement.parentNode;
  9883. if (parent.lastChild == targetElement) {
  9884. parent.appendChild(newElement);
  9885. } else {
  9886. parent.insertBefore(newElement, targetElement.nextSibling);
  9887. }
  9888. }
  9889. var Status = /*#__PURE__*/function () {
  9890. function Status(jSPlugin, id) {
  9891. _classCallCheck$1(this, Status);
  9892. this.id = id;
  9893. this.jSPlugin = jSPlugin;
  9894. this.state = {
  9895. play: false,
  9896. loading: false,
  9897. text: ''
  9898. };
  9899. this.loadingSetText = this.loadingSetText;
  9900. }
  9901. _createClass$1(Status, [{
  9902. key: "toString",
  9903. value: function toString() {
  9904. return "".concat(this.coreX, "-").concat(this.coreY);
  9905. }
  9906. }, {
  9907. key: "setPlayStatus",
  9908. value: function setPlayStatus(options) {
  9909. this.state = Object.assign(this.state, options);
  9910. }
  9911. }, {
  9912. key: "loadingStart",
  9913. value: function loadingStart(id) {
  9914. var oS = document.createElement('style');
  9915. document.getElementsByTagName("head")[0].appendChild(oS);
  9916. oS.innerHTML = '@keyframes antRotate {to {transform: rotate(400deg);transform-origin:50% 50%;}} .loading {display: inline-block;z-index: 1000;-webkit-animation: antRotate 1s infinite linear;animation: antRotate 1s infinite linear;}';
  9917. var domId = id;
  9918. var domElement = document.getElementById(domId);
  9919. var windowWidth = domElement.offsetWidth;
  9920. var windowHeight = domElement.offsetHeight;
  9921. var offsetTop = 0; //`calc(50% - ${(domElement.offsetTop / 2)}px)`;//domElement.offsetTop; // `calc(50% - ${domElement.offsetTop / 2}px)`
  9922. var offsetLeft = domElement.offsetLeft;
  9923. // 先执行清空loading
  9924. if (document.getElementById("".concat(id, "-loading-id-0"))) {
  9925. document.getElementById("".concat(id, "-loading-id-0")).parentNode.removeChild(document.getElementById("".concat(id, "-loading-id-0")));
  9926. }
  9927. var loadingContainerDOM = document.createElement('div');
  9928. loadingContainerDOM.setAttribute('id', "".concat(id, "-loading-id-0"));
  9929. var style = 'position:absolute;outline:none;pointer-events:none;';
  9930. console.log("this.jSPlugin", this.jSPlugin);
  9931. style += 'width: 100%;background-size: cover; background-repeat:no-repeat;';
  9932. style += 'height: 100%;';
  9933. style += 'top:' + offsetTop + ';';
  9934. style += 'left:' + offsetLeft + 'px;';
  9935. loadingContainerDOM.setAttribute('style', style);
  9936. loadingContainerDOM.style.height = windowHeight;
  9937. loadingContainerDOM.setAttribute('class', 'loading-container');
  9938. // loadingContainerDOM.innerHTML= loading;
  9939. insertAfter(loadingContainerDOM, domElement);
  9940. var splitBasis = 1;
  9941. var loadingItemContainer = document.createElement('div');
  9942. var loadingStatusDOM = document.createElement('div');
  9943. loadingItemContainer.setAttribute('class', 'loading-item');
  9944. loadingItemContainer.setAttribute('id', "".concat(id, "-loading-item-0"));
  9945. //loadingContainer.setAttribute('style','display:inline-flex;flex-direction:column;justify-content:center;align-items: center;width:'+(windowWidth / splitBasis)+'px;height:'+(windowHeight /splitBasis )+'px;outline:none;vertical-align: top;position:absolute');
  9946. var style = 'display:inline-flex;pointer-events:none;flex-direction:column;justify-content:center;align-items: center;width:100%;height:' + windowHeight + 'px;outline:none;vertical-align: top;position:absolute;';
  9947. style += 'left:' + calLoadingPostion(windowHeight, windowWidth, splitBasis, 0).left + 'px;';
  9948. style += 'top:' + calLoadingPostion(windowHeight, windowWidth, splitBasis, 0).top + 'px;';
  9949. loadingItemContainer.setAttribute('style', style);
  9950. function calLoadingPostion(windowHeight, windowWidth, splitBasis, i) {
  9951. var top = parseInt(i / splitBasis, 10) * (windowHeight / splitBasis);
  9952. var left = i % splitBasis * (windowWidth / splitBasis);
  9953. return {
  9954. top: top,
  9955. left: left
  9956. };
  9957. }
  9958. var loadingDOM = document.createElement('div');
  9959. loadingStatusDOM.innerHTML = "";
  9960. loadingStatusDOM.style.color = "#fff";
  9961. loadingDOM.setAttribute('class', 'loading');
  9962. loadingDOM.setAttribute('id', 'loading-icon');
  9963. var loading = '<svg t="1567069979438" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2399" width="32" height="32"><path d="M538.5344 266.4448a133.12 133.12 0 1 1 133.12-133.12 133.4272 133.4272 0 0 1-133.12 133.12zM255.0144 372.1984a121.6768 121.6768 0 1 1 121.6768-121.6768 121.856 121.856 0 0 1-121.6768 121.6768zM134.72 647.424a107.3664 107.3664 0 1 1 107.3664-107.264A107.52 107.52 0 0 1 134.72 647.424z m120.32 272.4608a90.9824 90.9824 0 1 1 90.9824-90.9824A91.1616 91.1616 0 0 1 255.04 919.8848zM538.5344 1024a79.36 79.36 0 1 1 79.36-79.36 79.36 79.36 0 0 1-79.36 79.36z m287.6928-134.144a64.1792 64.1792 0 1 1 64.1792-64.1792 64.3584 64.3584 0 0 1-64.1792 64.1792z m117.76-296.704a52.6336 52.6336 0 1 1 52.6592-52.6336 52.608 52.608 0 0 1-52.6336 52.6336z m-158.72-338.7136a40.96 40.96 0 1 1 12.0064 28.8512 40.5248 40.5248 0 0 1-12.0064-28.8512z" fill="#ffffff" p-id="2400"></path></svg>';
  9964. loadingDOM.innerHTML = loading;
  9965. loadingItemContainer.appendChild(loadingDOM);
  9966. // loadingContainer.appendChild(loading);
  9967. loadingItemContainer.appendChild(loadingStatusDOM);
  9968. loadingContainerDOM.appendChild(loadingItemContainer);
  9969. }
  9970. }, {
  9971. key: "loadingStop",
  9972. value: function loadingStop(id) {
  9973. var loadingItemContainerDOM = document.getElementById("".concat(id, "-loading-item-0"));
  9974. if (loadingItemContainerDOM) {
  9975. loadingItemContainerDOM.removeChild(document.getElementById('loading-icon'));
  9976. }
  9977. }
  9978. }, {
  9979. key: "loadingSetText",
  9980. value: function loadingSetText(opt) {
  9981. var _this = this;
  9982. this.loadingClearText();
  9983. if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
  9984. var textElement = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes[1];
  9985. if (!textElement) {
  9986. var loadingItemContainer = document.getElementById("".concat(this.id, "-loading-item-0"));
  9987. loadingItemContainer.style.height = '100%';
  9988. textElement = document.createElement('div');
  9989. textElement.innerHTML = opt.text;
  9990. loadingItemContainer.appendChild(textElement);
  9991. }
  9992. textElement.innerHTML = opt.text;
  9993. textElement.style.fontSize = "14px";
  9994. textElement.style.color = opt.color || "#FFFFFF";
  9995. this.state.text = opt.text;
  9996. if (opt.delayClear) {
  9997. //传入delayClear后在指定时间后清除提示语
  9998. setTimeout(function () {
  9999. _this.loadingClearText();
  10000. }, parseInt(opt.delayClear));
  10001. }
  10002. }
  10003. }
  10004. }, {
  10005. key: "loadingClearText",
  10006. value: function loadingClearText() {
  10007. if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
  10008. var elements = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes;
  10009. if (elements.length > 1) {
  10010. elements[1].parentNode.removeChild(elements[1]);
  10011. } else {
  10012. elements[0] && elements[0].parentNode.removeChild(elements[0]);
  10013. }
  10014. }
  10015. }
  10016. }, {
  10017. key: "loadingClear",
  10018. value: function loadingClear() {
  10019. if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
  10020. var elements = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes;
  10021. for (var i = elements.length - 1; i >= 0; i--) {
  10022. elements[i].parentNode.removeChild(elements[i]);
  10023. }
  10024. if (document.getElementById("".concat(this.id, "-loading-id-0"))) {
  10025. document.getElementById("".concat(this.id, "-loading-id-0")).style.background = 'none';
  10026. }
  10027. if (document.getElementById('loading-icon')) {
  10028. document.getElementById('loading-icon').parentNode.removeChild(document.getElementById('loading-icon'));
  10029. }
  10030. }
  10031. }
  10032. }, {
  10033. key: "loadingEnd",
  10034. value: function loadingEnd() {
  10035. var loadingItemContainerDOM = document.getElementById("".concat(this.id, "-loading-item-0"));
  10036. if (loadingItemContainerDOM) {
  10037. loadingItemContainerDOM.parentNode.removeChild(loadingItemContainerDOM);
  10038. var loadingContainerDOM = document.getElementById("".concat(this.id, "-loading-id-0"));
  10039. if (loadingContainerDOM && loadingContainerDOM.children.length === 0) {
  10040. loadingContainerDOM.parentNode.removeChild(loadingContainerDOM);
  10041. }
  10042. }
  10043. document.getElementById("".concat(this.id, "-loading-item-0")).style.background = 'none';
  10044. }
  10045. }]);
  10046. return Status;
  10047. }();
  10048. var Message = /*#__PURE__*/function () {
  10049. function Message(jSPlugin, id) {
  10050. _classCallCheck$1(this, Message);
  10051. this.id = id;
  10052. this.jSPlugin = jSPlugin;
  10053. this.timer = null;
  10054. this.state = {
  10055. play: false,
  10056. loading: false
  10057. };
  10058. }
  10059. _createClass$1(Message, [{
  10060. key: "default",
  10061. value: function _default(msg) {
  10062. var _this = this;
  10063. var msgId = "msgId";
  10064. if (document.getElementById("".concat(this.id, "-").concat(msgId))) {
  10065. document.getElementById("".concat(this.id, "-wrap")).removeChild(document.getElementById("".concat(this.id, "-").concat(msgId)));
  10066. }
  10067. var messageDOM = document.createElement('div');
  10068. messageDOM.id = "".concat(this.id, "-").concat(msgId);
  10069. messageDOM.style = "position: absolute;top: 50%;left:calc(50% - ".concat(msg.length * 14 / 2, "px);padding: 4px 16px;background: #00000080;color: #FFFFFF;font-size: 14px");
  10070. messageDOM.innerHTML = msg;
  10071. document.getElementById("".concat(this.id, "-wrap")).appendChild(messageDOM);
  10072. if (this.timer) {
  10073. clearTimeout(this.timer);
  10074. }
  10075. this.timer = setTimeout(function () {
  10076. document.getElementById("".concat(_this.id, "-wrap")).removeChild(document.getElementById("".concat(_this.id, "-").concat(msgId)));
  10077. }, 2000);
  10078. }
  10079. }]);
  10080. return Message;
  10081. }();
  10082. var data$8 = [
  10083. {
  10084. moduleCode: "",
  10085. detailCode: "405984",
  10086. description: "",
  10087. solution: "",
  10088. updateTime: 1559564188000
  10089. },
  10090. {
  10091. moduleCode: "",
  10092. detailCode: "10035",
  10093. description: "获取子账户AccessToken异常,子账户不存在或子账户不属于该开发者",
  10094. solution: "",
  10095. updateTime: 1559551958000
  10096. },
  10097. {
  10098. moduleCode: "",
  10099. detailCode: "1052674",
  10100. description: "获取本地录像失败",
  10101. solution: "",
  10102. updateTime: 1558579653000
  10103. },
  10104. {
  10105. moduleCode: "",
  10106. detailCode: "395547",
  10107. description: "",
  10108. solution: "",
  10109. updateTime: 1557367296000
  10110. },
  10111. {
  10112. moduleCode: "",
  10113. detailCode: "12",
  10114. description: "",
  10115. solution: "",
  10116. updateTime: 1557229476000
  10117. },
  10118. {
  10119. moduleCode: "",
  10120. detailCode: "10052",
  10121. description: "余额不足",
  10122. solution: "",
  10123. updateTime: 1557121463000
  10124. },
  10125. {
  10126. moduleCode: "",
  10127. detailCode: "20108",
  10128. description: "当前用户和所添加用户不是好友关系",
  10129. solution: "",
  10130. updateTime: 1556541725000
  10131. },
  10132. {
  10133. moduleCode: "",
  10134. detailCode: "10009",
  10135. description: "",
  10136. solution: "",
  10137. updateTime: 1556422452000
  10138. },
  10139. {
  10140. moduleCode: "",
  10141. detailCode: "320001",
  10142. description: "通道不存在",
  10143. solution: "请检查录像机的关联状态是否正常,没有摄像头的通道无法播放",
  10144. updateTime: 1556419044000
  10145. },
  10146. {
  10147. moduleCode: "",
  10148. detailCode: "120001",
  10149. description: "通道不存在",
  10150. solution: "请检查录像机的关联状态是否正常,没有摄像头的通道无法播放",
  10151. updateTime: 1556419030000
  10152. },
  10153. {
  10154. moduleCode: "",
  10155. detailCode: "320049",
  10156. description: "",
  10157. solution: "",
  10158. updateTime: 1556272984000
  10159. },
  10160. {
  10161. moduleCode: "",
  10162. detailCode: "380227",
  10163. description: "",
  10164. solution: "",
  10165. updateTime: 1556264379000
  10166. },
  10167. {
  10168. moduleCode: "",
  10169. detailCode: "10033",
  10170. description: "policy参数信息异常",
  10171. solution: "",
  10172. updateTime: 1555922124000
  10173. },
  10174. {
  10175. moduleCode: "",
  10176. detailCode: "10065",
  10177. description: "weakAppKey 不属于accessToken对应的用户",
  10178. solution: "",
  10179. updateTime: 1555497522000
  10180. },
  10181. {
  10182. moduleCode: "",
  10183. detailCode: "100001",
  10184. description: "",
  10185. solution: "",
  10186. updateTime: 1555141776000
  10187. },
  10188. {
  10189. moduleCode: "",
  10190. detailCode: "395558",
  10191. description: "",
  10192. solution: "",
  10193. updateTime: 1554987121000
  10194. },
  10195. {
  10196. moduleCode: "",
  10197. detailCode: "70001",
  10198. description: "智能家居买断用户设备受到限制,建议合理选择pagestart和pageSize",
  10199. solution: "",
  10200. updateTime: 1554691023000
  10201. },
  10202. {
  10203. moduleCode: "",
  10204. detailCode: "170001",
  10205. description: "",
  10206. solution: "",
  10207. updateTime: 1554691023000
  10208. },
  10209. {
  10210. moduleCode: "",
  10211. detailCode: "1012",
  10212. description: "重置失败",
  10213. solution: "",
  10214. updateTime: 1554645841000
  10215. },
  10216. {
  10217. moduleCode: "",
  10218. detailCode: "1043",
  10219. description: "重置失败",
  10220. solution: "",
  10221. updateTime: 1554645834000
  10222. },
  10223. {
  10224. moduleCode: "",
  10225. detailCode: "60060",
  10226. description: "直播功能未开通",
  10227. solution: "通道未开通直播功能,请先开通直播",
  10228. updateTime: 1554346018000
  10229. },
  10230. {
  10231. moduleCode: "",
  10232. detailCode: "380203",
  10233. description: "",
  10234. solution: "",
  10235. updateTime: 1554093666000
  10236. },
  10237. {
  10238. moduleCode: "",
  10239. detailCode: "399048",
  10240. description: "免费版并发数达到上限,请升级企业版使用多并发能力",
  10241. solution: "升级成为企业版套餐即可取消并发数限制",
  10242. updateTime: 1553839878000
  10243. },
  10244. {
  10245. moduleCode: "",
  10246. detailCode: "60007",
  10247. description: "预置点个数超过最大值",
  10248. solution: "",
  10249. updateTime: 1553671316000
  10250. },
  10251. {
  10252. moduleCode: "",
  10253. detailCode: "1005",
  10254. description: "",
  10255. solution: "",
  10256. updateTime: 1553513701000
  10257. },
  10258. {
  10259. moduleCode: "",
  10260. detailCode: "20605",
  10261. description: "其他用户正在认证中",
  10262. solution: "",
  10263. updateTime: 1552976317000
  10264. },
  10265. {
  10266. moduleCode: "",
  10267. detailCode: "90004",
  10268. description: "当前型号设备暂时不支持AI任务:CS-C3W-3B1WFR-YGL",
  10269. solution: "",
  10270. updateTime: 1552898525000
  10271. },
  10272. {
  10273. moduleCode: "",
  10274. detailCode: "60046",
  10275. description: "添加的设备的IP和本设备的IP冲突",
  10276. solution: "",
  10277. updateTime: 1552872372000
  10278. },
  10279. {
  10280. moduleCode: "",
  10281. detailCode: "3",
  10282. description: "修改视频清晰度失败!",
  10283. solution: "",
  10284. updateTime: 1552440229000
  10285. },
  10286. {
  10287. moduleCode: "",
  10288. detailCode: "1013",
  10289. description: "",
  10290. solution: "",
  10291. updateTime: 1552035069000
  10292. },
  10293. {
  10294. moduleCode: "",
  10295. detailCode: "370007",
  10296. description: "",
  10297. solution: "",
  10298. updateTime: 1551852327000
  10299. },
  10300. {
  10301. moduleCode: "",
  10302. detailCode: "-1",
  10303. description: "",
  10304. solution: "",
  10305. updateTime: 1551752889000
  10306. },
  10307. {
  10308. moduleCode: "",
  10309. detailCode: "30005",
  10310. description: "弱账户不存在",
  10311. solution: "",
  10312. updateTime: 1551422358000
  10313. },
  10314. {
  10315. moduleCode: "",
  10316. detailCode: "90006",
  10317. description: "用户操作AI任务受限",
  10318. solution: "",
  10319. updateTime: 1551073320000
  10320. },
  10321. {
  10322. moduleCode: "",
  10323. detailCode: "60203",
  10324. description: "未开通相关服务",
  10325. solution: "",
  10326. updateTime: 1550623070000
  10327. },
  10328. {
  10329. moduleCode: "",
  10330. detailCode: "10002",
  10331. description: "accessToken过期或异常",
  10332. solution: "",
  10333. updateTime: 1550300346000
  10334. },
  10335. {
  10336. moduleCode: "",
  10337. detailCode: "380339",
  10338. description: "",
  10339. solution: "",
  10340. updateTime: 1549889458000
  10341. },
  10342. {
  10343. moduleCode: "",
  10344. detailCode: "90002",
  10345. description: "AI任务设备配置数达到上限:3",
  10346. solution: "",
  10347. updateTime: 1549071664000
  10348. },
  10349. {
  10350. moduleCode: "",
  10351. detailCode: "380008",
  10352. description: "",
  10353. solution: "",
  10354. updateTime: 1549005979000
  10355. },
  10356. {
  10357. moduleCode: "",
  10358. detailCode: "320227",
  10359. description: "",
  10360. solution: "",
  10361. updateTime: 1548739731000
  10362. },
  10363. {
  10364. moduleCode: "",
  10365. detailCode: "60059",
  10366. description: "ezopen地址均不可用",
  10367. solution: "",
  10368. updateTime: 1548395350000
  10369. },
  10370. {
  10371. moduleCode: "",
  10372. detailCode: "10005",
  10373. description: "appKey异常",
  10374. solution: "",
  10375. updateTime: 1548317858000
  10376. },
  10377. {
  10378. moduleCode: "",
  10379. detailCode: "60045",
  10380. description: "添加的设备的IP和其他通道的IP冲突",
  10381. solution: "",
  10382. updateTime: 1548155085000
  10383. },
  10384. {
  10385. moduleCode: "",
  10386. detailCode: "60047",
  10387. description: "码流类型不支持",
  10388. solution: "",
  10389. updateTime: 1547962108000
  10390. },
  10391. {
  10392. moduleCode: "",
  10393. detailCode: "60041",
  10394. description: "添加的设备被其他设备关联或响应超时",
  10395. solution: "",
  10396. updateTime: 1547960980000
  10397. },
  10398. {
  10399. moduleCode: "",
  10400. detailCode: "110029",
  10401. description: "个人用户接口调用频率超限",
  10402. solution: "请升级企业版:https://open.ys7.com/price.html",
  10403. updateTime: 1547606859000
  10404. },
  10405. {
  10406. moduleCode: "",
  10407. detailCode: "380355",
  10408. description: "设备直连推流异常结束",
  10409. solution: "",
  10410. updateTime: 1547106294000
  10411. },
  10412. {
  10413. moduleCode: "",
  10414. detailCode: "320081",
  10415. description: "",
  10416. solution: "",
  10417. updateTime: 1547106279000
  10418. },
  10419. {
  10420. moduleCode: "",
  10421. detailCode: "60035",
  10422. description: "购买云存储服务失败",
  10423. solution: "",
  10424. updateTime: 1547026959000
  10425. },
  10426. {
  10427. moduleCode: "",
  10428. detailCode: "90005",
  10429. description: "设备已存在:C75714141",
  10430. solution: "",
  10431. updateTime: 1546940622000
  10432. },
  10433. {
  10434. moduleCode: "",
  10435. detailCode: "1053445",
  10436. description: "该时间段没有录像片段",
  10437. solution: "",
  10438. updateTime: 1546935727000
  10439. },
  10440. {
  10441. moduleCode: "",
  10442. detailCode: "90007",
  10443. description: "设备未加入到AI任务",
  10444. solution: "",
  10445. updateTime: 1546932948000
  10446. },
  10447. {
  10448. moduleCode: "",
  10449. detailCode: "326000",
  10450. description: "",
  10451. solution: "",
  10452. updateTime: 1546823143000
  10453. },
  10454. {
  10455. moduleCode: "",
  10456. detailCode: "1021",
  10457. description: "重置失败",
  10458. solution: "",
  10459. updateTime: 1546781152000
  10460. },
  10461. {
  10462. moduleCode: "",
  10463. detailCode: "2001",
  10464. description: "删除设备失败!",
  10465. solution: "",
  10466. updateTime: 1546422886000
  10467. },
  10468. {
  10469. moduleCode: "",
  10470. detailCode: "380425",
  10471. description: "",
  10472. solution: "",
  10473. updateTime: 1546407694000
  10474. },
  10475. {
  10476. moduleCode: "",
  10477. detailCode: "120097",
  10478. description: "",
  10479. solution: "",
  10480. updateTime: 1546085995000
  10481. },
  10482. {
  10483. moduleCode: "",
  10484. detailCode: "10059",
  10485. description: "requestId已存在",
  10486. solution: "",
  10487. updateTime: 1545824509000
  10488. },
  10489. {
  10490. moduleCode: "",
  10491. detailCode: "1154723",
  10492. description: "",
  10493. solution: "",
  10494. updateTime: 1545795209000
  10495. },
  10496. {
  10497. moduleCode: "",
  10498. detailCode: "60043",
  10499. description: "添加的设备超出最大数量",
  10500. solution: "",
  10501. updateTime: 1545493607000
  10502. },
  10503. {
  10504. moduleCode: "",
  10505. detailCode: "1152677",
  10506. description: "",
  10507. solution: "",
  10508. updateTime: 1545313404000
  10509. },
  10510. {
  10511. moduleCode: "",
  10512. detailCode: "20097",
  10513. description: "设备添加异常,设备验证码为ABCDEF或设备被N1,R1关联",
  10514. solution: "",
  10515. updateTime: 1545310795000
  10516. },
  10517. {
  10518. moduleCode: "",
  10519. detailCode: "10060",
  10520. description: "设备不支持该云存储类型",
  10521. solution: "",
  10522. updateTime: 1545309064000
  10523. },
  10524. {
  10525. moduleCode: "",
  10526. detailCode: "20102",
  10527. description: "无相应邀请信息,无法接受邀请",
  10528. solution: "",
  10529. updateTime: 1545204966000
  10530. },
  10531. {
  10532. moduleCode: "",
  10533. detailCode: "10053",
  10534. description: "云存储开通中",
  10535. solution: "",
  10536. updateTime: 1545100293000
  10537. },
  10538. {
  10539. moduleCode: "",
  10540. detailCode: "20401",
  10541. description: "用户云空间信息不存在",
  10542. solution: "",
  10543. updateTime: 1545017880000
  10544. },
  10545. {
  10546. moduleCode: "",
  10547. detailCode: "20600",
  10548. description: "临时密码数已达上限",
  10549. solution: "",
  10550. updateTime: 1544873457000
  10551. },
  10552. {
  10553. moduleCode: "",
  10554. detailCode: "901",
  10555. description: "",
  10556. solution: "",
  10557. updateTime: 1544693519000
  10558. },
  10559. {
  10560. moduleCode: "",
  10561. detailCode: "60210",
  10562. description: "图片数据错误",
  10563. solution: "",
  10564. updateTime: 1544604457000
  10565. },
  10566. {
  10567. moduleCode: "",
  10568. detailCode: "10013",
  10569. description: "您的应用没有权限调用",
  10570. solution: "",
  10571. updateTime: 1544416237000
  10572. },
  10573. {
  10574. moduleCode: "",
  10575. detailCode: "70007",
  10576. description: "授权码不存在",
  10577. solution: "",
  10578. updateTime: 1544179533000
  10579. },
  10580. {
  10581. moduleCode: "",
  10582. detailCode: "10015",
  10583. description: "授权地址不存在",
  10584. solution: "",
  10585. updateTime: 1544163240000
  10586. },
  10587. {
  10588. moduleCode: "",
  10589. detailCode: "320423",
  10590. description: "",
  10591. solution: "",
  10592. updateTime: 1544100685000
  10593. },
  10594. {
  10595. moduleCode: "",
  10596. detailCode: "370009",
  10597. description: "",
  10598. solution: "",
  10599. updateTime: 1544077151000
  10600. },
  10601. {
  10602. moduleCode: "",
  10603. detailCode: "10031",
  10604. description: "子账户或萤石用户没有权限",
  10605. solution: "",
  10606. updateTime: 1543990462000
  10607. },
  10608. {
  10609. moduleCode: "",
  10610. detailCode: "10055",
  10611. description: "设备不支持试用云存储服务",
  10612. solution: "",
  10613. updateTime: 1543986292000
  10614. },
  10615. {
  10616. moduleCode: "",
  10617. detailCode: "60042",
  10618. description: "添加的设备密码错误",
  10619. solution: "",
  10620. updateTime: 1543710913000
  10621. },
  10622. {
  10623. moduleCode: "",
  10624. detailCode: "60082",
  10625. description: "设备正在响应本次声源定位",
  10626. solution: "",
  10627. updateTime: 1543647426000
  10628. },
  10629. {
  10630. moduleCode: "",
  10631. detailCode: "10056",
  10632. description: "设备不支持云存储服务转出",
  10633. solution: "",
  10634. updateTime: 1543558342000
  10635. },
  10636. {
  10637. moduleCode: "",
  10638. detailCode: "20104",
  10639. description: "好友不存在",
  10640. solution: "",
  10641. updateTime: 1543492403000
  10642. },
  10643. {
  10644. moduleCode: "",
  10645. detailCode: "20111",
  10646. description: "好友不是等待验证状态,无法接受邀请",
  10647. solution: "",
  10648. updateTime: 1543492365000
  10649. },
  10650. {
  10651. moduleCode: "",
  10652. detailCode: "20107",
  10653. description: "不能添加自己为好友",
  10654. solution: "",
  10655. updateTime: 1543480986000
  10656. },
  10657. {
  10658. moduleCode: "",
  10659. detailCode: "1",
  10660. description: "设备返回其他错误",
  10661. solution: "",
  10662. updateTime: 1543459921000
  10663. },
  10664. {
  10665. moduleCode: "",
  10666. detailCode: "60084",
  10667. description: "当前正在关闭隐私遮蔽",
  10668. solution: "",
  10669. updateTime: 1543456515000
  10670. },
  10671. {
  10672. moduleCode: "",
  10673. detailCode: "380255",
  10674. description: "",
  10675. solution: "",
  10676. updateTime: 1543411652000
  10677. },
  10678. {
  10679. moduleCode: "",
  10680. detailCode: "20015",
  10681. description: "设备不支持",
  10682. solution: "",
  10683. updateTime: 1543390936000
  10684. },
  10685. {
  10686. moduleCode: "",
  10687. detailCode: "30003",
  10688. description: "手机验证码错误",
  10689. solution: "",
  10690. updateTime: 1543389137000
  10691. },
  10692. {
  10693. moduleCode: "",
  10694. detailCode: "20615",
  10695. description: "锁用户已存在",
  10696. solution: "",
  10697. updateTime: 1543388325000
  10698. },
  10699. {
  10700. moduleCode: "",
  10701. detailCode: "60061",
  10702. description: "账户流量已超出或未购买,限制开通",
  10703. solution: "",
  10704. updateTime: 1543372581000
  10705. },
  10706. {
  10707. moduleCode: "",
  10708. detailCode: "60020",
  10709. description: "设备不支持该信令",
  10710. solution: "",
  10711. updateTime: 1543321636000
  10712. },
  10713. {
  10714. moduleCode: "",
  10715. detailCode: "320146",
  10716. description: "",
  10717. solution: "",
  10718. updateTime: 1543318472000
  10719. },
  10720. {
  10721. moduleCode: "",
  10722. detailCode: "60018",
  10723. description: "设备升级失败",
  10724. solution: "",
  10725. updateTime: 1543304928000
  10726. },
  10727. {
  10728. moduleCode: "",
  10729. detailCode: "60044",
  10730. description: "添加的设备网络不可达超时",
  10731. solution: "",
  10732. updateTime: 1543304102000
  10733. },
  10734. {
  10735. moduleCode: "",
  10736. detailCode: "20619",
  10737. description: "主用户无法删除",
  10738. solution: "",
  10739. updateTime: 1543290219000
  10740. },
  10741. {
  10742. moduleCode: "",
  10743. detailCode: "20608",
  10744. description: "锁用户不存在",
  10745. solution: "",
  10746. updateTime: 1543281950000
  10747. },
  10748. {
  10749. moduleCode: "",
  10750. detailCode: "20609",
  10751. description: "设备响应超时,门锁通信故障或者电量不足,请重试.",
  10752. solution: "",
  10753. updateTime: 1543281601000
  10754. },
  10755. {
  10756. moduleCode: "",
  10757. detailCode: "1049954",
  10758. description: "升级设备失败",
  10759. solution: "",
  10760. updateTime: 1543279264000
  10761. },
  10762. {
  10763. moduleCode: "",
  10764. detailCode: "60009",
  10765. description: "正在调用预置点",
  10766. solution: "",
  10767. updateTime: 1543238114000
  10768. },
  10769. {
  10770. moduleCode: "",
  10771. detailCode: "1052677",
  10772. description: "获取本地录像失败",
  10773. solution: "",
  10774. updateTime: 1543207604000
  10775. },
  10776. {
  10777. moduleCode: "",
  10778. detailCode: "327000",
  10779. description: "",
  10780. solution: "",
  10781. updateTime: 1543196609000
  10782. },
  10783. {
  10784. moduleCode: "",
  10785. detailCode: "20021",
  10786. description: "设备在线,未被用户添加",
  10787. solution: "",
  10788. updateTime: 1543193436000
  10789. },
  10790. {
  10791. moduleCode: "",
  10792. detailCode: "20202",
  10793. description: "操作留言信息失败",
  10794. solution: "",
  10795. updateTime: 1543191562000
  10796. },
  10797. {
  10798. moduleCode: "",
  10799. detailCode: "1052678",
  10800. description: "获取本地录像失败",
  10801. solution: "",
  10802. updateTime: 1543132218000
  10803. },
  10804. {
  10805. moduleCode: "",
  10806. detailCode: "1054723",
  10807. description: "格式化设备失败",
  10808. solution: "",
  10809. updateTime: 1543129833000
  10810. },
  10811. {
  10812. moduleCode: "",
  10813. detailCode: "20109",
  10814. description: "对应分享不存在",
  10815. solution: "",
  10816. updateTime: 1543129111000
  10817. },
  10818. {
  10819. moduleCode: "",
  10820. detailCode: "60026",
  10821. description: "设备处于隐私遮蔽状态",
  10822. solution: "",
  10823. updateTime: 1543110403000
  10824. },
  10825. {
  10826. moduleCode: "",
  10827. detailCode: "60083",
  10828. description: "当前正在开启隐私遮蔽",
  10829. solution: "",
  10830. updateTime: 1543071148000
  10831. },
  10832. {
  10833. moduleCode: "",
  10834. detailCode: "60001",
  10835. description: "用户无云台控制权限",
  10836. solution: "",
  10837. updateTime: 1543059167000
  10838. },
  10839. {
  10840. moduleCode: "",
  10841. detailCode: "2003",
  10842. description: "设备不在线",
  10843. solution: "",
  10844. updateTime: 1543051046000
  10845. },
  10846. {
  10847. moduleCode: "",
  10848. detailCode: "-24",
  10849. description: "设置设备enable错误",
  10850. solution: "",
  10851. updateTime: 1543042701000
  10852. },
  10853. {
  10854. moduleCode: "",
  10855. detailCode: "10018",
  10856. description: "",
  10857. solution: "",
  10858. updateTime: 1543041564000
  10859. },
  10860. {
  10861. moduleCode: "",
  10862. detailCode: "20103",
  10863. description: "好友已存在",
  10864. solution: "",
  10865. updateTime: 1543038430000
  10866. },
  10867. {
  10868. moduleCode: "",
  10869. detailCode: "70010",
  10870. description: "授权异常请重试",
  10871. solution: "",
  10872. updateTime: 1543035590000
  10873. },
  10874. {
  10875. moduleCode: "",
  10876. detailCode: "60056",
  10877. description: "删除设备失败",
  10878. solution: "",
  10879. updateTime: 1543031275000
  10880. },
  10881. {
  10882. moduleCode: "",
  10883. detailCode: "60040",
  10884. description: "添加的设备不在同一局域网",
  10885. solution: "",
  10886. updateTime: 1543031210000
  10887. },
  10888. {
  10889. moduleCode: "",
  10890. detailCode: "60019",
  10891. description: "加密已开启",
  10892. solution: "",
  10893. updateTime: 1543029931000
  10894. },
  10895. {
  10896. moduleCode: "",
  10897. detailCode: "1054722",
  10898. description: "格式化设备失败",
  10899. solution: "",
  10900. updateTime: 1543028537000
  10901. },
  10902. {
  10903. moduleCode: "",
  10904. detailCode: "20016",
  10905. description: "当前设备正在格式化",
  10906. solution: "",
  10907. updateTime: 1543028537000
  10908. },
  10909. {
  10910. moduleCode: "",
  10911. detailCode: "10024",
  10912. description: "透明通道权限校验不通过",
  10913. solution: "",
  10914. updateTime: 1543025540000
  10915. },
  10916. {
  10917. moduleCode: "",
  10918. detailCode: "6002",
  10919. description: "删除设备失败!",
  10920. solution: "",
  10921. updateTime: 1543025026000
  10922. },
  10923. {
  10924. moduleCode: "",
  10925. detailCode: "1011",
  10926. description: "验证码错误!",
  10927. solution: "",
  10928. updateTime: 1543016865000
  10929. },
  10930. {
  10931. moduleCode: "",
  10932. detailCode: "60032",
  10933. description: "卡密已使用",
  10934. solution: "",
  10935. updateTime: 1543006668000
  10936. },
  10937. {
  10938. moduleCode: "",
  10939. detailCode: "10034",
  10940. description: "子账号已存在",
  10941. solution: "",
  10942. updateTime: 1542989194000
  10943. },
  10944. {
  10945. moduleCode: "",
  10946. detailCode: "20301",
  10947. description: "根据uuid查询联动信息不存在",
  10948. solution: "",
  10949. updateTime: 1542988651000
  10950. },
  10951. {
  10952. moduleCode: "",
  10953. detailCode: "1041",
  10954. description: "获取验证码过于频繁",
  10955. solution: "",
  10956. updateTime: 1542980953000
  10957. },
  10958. {
  10959. moduleCode: "",
  10960. detailCode: "10012",
  10961. description: "该appkey下已绑定重复的phone!",
  10962. solution: "",
  10963. updateTime: 1542980800000
  10964. },
  10965. {
  10966. moduleCode: "",
  10967. detailCode: "1008",
  10968. description: "phone不合法!",
  10969. solution: "",
  10970. updateTime: 1542979812000
  10971. },
  10972. {
  10973. moduleCode: "",
  10974. detailCode: "60023",
  10975. description: "订阅操作失败",
  10976. solution: "",
  10977. updateTime: 1542979006000
  10978. },
  10979. {
  10980. moduleCode: "",
  10981. detailCode: "5",
  10982. description: "设备返回其他错误",
  10983. solution: "",
  10984. updateTime: 1542977828000
  10985. },
  10986. {
  10987. moduleCode: "",
  10988. detailCode: "60006",
  10989. description: "云台当前操作失败",
  10990. solution: "",
  10991. updateTime: 1542977598000
  10992. },
  10993. {
  10994. moduleCode: "",
  10995. detailCode: "131",
  10996. description: "修改视频清晰度失败!",
  10997. solution: "",
  10998. updateTime: 1542977246000
  10999. },
  11000. {
  11001. moduleCode: "",
  11002. detailCode: "10019",
  11003. description: "密码错误",
  11004. solution: "",
  11005. updateTime: 1542976628000
  11006. },
  11007. {
  11008. moduleCode: "",
  11009. detailCode: "10004",
  11010. description: "用户不存在",
  11011. solution: "",
  11012. updateTime: 1542976268000
  11013. },
  11014. {
  11015. moduleCode: "",
  11016. detailCode: "20201",
  11017. description: "操作报警信息失败",
  11018. solution: "",
  11019. updateTime: 1542975906000
  11020. },
  11021. {
  11022. moduleCode: "",
  11023. detailCode: "20024",
  11024. description: "设备不在线,已经被别的用户添加",
  11025. solution: "",
  11026. updateTime: 1542975858000
  11027. },
  11028. {
  11029. moduleCode: "",
  11030. detailCode: "60004",
  11031. description: "设备云台旋转达到左限位",
  11032. solution: "",
  11033. updateTime: 1542975207000
  11034. },
  11035. {
  11036. moduleCode: "",
  11037. detailCode: "1052679",
  11038. description: "修改视频清晰度失败!",
  11039. solution: "",
  11040. updateTime: 1542974886000
  11041. },
  11042. {
  11043. moduleCode: "",
  11044. detailCode: "20031",
  11045. description: "请在萤石客户端关闭终端绑定",
  11046. solution: "",
  11047. updateTime: 1542974756000
  11048. },
  11049. {
  11050. moduleCode: "",
  11051. detailCode: "1053825",
  11052. description: "获取本地录像失败",
  11053. solution: "",
  11054. updateTime: 1542974692000
  11055. },
  11056. {
  11057. moduleCode: "",
  11058. detailCode: "60011",
  11059. description: "预置点不存在",
  11060. solution: "",
  11061. updateTime: 1542974414000
  11062. },
  11063. {
  11064. moduleCode: "",
  11065. detailCode: "1052936",
  11066. description: "修改视频清晰度失败!",
  11067. solution: "",
  11068. updateTime: 1542974390000
  11069. },
  11070. {
  11071. moduleCode: "",
  11072. detailCode: "1016",
  11073. description: "",
  11074. solution: "",
  11075. updateTime: 1542974273000
  11076. },
  11077. {
  11078. moduleCode: "",
  11079. detailCode: "10032",
  11080. description: "子账号不存在",
  11081. solution: "",
  11082. updateTime: 1542973906000
  11083. },
  11084. {
  11085. moduleCode: "",
  11086. detailCode: "20013",
  11087. description: "设备已被别人添加",
  11088. solution: "",
  11089. updateTime: 1542973817000
  11090. },
  11091. {
  11092. moduleCode: "",
  11093. detailCode: "50000",
  11094. description: "服务器错误!",
  11095. solution: "",
  11096. updateTime: 1542973801000
  11097. },
  11098. {
  11099. moduleCode: "",
  11100. detailCode: "60010",
  11101. description: "该预置点已经是当前位置",
  11102. solution: "",
  11103. updateTime: 1542973800000
  11104. },
  11105. {
  11106. moduleCode: "",
  11107. detailCode: "60003",
  11108. description: "设备云台旋转达到下限位",
  11109. solution: "",
  11110. updateTime: 1542973770000
  11111. },
  11112. {
  11113. moduleCode: "",
  11114. detailCode: "4",
  11115. description: "设备返回其他错误",
  11116. solution: "",
  11117. updateTime: 1542973755000
  11118. },
  11119. {
  11120. moduleCode: "",
  11121. detailCode: "60016",
  11122. description: "加密未开启,无需关闭",
  11123. solution: "",
  11124. updateTime: 1542973753000
  11125. },
  11126. {
  11127. moduleCode: "",
  11128. detailCode: "60002",
  11129. description: "设备云台旋转达到上限位",
  11130. solution: "",
  11131. updateTime: 1542973742000
  11132. },
  11133. {
  11134. moduleCode: "",
  11135. detailCode: "20023",
  11136. description: "设备不在线,未被用户添加",
  11137. solution: "",
  11138. updateTime: 1542973685000
  11139. },
  11140. {
  11141. moduleCode: "",
  11142. detailCode: "10008",
  11143. description: "",
  11144. solution: "",
  11145. updateTime: 1542973676000
  11146. },
  11147. {
  11148. moduleCode: "",
  11149. detailCode: "20010",
  11150. description: "设备验证码错误",
  11151. solution: "",
  11152. updateTime: 1542973658000
  11153. },
  11154. {
  11155. moduleCode: "",
  11156. detailCode: "60005",
  11157. description: "设备云台旋转达到右限位",
  11158. solution: "",
  11159. updateTime: 1542973657000
  11160. },
  11161. {
  11162. moduleCode: "",
  11163. detailCode: "20017",
  11164. description: "设备已经被自己添加",
  11165. solution: "",
  11166. updateTime: 1542973648000
  11167. },
  11168. {
  11169. moduleCode: "",
  11170. detailCode: "20020",
  11171. description: "设备在线,已经被自己添加",
  11172. solution: "",
  11173. updateTime: 1542973533000
  11174. },
  11175. {
  11176. moduleCode: "",
  11177. detailCode: "20029",
  11178. description: "设备不在线,已经被自己添加",
  11179. solution: "",
  11180. updateTime: 1542973530000
  11181. },
  11182. {
  11183. moduleCode: "",
  11184. detailCode: "10014",
  11185. description: "APPKEY下对应的第三方userId和phone未绑定!",
  11186. solution: "",
  11187. updateTime: 1542973499000
  11188. },
  11189. {
  11190. moduleCode: "",
  11191. detailCode: "20002",
  11192. description: "设备不存在",
  11193. solution: "",
  11194. updateTime: 1542973499000
  11195. },
  11196. {
  11197. moduleCode: "",
  11198. detailCode: "10030",
  11199. description: "appkey和appsecret不匹配",
  11200. solution: "",
  11201. updateTime: 1542973490000
  11202. },
  11203. {
  11204. moduleCode: "",
  11205. detailCode: "20022",
  11206. description: "设备在线,已经被别的用户添加",
  11207. solution: "",
  11208. updateTime: 1542973486000
  11209. },
  11210. {
  11211. moduleCode: "",
  11212. detailCode: "20008",
  11213. description: "设备响应超时",
  11214. solution: "",
  11215. updateTime: 1542973484000
  11216. },
  11217. {
  11218. moduleCode: "",
  11219. detailCode: "20032",
  11220. description: "该用户下通道不存在",
  11221. solution: "",
  11222. updateTime: 1542973481000
  11223. },
  11224. {
  11225. moduleCode: "",
  11226. detailCode: "20006",
  11227. description: "网络异常",
  11228. solution: "",
  11229. updateTime: 1542973475000
  11230. },
  11231. {
  11232. moduleCode: "",
  11233. detailCode: "20014",
  11234. description: "deviceSerial不合法!",
  11235. solution: "",
  11236. updateTime: 1542973454000
  11237. },
  11238. {
  11239. moduleCode: "",
  11240. detailCode: "20007",
  11241. description: "设备不在线",
  11242. solution: "",
  11243. updateTime: 1542973454000
  11244. },
  11245. {
  11246. moduleCode: "",
  11247. detailCode: "20018",
  11248. description: "该用户不拥有该设备",
  11249. solution: "",
  11250. updateTime: 1542973453000
  11251. },
  11252. {
  11253. moduleCode: "",
  11254. detailCode: "10010",
  11255. description: "",
  11256. solution: "",
  11257. updateTime: 1542973453000
  11258. },
  11259. {
  11260. moduleCode: "",
  11261. detailCode: "10011",
  11262. description: "未绑定!",
  11263. solution: "",
  11264. updateTime: 1542973453000
  11265. },
  11266. {
  11267. moduleCode: "",
  11268. detailCode: "20001",
  11269. description: "通道不存在!",
  11270. solution: "",
  11271. updateTime: 1542973452000
  11272. },
  11273. {
  11274. moduleCode: "",
  11275. detailCode: "10017",
  11276. description: "appKey不存在",
  11277. solution: "",
  11278. updateTime: 1542973451000
  11279. },
  11280. {
  11281. moduleCode: "",
  11282. detailCode: "400259",
  11283. description: "",
  11284. solution: "",
  11285. updateTime: 1542875643000
  11286. },
  11287. {
  11288. moduleCode: "",
  11289. detailCode: "400004",
  11290. description: "",
  11291. solution: "",
  11292. updateTime: 1542873364000
  11293. },
  11294. {
  11295. moduleCode: "",
  11296. detailCode: "3840",
  11297. description: "",
  11298. solution: "",
  11299. updateTime: 1541860000000
  11300. },
  11301. {
  11302. moduleCode: "",
  11303. detailCode: "-1017",
  11304. description: "",
  11305. solution: "",
  11306. updateTime: 1541733663000
  11307. },
  11308. {
  11309. moduleCode: "",
  11310. detailCode: "320025",
  11311. description: "",
  11312. solution: "",
  11313. updateTime: 1541078281000
  11314. },
  11315. {
  11316. moduleCode: "",
  11317. detailCode: "320024",
  11318. description: "",
  11319. solution: "",
  11320. updateTime: 1540801374000
  11321. },
  11322. {
  11323. moduleCode: "",
  11324. detailCode: "321002",
  11325. description: "",
  11326. solution: "",
  11327. updateTime: 1540631734000
  11328. },
  11329. {
  11330. moduleCode: "",
  11331. detailCode: "321000",
  11332. description: "",
  11333. solution: "",
  11334. updateTime: 1540609178000
  11335. },
  11336. {
  11337. moduleCode: "",
  11338. detailCode: "321022",
  11339. description: "",
  11340. solution: "",
  11341. updateTime: 1540548345000
  11342. },
  11343. {
  11344. moduleCode: "",
  11345. detailCode: "321016",
  11346. description: "",
  11347. solution: "",
  11348. updateTime: 1540287187000
  11349. },
  11350. {
  11351. moduleCode: "",
  11352. detailCode: "320023",
  11353. description: "",
  11354. solution: "",
  11355. updateTime: 1539825993000
  11356. },
  11357. {
  11358. moduleCode: "",
  11359. detailCode: "-1016",
  11360. description: "",
  11361. solution: "",
  11362. updateTime: 1539584931000
  11363. },
  11364. {
  11365. moduleCode: "",
  11366. detailCode: "8",
  11367. description: "",
  11368. solution: "",
  11369. updateTime: 1539391812000
  11370. },
  11371. {
  11372. moduleCode: "",
  11373. detailCode: "1075127593",
  11374. description: "",
  11375. solution: "",
  11376. updateTime: 1538959251000
  11377. },
  11378. {
  11379. moduleCode: "",
  11380. detailCode: "380421",
  11381. description: "",
  11382. solution: "",
  11383. updateTime: 1537288465000
  11384. },
  11385. {
  11386. moduleCode: "",
  11387. detailCode: "322000",
  11388. description: "麦克风权限未开启",
  11389. solution: "",
  11390. updateTime: 1536820136000
  11391. },
  11392. {
  11393. moduleCode: "",
  11394. detailCode: "1152678",
  11395. description: "",
  11396. solution: "",
  11397. updateTime: 1536738348000
  11398. },
  11399. {
  11400. moduleCode: "",
  11401. detailCode: "320047",
  11402. description: "",
  11403. solution: "",
  11404. updateTime: 1536664472000
  11405. },
  11406. {
  11407. moduleCode: "",
  11408. detailCode: "327006",
  11409. description: "",
  11410. solution: "",
  11411. updateTime: 1536136120000
  11412. },
  11413. {
  11414. moduleCode: "",
  11415. detailCode: "1074807593",
  11416. description: "",
  11417. solution: "",
  11418. updateTime: 1536135035000
  11419. },
  11420. {
  11421. moduleCode: "",
  11422. detailCode: "320291",
  11423. description: "",
  11424. solution: "",
  11425. updateTime: 1536110836000
  11426. },
  11427. {
  11428. moduleCode: "",
  11429. detailCode: "320045",
  11430. description: "",
  11431. solution: "",
  11432. updateTime: 1535963775000
  11433. },
  11434. {
  11435. moduleCode: "",
  11436. detailCode: "370004",
  11437. description: "",
  11438. solution: "",
  11439. updateTime: 1535883699000
  11440. },
  11441. {
  11442. moduleCode: "",
  11443. detailCode: "1149954",
  11444. description: "",
  11445. solution: "",
  11446. updateTime: 1535700674000
  11447. },
  11448. {
  11449. moduleCode: "",
  11450. detailCode: "320053",
  11451. description: "",
  11452. solution: "",
  11453. updateTime: 1535681079000
  11454. },
  11455. {
  11456. moduleCode: "",
  11457. detailCode: "400000",
  11458. description: "",
  11459. solution: "",
  11460. updateTime: 1535532332000
  11461. },
  11462. {
  11463. moduleCode: "",
  11464. detailCode: "110028",
  11465. description: "个人版抓图接口日调用次数超出限制",
  11466. solution: "请升级企业版:https://open.ys7.com/price.html",
  11467. updateTime: 1535348756000
  11468. },
  11469. {
  11470. moduleCode: "",
  11471. detailCode: "110027",
  11472. description: "个人版帐号数量超出安全限制,无法调用",
  11473. solution: "请升级企业版:https://open.ys7.com/price.html",
  11474. updateTime: 1535348734000
  11475. },
  11476. {
  11477. moduleCode: "",
  11478. detailCode: "110026",
  11479. description: "设备数量超出个人版限制,当前设备无法操作",
  11480. solution: "请升级企业版:https://open.ys7.com/price.html",
  11481. updateTime: 1535348588000
  11482. },
  11483. {
  11484. moduleCode: "",
  11485. detailCode: "100000",
  11486. description: "",
  11487. solution: "",
  11488. updateTime: 1534980008000
  11489. },
  11490. {
  11491. moduleCode: "",
  11492. detailCode: "324004",
  11493. description: "",
  11494. solution: "",
  11495. updateTime: 1534927762000
  11496. },
  11497. {
  11498. moduleCode: "",
  11499. detailCode: "360104",
  11500. description: "",
  11501. solution: "",
  11502. updateTime: 1534761006000
  11503. },
  11504. {
  11505. moduleCode: "",
  11506. detailCode: "320204",
  11507. description: "",
  11508. solution: "",
  11509. updateTime: 1534584221000
  11510. },
  11511. {
  11512. moduleCode: "",
  11513. detailCode: "380001",
  11514. description: "",
  11515. solution: "",
  11516. updateTime: 1534404715000
  11517. },
  11518. {
  11519. moduleCode: "",
  11520. detailCode: "380204",
  11521. description: "",
  11522. solution: "",
  11523. updateTime: 1534401682000
  11524. },
  11525. {
  11526. moduleCode: "",
  11527. detailCode: "328006",
  11528. description: "",
  11529. solution: "",
  11530. updateTime: 1534144407000
  11531. },
  11532. {
  11533. moduleCode: "",
  11534. detailCode: "321703",
  11535. description: "",
  11536. solution: "",
  11537. updateTime: 1534127274000
  11538. },
  11539. {
  11540. moduleCode: "",
  11541. detailCode: "321510",
  11542. description: "",
  11543. solution: "",
  11544. updateTime: 1533428892000
  11545. },
  11546. {
  11547. moduleCode: "",
  11548. detailCode: "321006",
  11549. description: "",
  11550. solution: "",
  11551. updateTime: 1533036916000
  11552. },
  11553. {
  11554. moduleCode: "",
  11555. detailCode: "50009",
  11556. description: "",
  11557. solution: "",
  11558. updateTime: 1532078548000
  11559. },
  11560. {
  11561. moduleCode: "",
  11562. detailCode: "50007",
  11563. description: "",
  11564. solution: "",
  11565. updateTime: 1531991720000
  11566. },
  11567. {
  11568. moduleCode: "",
  11569. detailCode: "50018",
  11570. description: "",
  11571. solution: "",
  11572. updateTime: 1531912829000
  11573. },
  11574. {
  11575. moduleCode: "",
  11576. detailCode: "380451",
  11577. description: "",
  11578. solution: "",
  11579. updateTime: 1531615700000
  11580. },
  11581. {
  11582. moduleCode: "",
  11583. detailCode: "380336",
  11584. description: "",
  11585. solution: "",
  11586. updateTime: 1531231721000
  11587. },
  11588. {
  11589. moduleCode: "",
  11590. detailCode: "360020",
  11591. description: "",
  11592. solution: "",
  11593. updateTime: 1531117554000
  11594. },
  11595. {
  11596. moduleCode: "",
  11597. detailCode: "380418",
  11598. description: "",
  11599. solution: "",
  11600. updateTime: 1531107070000
  11601. },
  11602. {
  11603. moduleCode: "",
  11604. detailCode: "1153445",
  11605. description: "设备在该时间段内没有录像",
  11606. solution: "",
  11607. updateTime: 1530944007000
  11608. },
  11609. {
  11610. moduleCode: "",
  11611. detailCode: "110007",
  11612. description: "调用接口总次数达到上限",
  11613. solution: "请升级企业版,获取更高能力",
  11614. updateTime: 1530935584000
  11615. },
  11616. {
  11617. moduleCode: "",
  11618. detailCode: "360019",
  11619. description: "",
  11620. solution: "",
  11621. updateTime: 1530869771000
  11622. },
  11623. {
  11624. moduleCode: "",
  11625. detailCode: "360100",
  11626. description: "",
  11627. solution: "",
  11628. updateTime: 1530786188000
  11629. },
  11630. {
  11631. moduleCode: "",
  11632. detailCode: "380042",
  11633. description: "",
  11634. solution: "",
  11635. updateTime: 1530775199000
  11636. },
  11637. {
  11638. moduleCode: "",
  11639. detailCode: "320355",
  11640. description: "",
  11641. solution: "",
  11642. updateTime: 1530716074000
  11643. },
  11644. {
  11645. moduleCode: "",
  11646. detailCode: "100003",
  11647. description: "",
  11648. solution: "",
  11649. updateTime: 1530232541000
  11650. },
  11651. {
  11652. moduleCode: "",
  11653. detailCode: "371026",
  11654. description: "",
  11655. solution: "",
  11656. updateTime: 1530192600000
  11657. },
  11658. {
  11659. moduleCode: "",
  11660. detailCode: "102",
  11661. description: "",
  11662. solution: "",
  11663. updateTime: 1529895641000
  11664. },
  11665. {
  11666. moduleCode: "",
  11667. detailCode: "380201",
  11668. description: "",
  11669. solution: "",
  11670. updateTime: 1529740929000
  11671. },
  11672. {
  11673. moduleCode: "",
  11674. detailCode: "320054",
  11675. description: "",
  11676. solution: "",
  11677. updateTime: 1529544875000
  11678. },
  11679. {
  11680. moduleCode: "",
  11681. detailCode: "500101",
  11682. description: "",
  11683. solution: "",
  11684. updateTime: 1529485953000
  11685. },
  11686. {
  11687. moduleCode: "",
  11688. detailCode: "321001",
  11689. description: "",
  11690. solution: "",
  11691. updateTime: 1529411048000
  11692. },
  11693. {
  11694. moduleCode: "",
  11695. detailCode: "321508",
  11696. description: "",
  11697. solution: "",
  11698. updateTime: 1529393279000
  11699. },
  11700. {
  11701. moduleCode: "",
  11702. detailCode: "405991",
  11703. description: "",
  11704. solution: "",
  11705. updateTime: 1529380238000
  11706. },
  11707. {
  11708. moduleCode: "",
  11709. detailCode: "380461",
  11710. description: "",
  11711. solution: "",
  11712. updateTime: 1529130941000
  11713. },
  11714. {
  11715. moduleCode: "",
  11716. detailCode: "-1019",
  11717. description: "",
  11718. solution: "",
  11719. updateTime: 1529057245000
  11720. },
  11721. {
  11722. moduleCode: "",
  11723. detailCode: "322009",
  11724. description: "",
  11725. solution: "",
  11726. updateTime: 1528965717000
  11727. },
  11728. {
  11729. moduleCode: "",
  11730. detailCode: "324005",
  11731. description: "",
  11732. solution: "",
  11733. updateTime: 1528950153000
  11734. },
  11735. {
  11736. moduleCode: "",
  11737. detailCode: "325000",
  11738. description: "",
  11739. solution: "",
  11740. updateTime: 1528947143000
  11741. },
  11742. {
  11743. moduleCode: "",
  11744. detailCode: "326032",
  11745. description: "",
  11746. solution: "",
  11747. updateTime: 1528872971000
  11748. },
  11749. {
  11750. moduleCode: "",
  11751. detailCode: "325032",
  11752. description: "",
  11753. solution: "",
  11754. updateTime: 1528863189000
  11755. },
  11756. {
  11757. moduleCode: "",
  11758. detailCode: "328000",
  11759. description: "",
  11760. solution: "",
  11761. updateTime: 1528794505000
  11762. },
  11763. {
  11764. moduleCode: "",
  11765. detailCode: "53",
  11766. description: "",
  11767. solution: "",
  11768. updateTime: 1528693249000
  11769. },
  11770. {
  11771. moduleCode: "",
  11772. detailCode: "-1020",
  11773. description: "",
  11774. solution: "",
  11775. updateTime: 1528499440000
  11776. },
  11777. {
  11778. moduleCode: "",
  11779. detailCode: "329032",
  11780. description: "",
  11781. solution: "",
  11782. updateTime: 1528446301000
  11783. },
  11784. {
  11785. moduleCode: "",
  11786. detailCode: "-1202",
  11787. description: "",
  11788. solution: "",
  11789. updateTime: 1528439820000
  11790. },
  11791. {
  11792. moduleCode: "",
  11793. detailCode: "2",
  11794. description: "",
  11795. solution: "",
  11796. updateTime: 1528434175000
  11797. },
  11798. {
  11799. moduleCode: "",
  11800. detailCode: "1152936",
  11801. description: "",
  11802. solution: "",
  11803. updateTime: 1528345986000
  11804. },
  11805. {
  11806. moduleCode: "",
  11807. detailCode: "328011",
  11808. description: "",
  11809. solution: "",
  11810. updateTime: 1528338600000
  11811. },
  11812. {
  11813. moduleCode: "",
  11814. detailCode: "28",
  11815. description: "",
  11816. solution: "",
  11817. updateTime: 1528337530000
  11818. },
  11819. {
  11820. moduleCode: "",
  11821. detailCode: "320356",
  11822. description: "",
  11823. solution: "",
  11824. updateTime: 1528188693000
  11825. },
  11826. {
  11827. moduleCode: "",
  11828. detailCode: "320357",
  11829. description: "",
  11830. solution: "",
  11831. updateTime: 1528188517000
  11832. },
  11833. {
  11834. moduleCode: "",
  11835. detailCode: "405800",
  11836. description: "",
  11837. solution: "",
  11838. updateTime: 1528168732000
  11839. },
  11840. {
  11841. moduleCode: "",
  11842. detailCode: "405996",
  11843. description: "",
  11844. solution: "",
  11845. updateTime: 1528168686000
  11846. },
  11847. {
  11848. moduleCode: "",
  11849. detailCode: "380357",
  11850. description: "",
  11851. solution: "",
  11852. updateTime: 1528011565000
  11853. },
  11854. {
  11855. moduleCode: "",
  11856. detailCode: "328022",
  11857. description: "",
  11858. solution: "",
  11859. updateTime: 1527929065000
  11860. },
  11861. {
  11862. moduleCode: "",
  11863. detailCode: "380003",
  11864. description: "",
  11865. solution: "",
  11866. updateTime: 1527927819000
  11867. },
  11868. {
  11869. moduleCode: "",
  11870. detailCode: "50004",
  11871. description: "",
  11872. solution: "",
  11873. updateTime: 1527770643000
  11874. },
  11875. {
  11876. moduleCode: "",
  11877. detailCode: "50011",
  11878. description: "",
  11879. solution: "",
  11880. updateTime: 1527770635000
  11881. },
  11882. {
  11883. moduleCode: "",
  11884. detailCode: "370017",
  11885. description: "",
  11886. solution: "",
  11887. updateTime: 1527739514000
  11888. },
  11889. {
  11890. moduleCode: "",
  11891. detailCode: "327032",
  11892. description: "",
  11893. solution: "",
  11894. updateTime: 1527726704000
  11895. },
  11896. {
  11897. moduleCode: "",
  11898. detailCode: "324001",
  11899. description: "",
  11900. solution: "",
  11901. updateTime: 1527681892000
  11902. },
  11903. {
  11904. moduleCode: "",
  11905. detailCode: "405997",
  11906. description: "",
  11907. solution: "",
  11908. updateTime: 1527653408000
  11909. },
  11910. {
  11911. moduleCode: "",
  11912. detailCode: "405995",
  11913. description: "",
  11914. solution: "",
  11915. updateTime: 1527647283000
  11916. },
  11917. {
  11918. moduleCode: "",
  11919. detailCode: "1153825",
  11920. description: "",
  11921. solution: "",
  11922. updateTime: 1527601747000
  11923. },
  11924. {
  11925. moduleCode: "",
  11926. detailCode: "328002",
  11927. description: "",
  11928. solution: "",
  11929. updateTime: 1527495292000
  11930. },
  11931. {
  11932. moduleCode: "",
  11933. detailCode: "1152679",
  11934. description: "",
  11935. solution: "",
  11936. updateTime: 1527486665000
  11937. },
  11938. {
  11939. moduleCode: "",
  11940. detailCode: "380356",
  11941. description: "",
  11942. solution: "",
  11943. updateTime: 1527125669000
  11944. },
  11945. {
  11946. moduleCode: "",
  11947. detailCode: "328032",
  11948. description: "",
  11949. solution: "",
  11950. updateTime: 1527069382000
  11951. },
  11952. {
  11953. moduleCode: "",
  11954. detailCode: "22",
  11955. description: "",
  11956. solution: "",
  11957. updateTime: 1527049826000
  11958. },
  11959. {
  11960. moduleCode: "",
  11961. detailCode: "9",
  11962. description: "",
  11963. solution: "",
  11964. updateTime: 1527006778000
  11965. },
  11966. {
  11967. moduleCode: "",
  11968. detailCode: "89",
  11969. description: "",
  11970. solution: "",
  11971. updateTime: 1526622784000
  11972. },
  11973. {
  11974. moduleCode: "",
  11975. detailCode: "328016",
  11976. description: "",
  11977. solution: "",
  11978. updateTime: 1526452365000
  11979. },
  11980. {
  11981. moduleCode: "",
  11982. detailCode: "368005",
  11983. description: "",
  11984. solution: "",
  11985. updateTime: 1525921264000
  11986. },
  11987. {
  11988. moduleCode: "",
  11989. detailCode: "0",
  11990. description: "",
  11991. solution: "",
  11992. updateTime: 1525920242000
  11993. },
  11994. {
  11995. moduleCode: "",
  11996. detailCode: "380006",
  11997. description: "",
  11998. solution: "",
  11999. updateTime: 1525918868000
  12000. },
  12001. {
  12002. moduleCode: "",
  12003. detailCode: "310",
  12004. description: "",
  12005. solution: "",
  12006. updateTime: 1525834436000
  12007. },
  12008. {
  12009. moduleCode: "",
  12010. detailCode: "360011",
  12011. description: "",
  12012. solution: "",
  12013. updateTime: 1525681552000
  12014. },
  12015. {
  12016. moduleCode: "",
  12017. detailCode: "170005",
  12018. description: "",
  12019. solution: "",
  12020. updateTime: 1525433900000
  12021. },
  12022. {
  12023. moduleCode: "",
  12024. detailCode: "50023",
  12025. description: "",
  12026. solution: "",
  12027. updateTime: 1525403338000
  12028. },
  12029. {
  12030. moduleCode: "",
  12031. detailCode: "100131",
  12032. description: "",
  12033. solution: "",
  12034. updateTime: 1525229691000
  12035. },
  12036. {
  12037. moduleCode: "",
  12038. detailCode: "-1018",
  12039. description: "",
  12040. solution: "",
  12041. updateTime: 1525142341000
  12042. },
  12043. {
  12044. moduleCode: "",
  12045. detailCode: "362026",
  12046. description: "",
  12047. solution: "",
  12048. updateTime: 1524882677000
  12049. },
  12050. {
  12051. moduleCode: "",
  12052. detailCode: "368007",
  12053. description: "",
  12054. solution: "",
  12055. updateTime: 1524832269000
  12056. },
  12057. {
  12058. moduleCode: "",
  12059. detailCode: "54",
  12060. description: "",
  12061. solution: "",
  12062. updateTime: 1524793646000
  12063. },
  12064. {
  12065. moduleCode: "",
  12066. detailCode: "1154722",
  12067. description: "",
  12068. solution: "",
  12069. updateTime: 1524620807000
  12070. },
  12071. {
  12072. moduleCode: "",
  12073. detailCode: "320229",
  12074. description: "",
  12075. solution: "",
  12076. updateTime: 1524551682000
  12077. },
  12078. {
  12079. moduleCode: "",
  12080. detailCode: "360012",
  12081. description: "",
  12082. solution: "",
  12083. updateTime: 1524472094000
  12084. },
  12085. {
  12086. moduleCode: "",
  12087. detailCode: "380229",
  12088. description: "",
  12089. solution: "",
  12090. updateTime: 1524110755000
  12091. },
  12092. {
  12093. moduleCode: "",
  12094. detailCode: "360016",
  12095. description: "",
  12096. solution: "",
  12097. updateTime: 1523933518000
  12098. },
  12099. {
  12100. moduleCode: "",
  12101. detailCode: "-1003",
  12102. description: "",
  12103. solution: "",
  12104. updateTime: 1523584804000
  12105. },
  12106. {
  12107. moduleCode: "",
  12108. detailCode: "410026",
  12109. description: "",
  12110. solution: "",
  12111. updateTime: 1523517430000
  12112. },
  12113. {
  12114. moduleCode: "",
  12115. detailCode: "360102",
  12116. description: "TTS初始化失败",
  12117. solution: "",
  12118. updateTime: 1523503528000
  12119. },
  12120. {
  12121. moduleCode: "",
  12122. detailCode: "360013",
  12123. description: "设备开启了隐私保护",
  12124. solution: "",
  12125. updateTime: 1523503507000
  12126. },
  12127. {
  12128. moduleCode: "",
  12129. detailCode: "360010",
  12130. description: "设备正在对讲中",
  12131. solution: "",
  12132. updateTime: 1523503491000
  12133. },
  12134. {
  12135. moduleCode: "",
  12136. detailCode: "360007",
  12137. description: "TTS关闭了与客户端的连接",
  12138. solution: "",
  12139. updateTime: 1523503475000
  12140. },
  12141. {
  12142. moduleCode: "",
  12143. detailCode: "360006",
  12144. description: "客户端接收发生错误",
  12145. solution: "",
  12146. updateTime: 1523503457000
  12147. },
  12148. {
  12149. moduleCode: "",
  12150. detailCode: "360005",
  12151. description: "客户端发送的消息错误",
  12152. solution: "",
  12153. updateTime: 1523503437000
  12154. },
  12155. {
  12156. moduleCode: "",
  12157. detailCode: "360004",
  12158. description: "TTS内部发生错误",
  12159. solution: "",
  12160. updateTime: 1523503421000
  12161. },
  12162. {
  12163. moduleCode: "",
  12164. detailCode: "360003",
  12165. description: "TTS的设备端发生错误",
  12166. solution: "",
  12167. updateTime: 1523503397000
  12168. },
  12169. {
  12170. moduleCode: "",
  12171. detailCode: "360002",
  12172. description: "对讲发起超时",
  12173. solution: "",
  12174. updateTime: 1523503376000
  12175. },
  12176. {
  12177. moduleCode: "",
  12178. detailCode: "360001",
  12179. description: "客户端请求超时",
  12180. solution: "",
  12181. updateTime: 1523503357000
  12182. },
  12183. {
  12184. moduleCode: "",
  12185. detailCode: "320077",
  12186. description: "",
  12187. solution: "",
  12188. updateTime: 1523444274000
  12189. },
  12190. {
  12191. moduleCode: "",
  12192. detailCode: "370047",
  12193. description: "",
  12194. solution: "",
  12195. updateTime: 1523440480000
  12196. },
  12197. {
  12198. moduleCode: "",
  12199. detailCode: "100002",
  12200. description: "",
  12201. solution: "",
  12202. updateTime: 1523413964000
  12203. },
  12204. {
  12205. moduleCode: "",
  12206. detailCode: "-1004",
  12207. description: "",
  12208. solution: "",
  12209. updateTime: 1523336653000
  12210. },
  12211. {
  12212. moduleCode: "",
  12213. detailCode: "380000",
  12214. description: "",
  12215. solution: "",
  12216. updateTime: 1523180856000
  12217. },
  12218. {
  12219. moduleCode: "",
  12220. detailCode: "380213",
  12221. description: "",
  12222. solution: "",
  12223. updateTime: 1523180623000
  12224. },
  12225. {
  12226. moduleCode: "",
  12227. detailCode: "380101",
  12228. description: "",
  12229. solution: "",
  12230. updateTime: 1522834231000
  12231. },
  12232. {
  12233. moduleCode: "",
  12234. detailCode: "50047",
  12235. description: "",
  12236. solution: "",
  12237. updateTime: 1522833243000
  12238. },
  12239. {
  12240. moduleCode: "",
  12241. detailCode: "-999",
  12242. description: "",
  12243. solution: "",
  12244. updateTime: 1522831034000
  12245. },
  12246. {
  12247. moduleCode: "",
  12248. detailCode: "320418",
  12249. description: "",
  12250. solution: "",
  12251. updateTime: 1522829072000
  12252. },
  12253. {
  12254. moduleCode: "",
  12255. detailCode: "-1009",
  12256. description: "",
  12257. solution: "",
  12258. updateTime: 1522746247000
  12259. },
  12260. {
  12261. moduleCode: "",
  12262. detailCode: "320209",
  12263. description: "",
  12264. solution: "",
  12265. updateTime: 1522744395000
  12266. },
  12267. {
  12268. moduleCode: "",
  12269. detailCode: "368006",
  12270. description: "",
  12271. solution: "",
  12272. updateTime: 1522744300000
  12273. },
  12274. {
  12275. moduleCode: "",
  12276. detailCode: "369003",
  12277. description: "",
  12278. solution: "",
  12279. updateTime: 1522736355000
  12280. },
  12281. {
  12282. moduleCode: "",
  12283. detailCode: "405989",
  12284. description: "",
  12285. solution: "",
  12286. updateTime: 1522726571000
  12287. },
  12288. {
  12289. moduleCode: "",
  12290. detailCode: "-1012",
  12291. description: "",
  12292. solution: "",
  12293. updateTime: 1522726203000
  12294. },
  12295. {
  12296. moduleCode: "",
  12297. detailCode: "322016",
  12298. description: "",
  12299. solution: "",
  12300. updateTime: 1522722918000
  12301. },
  12302. {
  12303. moduleCode: "",
  12304. detailCode: "500103",
  12305. description: "",
  12306. solution: "",
  12307. updateTime: 1522655556000
  12308. },
  12309. {
  12310. moduleCode: "",
  12311. detailCode: "405999",
  12312. description: "",
  12313. solution: "",
  12314. updateTime: 1522654716000
  12315. },
  12316. {
  12317. moduleCode: "",
  12318. detailCode: "321032",
  12319. description: "",
  12320. solution: "",
  12321. updateTime: 1522647732000
  12322. },
  12323. {
  12324. moduleCode: "",
  12325. detailCode: "381101",
  12326. description: "",
  12327. solution: "",
  12328. updateTime: 1522392414000
  12329. },
  12330. {
  12331. moduleCode: "",
  12332. detailCode: "399999",
  12333. description: "",
  12334. solution: "",
  12335. updateTime: 1522379834000
  12336. },
  12337. {
  12338. moduleCode: "",
  12339. detailCode: "380103",
  12340. description: "",
  12341. solution: "",
  12342. updateTime: 1522312724000
  12343. },
  12344. {
  12345. moduleCode: "",
  12346. detailCode: "360014",
  12347. description: "",
  12348. solution: "",
  12349. updateTime: 1522304341000
  12350. },
  12351. {
  12352. moduleCode: "",
  12353. detailCode: "-1005",
  12354. description: "",
  12355. solution: "",
  12356. updateTime: 1522288195000
  12357. },
  12358. {
  12359. moduleCode: "",
  12360. detailCode: "100005",
  12361. description: "",
  12362. solution: "",
  12363. updateTime: 1522218849000
  12364. },
  12365. {
  12366. moduleCode: "",
  12367. detailCode: "100004",
  12368. description: "",
  12369. solution: "",
  12370. updateTime: 1522209053000
  12371. },
  12372. {
  12373. moduleCode: "",
  12374. detailCode: "106002",
  12375. description: "",
  12376. solution: "",
  12377. updateTime: 1522206200000
  12378. },
  12379. {
  12380. moduleCode: "",
  12381. detailCode: "410030",
  12382. description: "",
  12383. solution: "",
  12384. updateTime: 1522162252000
  12385. },
  12386. {
  12387. moduleCode: "",
  12388. detailCode: "-1002",
  12389. description: "",
  12390. solution: "",
  12391. updateTime: 1522150690000
  12392. },
  12393. {
  12394. moduleCode: "",
  12395. detailCode: "-1200",
  12396. description: "",
  12397. solution: "",
  12398. updateTime: 1522139025000
  12399. },
  12400. {
  12401. moduleCode: "",
  12402. detailCode: "-1001",
  12403. description: "",
  12404. solution: "",
  12405. updateTime: 1522046436000
  12406. },
  12407. {
  12408. moduleCode: "",
  12409. detailCode: "-1011",
  12410. description: "",
  12411. solution: "",
  12412. updateTime: 1522045931000
  12413. },
  12414. {
  12415. moduleCode: "",
  12416. detailCode: "381102",
  12417. description: "",
  12418. solution: "",
  12419. updateTime: 1522044953000
  12420. },
  12421. {
  12422. moduleCode: "",
  12423. detailCode: "381103",
  12424. description: "",
  12425. solution: "",
  12426. updateTime: 1522044953000
  12427. },
  12428. {
  12429. moduleCode: "",
  12430. detailCode: "391205",
  12431. description: "vtdu解析服务器ip失败",
  12432. solution: "",
  12433. updateTime: 1522034841000
  12434. },
  12435. {
  12436. moduleCode: "",
  12437. detailCode: "391206",
  12438. description: "vtdu描述符select失败",
  12439. solution: "",
  12440. updateTime: 1522034841000
  12441. },
  12442. {
  12443. moduleCode: "",
  12444. detailCode: "391207",
  12445. description: "vtdu文件描述符不在可读中",
  12446. solution: "",
  12447. updateTime: 1522034841000
  12448. },
  12449. {
  12450. moduleCode: "",
  12451. detailCode: "391208",
  12452. description: "vtdu网络发生错误getsockopt",
  12453. solution: "",
  12454. updateTime: 1522034841000
  12455. },
  12456. {
  12457. moduleCode: "",
  12458. detailCode: "391209",
  12459. description: "vtdu描述符select超时",
  12460. solution: "",
  12461. updateTime: 1522034841000
  12462. },
  12463. {
  12464. moduleCode: "",
  12465. detailCode: "395000",
  12466. description: "cas回复信令,发现内存已经释放(和设备之间异常断开)",
  12467. msg: "播放失败请重试",
  12468. solution: "检查设备网络;刷新重试",
  12469. updateTime: 1522034841000
  12470. },
  12471. {
  12472. moduleCode: "",
  12473. detailCode: "395400",
  12474. description: "私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",
  12475. msg: "播放失败请重试",
  12476. solution: "刷新重试",
  12477. updateTime: 1522034841000
  12478. },
  12479. {
  12480. moduleCode: "",
  12481. detailCode: "395402",
  12482. description: "回放找不到录像文件",
  12483. msg: "回放找不到录像文件,本地存储请检查存储卡是否接触良好",
  12484. solution: "检查是否有存储卡并且接触良好",
  12485. updateTime: 1522034841000
  12486. },
  12487. {
  12488. moduleCode: "",
  12489. detailCode: "395403",
  12490. description: "操作码或信令密钥与设备不匹配",
  12491. msg: "播放失败",
  12492. solution: "",
  12493. updateTime: 1522034841000
  12494. },
  12495. {
  12496. moduleCode: "",
  12497. detailCode: "395404",
  12498. description: "设备不在线",
  12499. solution: "检查设备网络;重启设备接入萤石云",
  12500. msg: "设备不在线,请检查设备网络或重启设备接入萤石云",
  12501. updateTime: 1522034841000
  12502. },
  12503. {
  12504. moduleCode: "",
  12505. detailCode: "395405",
  12506. description: "流媒体向设备发送或接受信令超时/cas响应超时",
  12507. msg: "播放失败,请检查设备网络或重启设备",
  12508. solution: "检查设备网络;重启设备",
  12509. updateTime: 1522034841000
  12510. },
  12511. {
  12512. moduleCode: "",
  12513. detailCode: "395406",
  12514. description: "token失效",
  12515. msg: "播放失败请重试或重启设备",
  12516. solution: "刷新重试或者重启设备",
  12517. updateTime: 1522034841000
  12518. },
  12519. {
  12520. moduleCode: "",
  12521. detailCode: "395407",
  12522. description: "客户端的URL格式错误",
  12523. msg: "播放失败请重试",
  12524. solution: "刷新重试",
  12525. updateTime: 1522034841000
  12526. },
  12527. {
  12528. moduleCode: "",
  12529. detailCode: "395409",
  12530. description: "预览开启隐私保护",
  12531. msg: "播放失败请关闭隐私遮蔽",
  12532. solution: "",
  12533. updateTime: 1522034841000
  12534. },
  12535. {
  12536. moduleCode: "",
  12537. detailCode: "395410",
  12538. description: "设备达到最大连接数",
  12539. solution: "请升级设备固件版本",
  12540. updateTime: 1522034841000
  12541. },
  12542. {
  12543. moduleCode: "",
  12544. detailCode: "395411",
  12545. description: "token无权限",
  12546. msg: "播放失败",
  12547. solution: "刷新重试",
  12548. updateTime: 1522034841000
  12549. },
  12550. {
  12551. moduleCode: "",
  12552. detailCode: "395412",
  12553. description: "session不存在",
  12554. msg: "播放失败",
  12555. solution: "",
  12556. updateTime: 1522034841000
  12557. },
  12558. {
  12559. moduleCode: "",
  12560. detailCode: "395413",
  12561. description: "验证token的他异常(不具体) ",
  12562. msg: "播放失败请重试",
  12563. solution: "刷新重试",
  12564. updateTime: 1522034841000
  12565. },
  12566. {
  12567. moduleCode: "",
  12568. detailCode: "395415",
  12569. description: "设备通道错",
  12570. msg: "播放失败请重试",
  12571. solution: "刷新重试",
  12572. updateTime: 1522034841000
  12573. },
  12574. {
  12575. moduleCode: "",
  12576. detailCode: "395416",
  12577. description: "设备资源受限",
  12578. msg: "播放失败请重试",
  12579. solution: "刷新重试",
  12580. updateTime: 1522034841000
  12581. },
  12582. {
  12583. moduleCode: "",
  12584. detailCode: "395451",
  12585. description: "设备不支持的码流类型",
  12586. msg: "播放失败请重试或切换设备码流",
  12587. solution: "刷新重试或者切换到高清模式",
  12588. updateTime: 1522034841000
  12589. },
  12590. {
  12591. moduleCode: "",
  12592. detailCode: "395452",
  12593. description: "设备链接流媒体服务器失败",
  12594. msg: "播放失败,请检查设备网络或重启设备或重新加载",
  12595. solution: "检查设备网络,重启设备,刷新重试",
  12596. updateTime: 1522034841000
  12597. },
  12598. {
  12599. moduleCode: "",
  12600. detailCode: "395454",
  12601. description: "流媒体中关于设备取流会话不存在",
  12602. msg: "播放失败请重试",
  12603. solution: "流媒体中关于设备取流会话不存在",
  12604. updateTime: 1522220180000
  12605. },
  12606. {
  12607. moduleCode: "",
  12608. detailCode: "395455",
  12609. description: "设备通道未关联",
  12610. msg: "播放失败,请检查设备通道是否关联",
  12611. solution: "检查设备通道是否关联",
  12612. updateTime: 1522220180000
  12613. },
  12614. {
  12615. moduleCode: "",
  12616. detailCode: "395456",
  12617. description: "设备通道关联设备不在线",
  12618. msg: "播放失败,请检查设备通道是否上线",
  12619. solution: "检查设备通道是否上线",
  12620. updateTime: 1522220180000
  12621. },
  12622. {
  12623. moduleCode: "",
  12624. detailCode: "395457",
  12625. description: "客户端不支持端到端加密",
  12626. msg: "播放失败",
  12627. solution: "客户端不支持端到端加密",
  12628. updateTime: 1522220180000
  12629. },
  12630. {
  12631. moduleCode: "",
  12632. detailCode: "395458",
  12633. description: "设备不支持当前并发ECDH密",
  12634. msg: "客户端不支持端到端加密",
  12635. solution: "设备不支持当前并发ECDH密",
  12636. updateTime: 1522220180000
  12637. },
  12638. {
  12639. moduleCode: "",
  12640. detailCode: "395459",
  12641. description: "VTDU 处理ECDH 加密失败",
  12642. msg: "播放失败",
  12643. solution: "VTDU 处理ECDH 加密失败",
  12644. updateTime: 1522220180000
  12645. },
  12646. {
  12647. moduleCode: "",
  12648. detailCode: "395460",
  12649. description: "流媒体中关于设备取流会话不存在",
  12650. msg: "播放失败请重试",
  12651. solution: "流媒体中关于设备取流会话不存在",
  12652. updateTime: 1522220180000
  12653. },
  12654. {
  12655. moduleCode: "",
  12656. detailCode: "395492",
  12657. description: "设备不支持的命令",
  12658. msg: "操作失败,设备不支持",
  12659. solution: "",
  12660. updateTime: 1522220180000
  12661. },
  12662. {
  12663. moduleCode: "",
  12664. detailCode: "395500",
  12665. description: "服务器处理失败",
  12666. msg: "播放失败请重试",
  12667. solution: "刷新重试",
  12668. updateTime: 1522034841000
  12669. },
  12670. {
  12671. moduleCode: "",
  12672. detailCode: "395501",
  12673. description: "流媒体vtdu达到最大负载,请扩容",
  12674. msg: "播放失败请重试",
  12675. solution: "服务器负载达到上限,请稍后重试",
  12676. updateTime: 1522034841000
  12677. },
  12678. {
  12679. moduleCode: "",
  12680. detailCode: "395503",
  12681. description: "vtm返回分配vtdu失败",
  12682. msg: "播放失败请重试",
  12683. solution: "vtdu服务异常,请请稍后重试",
  12684. updateTime: 1522034841000
  12685. },
  12686. {
  12687. moduleCode: "",
  12688. detailCode: "395504",
  12689. description: "流媒体vtdu达到最大负载",
  12690. msg: "播放失败请重试",
  12691. solution: "服务器负载达到上限,请稍后重试",
  12692. updateTime: 1522034841000
  12693. },
  12694. {
  12695. moduleCode: "",
  12696. detailCode: "395505",
  12697. description: "vtm ecdh解密失败",
  12698. msg: "播放失败",
  12699. solution: "",
  12700. updateTime: 1522034841000
  12701. },
  12702. {
  12703. moduleCode: "",
  12704. detailCode: "395506",
  12705. description: "vtm 返回IPC不支持取流(需要IPC添加NVR后支持)",
  12706. msg: "播放失败,请绑定NVR使用",
  12707. solution: "IPC绑定NVR使用",
  12708. updateTime: 1522034841000
  12709. },
  12710. {
  12711. moduleCode: "",
  12712. detailCode: "395544",
  12713. description: "设备返回无视频源",
  12714. msg: "播放失败,请检查设备接触情况",
  12715. solution: "设备是否接触良好; 如果一直无法解决,请联系技术支持",
  12716. updateTime: 1522034841000
  12717. },
  12718. {
  12719. moduleCode: "",
  12720. detailCode: "395545",
  12721. description: "视频分享时间已经结束",
  12722. msg: "视频分享时间已结束",
  12723. solution: "",
  12724. updateTime: 1522034841000
  12725. },
  12726. {
  12727. moduleCode: "",
  12728. detailCode: "395546",
  12729. description: "vtdu返回达到取流并发路数限制",
  12730. msg: "并发上限,请升级为企业版",
  12731. solution: "请升级为企业版,放开并发限制",
  12732. updateTime: 1522034841000
  12733. },
  12734. {
  12735. moduleCode: "",
  12736. detailCode: "395547",
  12737. description: "vtdu返回开放平台用户并发限制",
  12738. msg: "并发上限,请升级为企业版",
  12739. solution: "请确定开放平台用户预览是否超过用户并发数量限制",
  12740. updateTime: 1522034841000
  12741. },
  12742. {
  12743. moduleCode: "",
  12744. detailCode: "395556",
  12745. description: "ticket校验失败",
  12746. msg: "播放失败",
  12747. solution: "",
  12748. updateTime: 1522034841000
  12749. },
  12750. {
  12751. moduleCode: "",
  12752. detailCode: "395557",
  12753. description: "回放服务器等待流头超时",
  12754. msg: "播放失败请重试",
  12755. solution: "刷新重试,检测设备网络,重启设备",
  12756. updateTime: 1522034841000
  12757. },
  12758. {
  12759. moduleCode: "",
  12760. detailCode: "395558",
  12761. description: "查找录像开始时间错误",
  12762. msg: "播放失败",
  12763. solution: "",
  12764. updateTime: 1522034841000
  12765. },
  12766. {
  12767. moduleCode: "",
  12768. detailCode: "395560",
  12769. description: "群组分享取流二次验证失败",
  12770. msg: "播放失败",
  12771. solution: "",
  12772. updateTime: 1522034841000
  12773. },
  12774. {
  12775. moduleCode: "",
  12776. detailCode: "395561",
  12777. description: "分享群组用户被锁住",
  12778. msg: "播放失败",
  12779. solution: "",
  12780. updateTime: 1522034841000
  12781. },
  12782. {
  12783. moduleCode: "",
  12784. detailCode: "395562",
  12785. description: "群组分享用户权限变更",
  12786. msg: "播放失败",
  12787. solution: "",
  12788. updateTime: 1522034841000
  12789. },
  12790. {
  12791. moduleCode: "",
  12792. detailCode: "395563",
  12793. description: "认证服务连接失败",
  12794. msg: "播放失败请重试",
  12795. solution: "",
  12796. updateTime: 1522034841000
  12797. },
  12798. {
  12799. moduleCode: "",
  12800. detailCode: "395564",
  12801. description: "认证超时",
  12802. msg: "播放失败请重试",
  12803. solution: "",
  12804. updateTime: 1522034841000
  12805. },
  12806. {
  12807. moduleCode: "",
  12808. detailCode: "395566",
  12809. description: "不在分享时间内预览",
  12810. msg: "播放失败",
  12811. solution: "",
  12812. updateTime: 1522034841000
  12813. },
  12814. {
  12815. moduleCode: "",
  12816. detailCode: "395567",
  12817. description: "分享通道被锁定",
  12818. msg: "播放失败",
  12819. solution: "",
  12820. updateTime: 1522034841000
  12821. },
  12822. {
  12823. moduleCode: "",
  12824. detailCode: "395568",
  12825. description: "未找到认证类型",
  12826. msg: "播放失败",
  12827. solution: "",
  12828. updateTime: 1522034841000
  12829. },
  12830. {
  12831. moduleCode: "",
  12832. detailCode: "395569",
  12833. description: "认证返回的参数异常",
  12834. msg: "播放失败",
  12835. solution: "",
  12836. updateTime: 1522034841000
  12837. },
  12838. {
  12839. moduleCode: "",
  12840. detailCode: "395600",
  12841. description: "分享设备不在分享时间内",
  12842. msg: "播放失败",
  12843. solution: "",
  12844. updateTime: 1522034841000
  12845. },
  12846. {
  12847. moduleCode: "",
  12848. detailCode: "395601",
  12849. description: "群组分享用户没权限",
  12850. msg: "播放失败",
  12851. solution: "",
  12852. updateTime: 1522034841000
  12853. },
  12854. {
  12855. moduleCode: "",
  12856. detailCode: "395602",
  12857. description: "群组分享权限变更",
  12858. msg: "播放失败",
  12859. solution: "",
  12860. updateTime: 1522034841000
  12861. },
  12862. {
  12863. moduleCode: "",
  12864. detailCode: "395610",
  12865. description: "接收流头失败",
  12866. msg: "播放失败请重试并检查设备网络情况以及设备配置",
  12867. solution: "",
  12868. updateTime: 1522034841000
  12869. },
  12870. {
  12871. moduleCode: "",
  12872. detailCode: "395620",
  12873. description: "心跳超时",
  12874. msg: "播放失败请重试并检查设备网络情况以及设备配置",
  12875. solution: "",
  12876. updateTime: 1522034841000
  12877. },
  12878. {
  12879. moduleCode: "",
  12880. detailCode: "395530",
  12881. description: "机房故障不可用",
  12882. msg: "播放失败请重试",
  12883. solution: "刷新重试",
  12884. updateTime: 1522034841000
  12885. },
  12886. {
  12887. moduleCode: "",
  12888. detailCode: "395701",
  12889. description: "cas信令返回格式错误",
  12890. msg: "播放失败请重试",
  12891. solution: "刷新重试",
  12892. updateTime: 1522034841000
  12893. },
  12894. {
  12895. moduleCode: "",
  12896. detailCode: "395702",
  12897. description: "SPGW请求Cas、Status透传超时",
  12898. msg: "播放失败请重试",
  12899. solution: "刷新重试",
  12900. updateTime: 1522034841000
  12901. },
  12902. {
  12903. moduleCode: "",
  12904. detailCode: "395703",
  12905. description: "SPGW请求http不通",
  12906. msg: "播放失败请重试",
  12907. solution: "刷新重试",
  12908. updateTime: 1522034841000
  12909. },
  12910. {
  12911. moduleCode: "",
  12912. detailCode: "396001",
  12913. description: "客户端参数出错",
  12914. msg: "播放失败请重试",
  12915. solution: "刷新重试",
  12916. updateTime: 1522034841000
  12917. },
  12918. {
  12919. moduleCode: "",
  12920. detailCode: "396099",
  12921. description: "客户端默认错误",
  12922. solution: "",
  12923. updateTime: 1522034841000
  12924. },
  12925. {
  12926. moduleCode: "",
  12927. detailCode: "396101",
  12928. description: "不支持的命令",
  12929. msg: "播放失败请重试",
  12930. solution: "刷新重试",
  12931. updateTime: 1522034841000
  12932. },
  12933. {
  12934. moduleCode: "",
  12935. detailCode: "396102",
  12936. description: "设备流头发送失败",
  12937. msg: "播放失败请重试",
  12938. solution: "",
  12939. updateTime: 1522034841000
  12940. },
  12941. {
  12942. moduleCode: "",
  12943. detailCode: "396103",
  12944. description: "cas/设备返回错误1",
  12945. msg: "播放失败请重试",
  12946. solution: "刷新重试",
  12947. updateTime: 1522034841000
  12948. },
  12949. {
  12950. moduleCode: "",
  12951. detailCode: "396104",
  12952. description: "cas/设备返回错误-1",
  12953. msg: "播放失败请重试",
  12954. solution: "刷新重试",
  12955. updateTime: 1522034841000
  12956. },
  12957. {
  12958. moduleCode: "",
  12959. detailCode: "396105",
  12960. description: "设备返回错误码3",
  12961. msg: "播放失败请重试",
  12962. solution: "刷新重试",
  12963. updateTime: 1522034841000
  12964. },
  12965. {
  12966. moduleCode: "",
  12967. detailCode: "396106",
  12968. description: "设备返回错误码4",
  12969. msg: "播放失败请重试",
  12970. solution: "刷新重试",
  12971. updateTime: 1522034841000
  12972. },
  12973. {
  12974. moduleCode: "",
  12975. detailCode: "396107",
  12976. description: "设备返回错误码5",
  12977. msg: "播放失败请重试",
  12978. solution: "刷新重试",
  12979. updateTime: 1522034841000
  12980. },
  12981. {
  12982. moduleCode: "",
  12983. detailCode: "396108",
  12984. description: "cas信令回应重复",
  12985. msg: "播放失败请重试",
  12986. solution: "刷新重试",
  12987. updateTime: 1522034841000
  12988. },
  12989. {
  12990. moduleCode: "",
  12991. detailCode: "396109",
  12992. description: "视频广场取消分享",
  12993. solution: "",
  12994. updateTime: 1522034841000
  12995. },
  12996. {
  12997. moduleCode: "",
  12998. detailCode: "396110",
  12999. description: "设备信令默认错误",
  13000. msg: "播放失败请重试",
  13001. solution: "",
  13002. updateTime: 1522034841000
  13003. },
  13004. {
  13005. moduleCode: "",
  13006. detailCode: "396501",
  13007. description: "设备数据链路和实际链路不匹配",
  13008. msg: "播放失败请重试",
  13009. solution: "刷新重试",
  13010. updateTime: 1522034841000
  13011. },
  13012. {
  13013. moduleCode: "",
  13014. detailCode: "396502",
  13015. description: "设备数据链路重复建立连接",
  13016. msg: "播放失败请重试",
  13017. solution: "刷新重试",
  13018. updateTime: 1522034841000
  13019. },
  13020. {
  13021. moduleCode: "",
  13022. detailCode: "396503",
  13023. description: "设备数据链路端口不匹配",
  13024. msg: "播放失败请重试",
  13025. solution: "刷新重试",
  13026. updateTime: 1522034841000
  13027. },
  13028. {
  13029. moduleCode: "",
  13030. detailCode: "396504",
  13031. description: "缓存设备数据链路失败(内存块不足)",
  13032. msg: "播放失败请重试",
  13033. solution: "刷新重试",
  13034. updateTime: 1522034841000
  13035. },
  13036. {
  13037. moduleCode: "",
  13038. detailCode: "396505",
  13039. description: "设备发送确认头消息重复",
  13040. msg: "播放失败请重试",
  13041. solution: "刷新重试",
  13042. updateTime: 1522034841000
  13043. },
  13044. {
  13045. moduleCode: "",
  13046. detailCode: "396506",
  13047. description: "设备数据先于确定头部到达",
  13048. msg: "播放失败请重试",
  13049. solution: "刷新重试",
  13050. updateTime: 1522034841000
  13051. },
  13052. {
  13053. moduleCode: "",
  13054. detailCode: "396508",
  13055. description: "设备数据头部长度非法",
  13056. msg: "播放失败请重试或重启设备",
  13057. solution: "刷新重试,或者重启设备",
  13058. updateTime: 1522034841000
  13059. },
  13060. {
  13061. moduleCode: "",
  13062. detailCode: "396509",
  13063. description: "索引找不到设备数据管理块",
  13064. msg: "播放失败请重试",
  13065. solution: "刷新重试",
  13066. updateTime: 1522034841000
  13067. },
  13068. {
  13069. moduleCode: "",
  13070. detailCode: "396510",
  13071. description: "设备数据链路vtdu内存块协议状态不匹配",
  13072. msg: "播放失败请重试或重启设备",
  13073. solution: "",
  13074. updateTime: 1522034841000
  13075. },
  13076. {
  13077. moduleCode: "",
  13078. detailCode: "396511",
  13079. description: "设备数据头部没有streamkey错误",
  13080. msg: "播放失败请重试或重启设备",
  13081. solution: "",
  13082. updateTime: 1522034841000
  13083. },
  13084. {
  13085. moduleCode: "",
  13086. detailCode: "396512",
  13087. description: "设备数据头部非法(较笼统)",
  13088. msg: "播放失败请重试或重启设备",
  13089. solution: "",
  13090. updateTime: 1522034841000
  13091. },
  13092. {
  13093. moduleCode: "",
  13094. detailCode: "396513",
  13095. description: "设备数据长度过小",
  13096. msg: "播放失败请重试或重启设备",
  13097. solution: "",
  13098. updateTime: 1522034841000
  13099. },
  13100. {
  13101. moduleCode: "",
  13102. detailCode: "396514",
  13103. description: "设备老协议推流头部没有streamkey错误",
  13104. msg: "播放失败请重试或重启设备",
  13105. solution: "",
  13106. updateTime: 1522034841000
  13107. },
  13108. {
  13109. moduleCode: "",
  13110. detailCode: "396515",
  13111. description: "设备老协议推流数据非法",
  13112. msg: "播放失败请重试或重启设备",
  13113. solution: "",
  13114. updateTime: 1522034841000
  13115. },
  13116. {
  13117. moduleCode: "",
  13118. detailCode: "396516",
  13119. description: "设备老协议索引找不到内存管理块",
  13120. msg: "播放失败请重试或重启设备",
  13121. solution: "",
  13122. updateTime: 1522034841000
  13123. },
  13124. {
  13125. moduleCode: "",
  13126. detailCode: "396517",
  13127. description: "设备老协议推流数据非法",
  13128. msg: "播放失败请重试或重启设备",
  13129. solution: "",
  13130. updateTime: 1522034841000
  13131. },
  13132. {
  13133. moduleCode: "",
  13134. detailCode: "396518",
  13135. description: "设备数据包过大",
  13136. msg: "播放失败请重试或重启设备",
  13137. solution: "刷新重试,或者重启设备",
  13138. updateTime: 1522034841000
  13139. },
  13140. {
  13141. moduleCode: "",
  13142. detailCode: "396519",
  13143. description: "设备推流链路网络不稳定",
  13144. msg: "播放失败,请重试或重启设备",
  13145. solution: "",
  13146. updateTime: 1522034841000
  13147. },
  13148. {
  13149. moduleCode: "",
  13150. detailCode: "396520",
  13151. description: "设备推流链路网络不稳定(默认)",
  13152. msg: "播放失败请重试或重启设备",
  13153. solution: "",
  13154. updateTime: 1522034841000
  13155. },
  13156. {
  13157. moduleCode: "",
  13158. detailCode: "396700",
  13159. description: "异常数据包",
  13160. msg: "播放失败,设备重启",
  13161. solution: "",
  13162. updateTime: 1522034841000
  13163. },
  13164. {
  13165. moduleCode: "",
  13166. detailCode: "396701",
  13167. description: "回放结束数据包",
  13168. msg: "回放结束",
  13169. solution: "",
  13170. updateTime: 1522034841000
  13171. },
  13172. {
  13173. moduleCode: "",
  13174. detailCode: "397001",
  13175. description: "与相应服务连接失败",
  13176. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13177. solution: "",
  13178. updateTime: 1522034841000
  13179. },
  13180. {
  13181. moduleCode: "",
  13182. detailCode: "397002",
  13183. description: "与相应服务连接失败",
  13184. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13185. solution: "",
  13186. updateTime: 1522034841000
  13187. },
  13188. {
  13189. moduleCode: "",
  13190. detailCode: "397003",
  13191. description: "与相应服务连接失败",
  13192. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13193. solution: "",
  13194. updateTime: 1522034841000
  13195. },
  13196. {
  13197. moduleCode: "",
  13198. detailCode: "397004",
  13199. description: "与相应服务连接失败",
  13200. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13201. solution: "",
  13202. updateTime: 1522034841000
  13203. },
  13204. {
  13205. moduleCode: "",
  13206. detailCode: "397005",
  13207. description: "VTDU连接失败,或VTDU侧断开连接",
  13208. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13209. solution: "",
  13210. updateTime: 1522034841000
  13211. },
  13212. {
  13213. moduleCode: "",
  13214. detailCode: "397006",
  13215. description: "vtm断开连接(无需 关注)",
  13216. msg: "播放失败请重试,请检查设备网络情况以及连接情况",
  13217. solution: "",
  13218. updateTime: 1522034841000
  13219. },
  13220. {
  13221. moduleCode: "",
  13222. detailCode: "397007",
  13223. description: "客户端发送缓冲区满(上行带宽太小)",
  13224. msg: "播放失败,上行带宽过小请检查设备网络情况",
  13225. solution: "",
  13226. updateTime: 1522034841000
  13227. },
  13228. {
  13229. moduleCode: "",
  13230. detailCode: "399000",
  13231. description: "无效包,包过大",
  13232. msg: " 检查设备重启设备",
  13233. solution: "",
  13234. updateTime: 1522034841000
  13235. },
  13236. {
  13237. moduleCode: "",
  13238. detailCode: "399001",
  13239. description: "地址不合法",
  13240. msg: "播放失败",
  13241. solution: "",
  13242. updateTime: 1522034841000
  13243. },
  13244. {
  13245. moduleCode: "",
  13246. detailCode: "399002",
  13247. description: "缺少端口",
  13248. msg: " 播放失败",
  13249. solution: "",
  13250. updateTime: 1522034841000
  13251. },
  13252. {
  13253. moduleCode: "",
  13254. detailCode: "170003",
  13255. description: "refreshToken不存在",
  13256. solution: "建议用户重新调用logout接口,然后调用openLoginPage接口重新启动登录页面登录",
  13257. updateTime: 1522034841000
  13258. },
  13259. {
  13260. moduleCode: "",
  13261. detailCode: "170004",
  13262. description: "refreshToken已过期",
  13263. solution: "建议用户重新调用logout接口,然后调用openLoginPage接口重新启动登录页面登录",
  13264. updateTime: 1522034841000
  13265. },
  13266. {
  13267. moduleCode: "",
  13268. detailCode: "380011",
  13269. description: "设备隐私保护中",
  13270. solution: "",
  13271. updateTime: 1522034841000
  13272. },
  13273. {
  13274. moduleCode: "",
  13275. detailCode: "380045",
  13276. description: "设备直连取流连接数量过大",
  13277. solution: "",
  13278. updateTime: 1522034841000
  13279. },
  13280. {
  13281. moduleCode: "",
  13282. detailCode: "380047",
  13283. description: "设备不支持该命令",
  13284. solution: "",
  13285. updateTime: 1522034841000
  13286. },
  13287. {
  13288. moduleCode: "",
  13289. detailCode: "380077",
  13290. description: "设备正在对讲中",
  13291. solution: "",
  13292. updateTime: 1522034841000
  13293. },
  13294. {
  13295. moduleCode: "",
  13296. detailCode: "380102",
  13297. description: "数据接收异常",
  13298. solution: "",
  13299. updateTime: 1522034841000
  13300. },
  13301. {
  13302. moduleCode: "",
  13303. detailCode: "380205",
  13304. description: "设备检测入参异常",
  13305. solution: "",
  13306. updateTime: 1522034841000
  13307. },
  13308. {
  13309. moduleCode: "",
  13310. detailCode: "380209",
  13311. description: "网络连接超时",
  13312. solution: "",
  13313. updateTime: 1522034841000
  13314. },
  13315. {
  13316. moduleCode: "",
  13317. detailCode: "380212",
  13318. description: "设备端网络连接超时",
  13319. solution: "",
  13320. updateTime: 1522034841000
  13321. },
  13322. {
  13323. moduleCode: "",
  13324. detailCode: "101007",
  13325. description: "手机号未注册",
  13326. solution: "",
  13327. updateTime: 1522034840000
  13328. },
  13329. {
  13330. moduleCode: "",
  13331. detailCode: "120503",
  13332. description: "正在响铃",
  13333. solution: "",
  13334. updateTime: 1522034840000
  13335. },
  13336. {
  13337. moduleCode: "",
  13338. detailCode: "390016",
  13339. description: "vtdu成功响应未携带流头",
  13340. solution: "",
  13341. updateTime: 1522034840000
  13342. },
  13343. {
  13344. moduleCode: "",
  13345. detailCode: "101008",
  13346. description: "手机号码不合法",
  13347. solution: "",
  13348. updateTime: 1522034840000
  13349. },
  13350. {
  13351. moduleCode: "",
  13352. detailCode: "120504",
  13353. description: "室内机正在通话",
  13354. solution: "",
  13355. updateTime: 1522034840000
  13356. },
  13357. {
  13358. moduleCode: "",
  13359. detailCode: "390017",
  13360. description: "无数据流,尚未使用",
  13361. solution: "",
  13362. updateTime: 1522034840000
  13363. },
  13364. {
  13365. moduleCode: "",
  13366. detailCode: "101009",
  13367. description: "用户名与手机不匹配",
  13368. solution: "",
  13369. updateTime: 1522034840000
  13370. },
  13371. {
  13372. moduleCode: "",
  13373. detailCode: "120505",
  13374. description: "设备操作失败",
  13375. solution: "",
  13376. updateTime: 1522034840000
  13377. },
  13378. {
  13379. moduleCode: "",
  13380. detailCode: "390018",
  13381. description: "信令消息体PB解析失败",
  13382. solution: "",
  13383. updateTime: 1522034840000
  13384. },
  13385. {
  13386. moduleCode: "",
  13387. detailCode: "101010",
  13388. description: "获取验证码失败",
  13389. solution: "",
  13390. updateTime: 1522034840000
  13391. },
  13392. {
  13393. moduleCode: "",
  13394. detailCode: "120506",
  13395. description: "非法命令",
  13396. solution: "",
  13397. updateTime: 1522034840000
  13398. },
  13399. {
  13400. moduleCode: "",
  13401. detailCode: "390019",
  13402. description: "信令消息体PB封装失败",
  13403. solution: "",
  13404. updateTime: 1522034840000
  13405. },
  13406. {
  13407. moduleCode: "",
  13408. detailCode: "101011",
  13409. description: "验证码错误",
  13410. solution: "",
  13411. updateTime: 1522034840000
  13412. },
  13413. {
  13414. moduleCode: "",
  13415. detailCode: "120507",
  13416. description: "智能锁密码错误",
  13417. solution: "",
  13418. updateTime: 1522034840000
  13419. },
  13420. {
  13421. moduleCode: "",
  13422. detailCode: "390020",
  13423. description: "申请系统内存资源失败",
  13424. solution: "",
  13425. updateTime: 1522034840000
  13426. },
  13427. {
  13428. moduleCode: "",
  13429. detailCode: "101012",
  13430. description: "验证码失效",
  13431. solution: "",
  13432. updateTime: 1522034840000
  13433. },
  13434. {
  13435. moduleCode: "",
  13436. detailCode: "120508",
  13437. description: "开关锁失败",
  13438. solution: "",
  13439. updateTime: 1522034840000
  13440. },
  13441. {
  13442. moduleCode: "",
  13443. detailCode: "390021",
  13444. description: "vtdu地址尚未获取到",
  13445. solution: "",
  13446. updateTime: 1522034840000
  13447. },
  13448. {
  13449. moduleCode: "",
  13450. detailCode: "101013",
  13451. description: "用户不存在",
  13452. solution: "",
  13453. updateTime: 1522034840000
  13454. },
  13455. {
  13456. moduleCode: "",
  13457. detailCode: "120509",
  13458. description: "开关锁超时",
  13459. solution: "",
  13460. updateTime: 1522034840000
  13461. },
  13462. {
  13463. moduleCode: "",
  13464. detailCode: "390022",
  13465. description: "客户端尚未支持",
  13466. solution: "",
  13467. updateTime: 1522034840000
  13468. },
  13469. {
  13470. moduleCode: "",
  13471. detailCode: "101014",
  13472. description: "密码不正确或者appKey不正确",
  13473. solution: "",
  13474. updateTime: 1522034840000
  13475. },
  13476. {
  13477. moduleCode: "",
  13478. detailCode: "120510",
  13479. description: "智能锁设备繁忙",
  13480. solution: "",
  13481. updateTime: 1522034840000
  13482. },
  13483. {
  13484. moduleCode: "",
  13485. detailCode: "390023",
  13486. description: "获取系统socket资源失败",
  13487. solution: "",
  13488. updateTime: 1522034840000
  13489. },
  13490. {
  13491. moduleCode: "",
  13492. detailCode: "101015",
  13493. description: "用户被锁住",
  13494. solution: "",
  13495. updateTime: 1522034840000
  13496. },
  13497. {
  13498. moduleCode: "",
  13499. detailCode: "120511",
  13500. description: "远程开锁功能未打开",
  13501. solution: "",
  13502. updateTime: 1522034840000
  13503. },
  13504. {
  13505. moduleCode: "",
  13506. detailCode: "390024",
  13507. description: "上层填充的StreamSsnId不匹配",
  13508. solution: "",
  13509. updateTime: 1522034840000
  13510. },
  13511. {
  13512. moduleCode: "",
  13513. detailCode: "101021",
  13514. description: "验证参数异常",
  13515. solution: "",
  13516. updateTime: 1522034840000
  13517. },
  13518. {
  13519. moduleCode: "",
  13520. detailCode: "120600",
  13521. description: "临时密码数已达上限",
  13522. solution: "",
  13523. updateTime: 1522034840000
  13524. },
  13525. {
  13526. moduleCode: "",
  13527. detailCode: "390025",
  13528. description: "链接服务器失败",
  13529. solution: "",
  13530. updateTime: 1522034840000
  13531. },
  13532. {
  13533. moduleCode: "",
  13534. detailCode: "101026",
  13535. description: "邮箱已经被注册",
  13536. solution: "",
  13537. updateTime: 1522034840000
  13538. },
  13539. {
  13540. moduleCode: "",
  13541. detailCode: "120601",
  13542. description: "添加临时密码失败",
  13543. solution: "",
  13544. updateTime: 1522034840000
  13545. },
  13546. {
  13547. moduleCode: "",
  13548. detailCode: "390026",
  13549. description: "客户端请求未收到服务端应答",
  13550. solution: "",
  13551. updateTime: 1522034840000
  13552. },
  13553. {
  13554. moduleCode: "",
  13555. detailCode: "101031",
  13556. description: "邮箱未注册",
  13557. solution: "",
  13558. updateTime: 1522034840000
  13559. },
  13560. {
  13561. moduleCode: "",
  13562. detailCode: "120602",
  13563. description: "删除临时密码失败",
  13564. solution: "",
  13565. updateTime: 1522034840000
  13566. },
  13567. {
  13568. moduleCode: "",
  13569. detailCode: "390027",
  13570. description: "链路断开",
  13571. solution: "",
  13572. updateTime: 1522034840000
  13573. },
  13574. {
  13575. moduleCode: "",
  13576. detailCode: "101032",
  13577. description: "邮箱不合法",
  13578. solution: "",
  13579. updateTime: 1522034840000
  13580. },
  13581. {
  13582. moduleCode: "",
  13583. detailCode: "120603",
  13584. description: "该临时密码不存在",
  13585. solution: "",
  13586. updateTime: 1522034840000
  13587. },
  13588. {
  13589. moduleCode: "",
  13590. detailCode: "390028",
  13591. description: "没有取流链接",
  13592. solution: "",
  13593. updateTime: 1522034840000
  13594. },
  13595. {
  13596. moduleCode: "",
  13597. detailCode: "101041",
  13598. description: "获取验证码过于频繁",
  13599. solution: "",
  13600. updateTime: 1522034840000
  13601. },
  13602. {
  13603. moduleCode: "",
  13604. detailCode: "120604",
  13605. description: "指纹锁射频通信失败,请稍后再试",
  13606. solution: "",
  13607. updateTime: 1522034840000
  13608. },
  13609. {
  13610. moduleCode: "",
  13611. detailCode: "390029",
  13612. description: "流成功停止",
  13613. solution: "",
  13614. updateTime: 1522034840000
  13615. },
  13616. {
  13617. moduleCode: "",
  13618. detailCode: "101043",
  13619. description: "手机验证码输入错误超过规定次数",
  13620. solution: "",
  13621. updateTime: 1522034840000
  13622. },
  13623. {
  13624. moduleCode: "",
  13625. detailCode: "120605",
  13626. description: "其他用户正在认证中",
  13627. solution: "",
  13628. updateTime: 1522034840000
  13629. },
  13630. {
  13631. moduleCode: "",
  13632. detailCode: "390030",
  13633. description: "客户端防串流校验失败",
  13634. solution: "",
  13635. updateTime: 1522034840000
  13636. },
  13637. {
  13638. moduleCode: "",
  13639. detailCode: "102000",
  13640. description: "设备不存在",
  13641. solution: "",
  13642. updateTime: 1522034840000
  13643. },
  13644. {
  13645. moduleCode: "",
  13646. detailCode: "120606",
  13647. description: "验证已启动,请在120s内进行本地验证和调用添加设备接口",
  13648. solution: "",
  13649. updateTime: 1522034840000
  13650. },
  13651. {
  13652. moduleCode: "",
  13653. detailCode: "390031",
  13654. description: "应用层tcp粘包处理缓冲区满",
  13655. solution: "",
  13656. updateTime: 1522034840000
  13657. },
  13658. {
  13659. moduleCode: "",
  13660. detailCode: "102001",
  13661. description: "摄像机不存在",
  13662. solution: "摄像机未注册到萤石云平台,请仔细检查摄像机的网络配置,确保连接到网络",
  13663. updateTime: 1522034840000
  13664. },
  13665. {
  13666. moduleCode: "",
  13667. detailCode: "120607",
  13668. description: "删除用户失败",
  13669. solution: "",
  13670. updateTime: 1522034840000
  13671. },
  13672. {
  13673. moduleCode: "",
  13674. detailCode: "390032",
  13675. description: "无效状态迁移",
  13676. solution: "",
  13677. updateTime: 1522034840000
  13678. },
  13679. {
  13680. moduleCode: "",
  13681. detailCode: "102003",
  13682. description: "设备不在线",
  13683. solution: "参考服务中心排查方法",
  13684. updateTime: 1522034840000
  13685. },
  13686. {
  13687. moduleCode: "",
  13688. detailCode: "120608",
  13689. description: "用户不存在",
  13690. solution: "",
  13691. updateTime: 1522034840000
  13692. },
  13693. {
  13694. moduleCode: "",
  13695. detailCode: "390033",
  13696. description: "无效客户端状态",
  13697. solution: "",
  13698. updateTime: 1522034840000
  13699. },
  13700. {
  13701. moduleCode: "",
  13702. detailCode: "102004",
  13703. description: "设备异常",
  13704. solution: "",
  13705. updateTime: 1522034840000
  13706. },
  13707. {
  13708. moduleCode: "",
  13709. detailCode: "120609",
  13710. description: "设备响应超时,门锁通信故障或者电量不足,请重试.",
  13711. solution: "",
  13712. updateTime: 1522034840000
  13713. },
  13714. {
  13715. moduleCode: "",
  13716. detailCode: "390034",
  13717. description: "向vtm取流流媒体信息请求超时",
  13718. solution: "",
  13719. updateTime: 1522034840000
  13720. },
  13721. {
  13722. moduleCode: "",
  13723. detailCode: "102007",
  13724. description: "设备序列号不正确",
  13725. solution: "",
  13726. updateTime: 1522034840000
  13727. },
  13728. {
  13729. moduleCode: "",
  13730. detailCode: "120610",
  13731. description: "获取临时密码列表失败",
  13732. solution: "",
  13733. updateTime: 1522034840000
  13734. },
  13735. {
  13736. moduleCode: "",
  13737. detailCode: "390035",
  13738. description: "向代理取流请求超时",
  13739. solution: "",
  13740. updateTime: 1522034840000
  13741. },
  13742. {
  13743. moduleCode: "",
  13744. detailCode: "102009",
  13745. description: "设备请求响应超时异常",
  13746. solution: "",
  13747. updateTime: 1522034840000
  13748. },
  13749. {
  13750. moduleCode: "",
  13751. detailCode: "130001",
  13752. description: "用户不存在",
  13753. solution: "",
  13754. updateTime: 1522034840000
  13755. },
  13756. {
  13757. moduleCode: "",
  13758. detailCode: "390036",
  13759. description: "向代理保活取流请求超时",
  13760. solution: "",
  13761. updateTime: 1522034840000
  13762. },
  13763. {
  13764. moduleCode: "",
  13765. detailCode: "105000",
  13766. description: "设备已被自己添加",
  13767. solution: "",
  13768. updateTime: 1522034840000
  13769. },
  13770. {
  13771. moduleCode: "",
  13772. detailCode: "130002",
  13773. description: "手机号码已经注册",
  13774. solution: "",
  13775. updateTime: 1522034840000
  13776. },
  13777. {
  13778. moduleCode: "",
  13779. detailCode: "390037",
  13780. description: "向vtdu取流请求超时",
  13781. solution: "",
  13782. updateTime: 1522034840000
  13783. },
  13784. {
  13785. moduleCode: "",
  13786. detailCode: "105001",
  13787. description: "设备已被别人添加",
  13788. solution: "",
  13789. updateTime: 1522034840000
  13790. },
  13791. {
  13792. moduleCode: "",
  13793. detailCode: "130003",
  13794. description: "手机验证码错误",
  13795. solution: "",
  13796. updateTime: 1522034840000
  13797. },
  13798. {
  13799. moduleCode: "",
  13800. detailCode: "390038",
  13801. description: "向vtdu保活取流请求超时",
  13802. solution: "",
  13803. updateTime: 1522034840000
  13804. },
  13805. {
  13806. moduleCode: "",
  13807. detailCode: "105002",
  13808. description: "设备验证码错误",
  13809. solution: "",
  13810. updateTime: 1522034840000
  13811. },
  13812. {
  13813. moduleCode: "",
  13814. detailCode: "130004",
  13815. description: "终端绑定操作失败",
  13816. solution: "",
  13817. updateTime: 1522034840000
  13818. },
  13819. {
  13820. moduleCode: "",
  13821. detailCode: "391001",
  13822. description: "vtm地址或端口非法",
  13823. solution: "",
  13824. updateTime: 1522034840000
  13825. },
  13826. {
  13827. moduleCode: "",
  13828. detailCode: "107001",
  13829. description: "邀请不存在",
  13830. solution: "",
  13831. updateTime: 1522034840000
  13832. },
  13833. {
  13834. moduleCode: "",
  13835. detailCode: "149999",
  13836. description: "数据异常",
  13837. solution: "",
  13838. updateTime: 1522034840000
  13839. },
  13840. {
  13841. moduleCode: "",
  13842. detailCode: "391002",
  13843. description: "vtm生成文件描述符失败",
  13844. solution: "",
  13845. updateTime: 1522034840000
  13846. },
  13847. {
  13848. moduleCode: "",
  13849. detailCode: "107002",
  13850. description: "邀请验证失败",
  13851. solution: "",
  13852. updateTime: 1522034840000
  13853. },
  13854. {
  13855. moduleCode: "",
  13856. detailCode: "150000",
  13857. description: "服务器异常",
  13858. solution: "",
  13859. updateTime: 1522034840000
  13860. },
  13861. {
  13862. moduleCode: "",
  13863. detailCode: "391003",
  13864. description: "vtm设置文件描述符非阻塞失败",
  13865. solution: "",
  13866. updateTime: 1522034840000
  13867. },
  13868. {
  13869. moduleCode: "",
  13870. detailCode: "107003",
  13871. description: "邀请用户不匹配",
  13872. solution: "",
  13873. updateTime: 1522034840000
  13874. },
  13875. {
  13876. moduleCode: "",
  13877. detailCode: "160000",
  13878. description: "设备不支持云台控制",
  13879. solution: "",
  13880. updateTime: 1522034840000
  13881. },
  13882. {
  13883. moduleCode: "",
  13884. detailCode: "391004",
  13885. description: "vtm设置文件描述符阻塞失败",
  13886. solution: "",
  13887. updateTime: 1522034840000
  13888. },
  13889. {
  13890. moduleCode: "",
  13891. detailCode: "107004",
  13892. description: "云存储连接失败",
  13893. solution: "",
  13894. updateTime: 1522034840000
  13895. },
  13896. {
  13897. moduleCode: "",
  13898. detailCode: "160001",
  13899. description: "用户无云台控制权限",
  13900. solution: "",
  13901. updateTime: 1522034840000
  13902. },
  13903. {
  13904. moduleCode: "",
  13905. detailCode: "391005",
  13906. description: "vtm解析服务器ip失败",
  13907. solution: "",
  13908. updateTime: 1522034840000
  13909. },
  13910. {
  13911. moduleCode: "",
  13912. detailCode: "7005",
  13913. description: "VTDU主动断开连接",
  13914. solution: "",
  13915. updateTime: 1522034840000
  13916. },
  13917. {
  13918. moduleCode: "",
  13919. detailCode: "107005",
  13920. description: "VTDU主动断开连接",
  13921. solution: "",
  13922. updateTime: 1522034840000
  13923. },
  13924. {
  13925. moduleCode: "",
  13926. detailCode: "160002",
  13927. description: "设备云台旋转达到上限位",
  13928. solution: "",
  13929. updateTime: 1522034840000
  13930. },
  13931. {
  13932. moduleCode: "",
  13933. detailCode: "391006",
  13934. description: "vtm描述符select失败",
  13935. solution: "",
  13936. updateTime: 1522034840000
  13937. },
  13938. {
  13939. moduleCode: "",
  13940. detailCode: "107006",
  13941. description: "不能邀请自己",
  13942. solution: "",
  13943. updateTime: 1522034840000
  13944. },
  13945. {
  13946. moduleCode: "",
  13947. detailCode: "160003",
  13948. description: "设备云台旋转达到下限位",
  13949. solution: "",
  13950. updateTime: 1522034840000
  13951. },
  13952. {
  13953. moduleCode: "",
  13954. detailCode: "391007",
  13955. description: "vtm文件描述符不在可读中",
  13956. solution: "",
  13957. updateTime: 1522034840000
  13958. },
  13959. {
  13960. moduleCode: "",
  13961. detailCode: "107007",
  13962. description: "重复邀请",
  13963. solution: "分享和删除分享必须全部由接口形式操作,如果与萤石客户端混用会造成这个问题,解决办法:在萤石客户端清空所有相关分享数据并重新添加设备,再通过接口操作即可",
  13964. updateTime: 1522034840000
  13965. },
  13966. {
  13967. moduleCode: "",
  13968. detailCode: "160004",
  13969. description: "设备云台旋转达到左限位",
  13970. solution: "",
  13971. updateTime: 1522034840000
  13972. },
  13973. {
  13974. moduleCode: "",
  13975. detailCode: "391008",
  13976. description: "vtm网络发生错误getsockopt",
  13977. solution: "",
  13978. updateTime: 1522034840000
  13979. },
  13980. {
  13981. moduleCode: "",
  13982. detailCode: "110001",
  13983. description: "参数错误",
  13984. solution: "参数为空或者格式不对",
  13985. updateTime: 1522034840000
  13986. },
  13987. {
  13988. moduleCode: "",
  13989. detailCode: "160005",
  13990. description: "设备云台旋转达到右限位",
  13991. solution: "",
  13992. updateTime: 1522034840000
  13993. },
  13994. {
  13995. moduleCode: "",
  13996. detailCode: "391009",
  13997. description: "vtm描述符select超时",
  13998. solution: "",
  13999. updateTime: 1522034840000
  14000. },
  14001. {
  14002. moduleCode: "",
  14003. detailCode: "110002",
  14004. description: "accessToken异常或过期",
  14005. solution: "accessToken有效期为七天,建议在accessToken即将过期或者出现10002错误码的时候重新获取accessToken",
  14006. updateTime: 1522034840000
  14007. },
  14008. {
  14009. moduleCode: "",
  14010. detailCode: "160006",
  14011. description: "云台当前操作失败",
  14012. solution: "",
  14013. updateTime: 1522034840000
  14014. },
  14015. {
  14016. moduleCode: "",
  14017. detailCode: "391101",
  14018. description: "proxy地址或端口非法",
  14019. solution: "",
  14020. updateTime: 1522034840000
  14021. },
  14022. {
  14023. moduleCode: "",
  14024. detailCode: "110004",
  14025. description: "用户不存在",
  14026. solution: "",
  14027. updateTime: 1522034840000
  14028. },
  14029. {
  14030. moduleCode: "",
  14031. detailCode: "160007",
  14032. description: "预置点个数超过最大值",
  14033. solution: "",
  14034. updateTime: 1522034840000
  14035. },
  14036. {
  14037. moduleCode: "",
  14038. detailCode: "391102",
  14039. description: "proxy生成文件描述符失败",
  14040. solution: "",
  14041. updateTime: 1522034840000
  14042. },
  14043. {
  14044. moduleCode: "",
  14045. detailCode: "110005",
  14046. description: "appKey异常",
  14047. solution: "确认appKey状态,不通过或者冻结状态会返回该错误码",
  14048. updateTime: 1522034840000
  14049. },
  14050. {
  14051. moduleCode: "",
  14052. detailCode: "160009",
  14053. description: "正在调用预置点",
  14054. solution: "",
  14055. updateTime: 1522034840000
  14056. },
  14057. {
  14058. moduleCode: "",
  14059. detailCode: "391103",
  14060. description: "proxy设置文件描述符非阻塞失败",
  14061. solution: "",
  14062. updateTime: 1522034840000
  14063. },
  14064. {
  14065. moduleCode: "",
  14066. detailCode: "110006",
  14067. description: "ip受限",
  14068. solution: "",
  14069. updateTime: 1522034840000
  14070. },
  14071. {
  14072. moduleCode: "",
  14073. detailCode: "160010",
  14074. description: "该预置点已经是当前位置",
  14075. solution: "",
  14076. updateTime: 1522034840000
  14077. },
  14078. {
  14079. moduleCode: "",
  14080. detailCode: "391104",
  14081. description: "proxy设置文件描述符阻塞失败",
  14082. solution: "",
  14083. updateTime: 1522034840000
  14084. },
  14085. {
  14086. moduleCode: "",
  14087. detailCode: "160011",
  14088. description: "预置点不存在",
  14089. solution: "",
  14090. updateTime: 1522034840000
  14091. },
  14092. {
  14093. moduleCode: "",
  14094. detailCode: "391105",
  14095. description: "proxy解析服务器ip失败",
  14096. solution: "",
  14097. updateTime: 1522034840000
  14098. },
  14099. {
  14100. moduleCode: "",
  14101. detailCode: "110008",
  14102. description: "签名错误",
  14103. solution: "①获取签名方式详见apidemo及[旧]API文档 ②注意编码格式为UTF-8",
  14104. updateTime: 1522034840000
  14105. },
  14106. {
  14107. moduleCode: "",
  14108. detailCode: "160013",
  14109. description: "设备版本已是最新",
  14110. solution: "",
  14111. updateTime: 1522034840000
  14112. },
  14113. {
  14114. moduleCode: "",
  14115. detailCode: "391106",
  14116. description: "proxy描述符select失败",
  14117. solution: "",
  14118. updateTime: 1522034840000
  14119. },
  14120. {
  14121. moduleCode: "",
  14122. detailCode: "110009",
  14123. description: "签名参数错误",
  14124. solution: "",
  14125. updateTime: 1522034840000
  14126. },
  14127. {
  14128. moduleCode: "",
  14129. detailCode: "160014",
  14130. description: "设备正在升级",
  14131. solution: "",
  14132. updateTime: 1522034840000
  14133. },
  14134. {
  14135. moduleCode: "",
  14136. detailCode: "391107",
  14137. description: "proxy文件描述符不在可读中",
  14138. solution: "",
  14139. updateTime: 1522034840000
  14140. },
  14141. {
  14142. moduleCode: "",
  14143. detailCode: "110010",
  14144. description: "签名超时",
  14145. solution: "请调用同步服务器时间接口进行校时",
  14146. updateTime: 1522034840000
  14147. },
  14148. {
  14149. moduleCode: "",
  14150. detailCode: "160015",
  14151. description: "设备正在重启",
  14152. solution: "",
  14153. updateTime: 1522034840000
  14154. },
  14155. {
  14156. moduleCode: "",
  14157. detailCode: "391108",
  14158. description: "proxy网络发生错误getsockopt",
  14159. solution: "",
  14160. updateTime: 1522034840000
  14161. },
  14162. {
  14163. moduleCode: "",
  14164. detailCode: "110011",
  14165. description: "未开通萤石云服务",
  14166. solution: "参照绑定流程",
  14167. updateTime: 1522034840000
  14168. },
  14169. {
  14170. moduleCode: "",
  14171. detailCode: "160016",
  14172. description: "加密未开启,无须关闭",
  14173. solution: "",
  14174. updateTime: 1522034840000
  14175. },
  14176. {
  14177. moduleCode: "",
  14178. detailCode: "391109",
  14179. description: "proxy描述符select超时",
  14180. solution: "",
  14181. updateTime: 1522034840000
  14182. },
  14183. {
  14184. moduleCode: "",
  14185. detailCode: "110012",
  14186. description: "第三方账户与萤石账号已经绑定",
  14187. solution: "",
  14188. updateTime: 1522034840000
  14189. },
  14190. {
  14191. moduleCode: "",
  14192. detailCode: "160017",
  14193. description: "设备抓图失败",
  14194. solution: "",
  14195. updateTime: 1522034840000
  14196. },
  14197. {
  14198. moduleCode: "",
  14199. detailCode: "391201",
  14200. description: "vtdu地址或端口非法",
  14201. solution: "",
  14202. updateTime: 1522034840000
  14203. },
  14204. {
  14205. moduleCode: "",
  14206. detailCode: "110013",
  14207. description: "应用没有权限调用此接口",
  14208. solution: "",
  14209. updateTime: 1522034840000
  14210. },
  14211. {
  14212. moduleCode: "",
  14213. detailCode: "160018",
  14214. description: "设备升级失败",
  14215. solution: "",
  14216. updateTime: 1522034840000
  14217. },
  14218. {
  14219. moduleCode: "",
  14220. detailCode: "391202",
  14221. description: "vtdu生成文件描述符失败",
  14222. solution: "",
  14223. updateTime: 1522034840000
  14224. },
  14225. {
  14226. moduleCode: "",
  14227. detailCode: "110014",
  14228. description: "APPKEY下对应的第三方userId和phone未绑定",
  14229. solution: "获取AccessToken时所用appKey与SDK所用appKey不一致",
  14230. updateTime: 1522034840000
  14231. },
  14232. {
  14233. moduleCode: "",
  14234. detailCode: "160019",
  14235. description: "加密已开启",
  14236. solution: "",
  14237. updateTime: 1522034840000
  14238. },
  14239. {
  14240. moduleCode: "",
  14241. detailCode: "391203",
  14242. description: "vtdu设置文件描述符非阻塞失败",
  14243. solution: "",
  14244. updateTime: 1522034840000
  14245. },
  14246. {
  14247. moduleCode: "",
  14248. detailCode: "110017",
  14249. description: "appKey不存在",
  14250. solution: "请填写在官网申请的应用秘钥",
  14251. updateTime: 1522034840000
  14252. },
  14253. {
  14254. moduleCode: "",
  14255. detailCode: "160020",
  14256. description: "不支持该命令",
  14257. solution: "请确认设备是否支持该命令",
  14258. updateTime: 1522034840000
  14259. },
  14260. {
  14261. moduleCode: "",
  14262. detailCode: "391204",
  14263. description: "vtdu设置文件描述符阻塞失败",
  14264. solution: "",
  14265. updateTime: 1522034840000
  14266. },
  14267. {
  14268. moduleCode: "",
  14269. detailCode: "110018",
  14270. description: "AccessToken与Appkey不匹配",
  14271. solution: "请检查获取accessToken对应的appKey和SDK中设置的appKey是否一致",
  14272. updateTime: 1522034840000
  14273. },
  14274. {
  14275. moduleCode: "",
  14276. detailCode: "160023",
  14277. description: "订阅操作失败",
  14278. solution: "",
  14279. updateTime: 1522034840000
  14280. },
  14281. {
  14282. moduleCode: "",
  14283. detailCode: "110019",
  14284. description: "密码错误",
  14285. solution: "",
  14286. updateTime: 1522034840000
  14287. },
  14288. {
  14289. moduleCode: "",
  14290. detailCode: "160024",
  14291. description: "取消订阅操作失败",
  14292. solution: "",
  14293. updateTime: 1522034840000
  14294. },
  14295. {
  14296. moduleCode: "",
  14297. detailCode: "110020",
  14298. description: "请求方法为空",
  14299. solution: "",
  14300. updateTime: 1522034840000
  14301. },
  14302. {
  14303. moduleCode: "",
  14304. detailCode: "160025",
  14305. description: "客流统计配置失败",
  14306. solution: "",
  14307. updateTime: 1522034840000
  14308. },
  14309. {
  14310. moduleCode: "",
  14311. detailCode: "110021",
  14312. description: "ticket校验失败",
  14313. solution: "",
  14314. updateTime: 1522034840000
  14315. },
  14316. {
  14317. moduleCode: "",
  14318. detailCode: "160026",
  14319. description: "设备处于隐私遮蔽状态",
  14320. solution: "",
  14321. updateTime: 1522034840000
  14322. },
  14323. {
  14324. moduleCode: "",
  14325. detailCode: "110022",
  14326. description: "透传目的地非法",
  14327. solution: "",
  14328. updateTime: 1522034840000
  14329. },
  14330. {
  14331. moduleCode: "",
  14332. detailCode: "160027",
  14333. description: "设备正在镜像操作",
  14334. solution: "",
  14335. updateTime: 1522034840000
  14336. },
  14337. {
  14338. moduleCode: "",
  14339. detailCode: "110024",
  14340. description: "无透传权限",
  14341. solution: "",
  14342. updateTime: 1522034840000
  14343. },
  14344. {
  14345. moduleCode: "",
  14346. detailCode: "160028",
  14347. description: "设备正在键控动作",
  14348. solution: "",
  14349. updateTime: 1522034840000
  14350. },
  14351. {
  14352. moduleCode: "",
  14353. detailCode: "110025",
  14354. description: "appKey被禁止使用通明通道",
  14355. solution: "",
  14356. updateTime: 1522034840000
  14357. },
  14358. {
  14359. moduleCode: "",
  14360. detailCode: "160029",
  14361. description: "设备处于语音对讲状态",
  14362. solution: "",
  14363. updateTime: 1522034840000
  14364. },
  14365. {
  14366. moduleCode: "",
  14367. detailCode: "160030",
  14368. description: "卡密输入错误次数过多,24小时后再输入",
  14369. solution: "",
  14370. updateTime: 1522034840000
  14371. },
  14372. {
  14373. moduleCode: "",
  14374. detailCode: "160031",
  14375. description: "卡密信息不存在",
  14376. solution: "",
  14377. updateTime: 1522034840000
  14378. },
  14379. {
  14380. moduleCode: "",
  14381. detailCode: "160032",
  14382. description: "卡密状态不对或已过期",
  14383. solution: "",
  14384. updateTime: 1522034840000
  14385. },
  14386. {
  14387. moduleCode: "",
  14388. detailCode: "160033",
  14389. description: "卡密非卖品,只能开通对应的绑定设备",
  14390. solution: "",
  14391. updateTime: 1522034840000
  14392. },
  14393. {
  14394. moduleCode: "",
  14395. detailCode: "110030",
  14396. description: "appKey和appSecret不匹配",
  14397. solution: "请检查appKey和appSecret是否对应",
  14398. updateTime: 1522034840000
  14399. },
  14400. {
  14401. moduleCode: "",
  14402. detailCode: "160035",
  14403. description: "购买云存储服务失败",
  14404. solution: "",
  14405. updateTime: 1522034840000
  14406. },
  14407. {
  14408. moduleCode: "",
  14409. detailCode: "110031",
  14410. description: "子账户或萤石用户没有权限",
  14411. solution: "",
  14412. updateTime: 1522034840000
  14413. },
  14414. {
  14415. moduleCode: "",
  14416. detailCode: "160040",
  14417. description: "添加的设备不在同一局域网",
  14418. solution: "",
  14419. updateTime: 1522034840000
  14420. },
  14421. {
  14422. moduleCode: "",
  14423. detailCode: "110032",
  14424. description: "子账户不存在",
  14425. solution: "",
  14426. updateTime: 1522034840000
  14427. },
  14428. {
  14429. moduleCode: "",
  14430. detailCode: "160041",
  14431. description: "添加的设备被其他设备关联或响应超时",
  14432. solution: "",
  14433. updateTime: 1522034840000
  14434. },
  14435. {
  14436. moduleCode: "",
  14437. detailCode: "110033",
  14438. description: "子账户未设置授权策略",
  14439. solution: "",
  14440. updateTime: 1522034840000
  14441. },
  14442. {
  14443. moduleCode: "",
  14444. detailCode: "160042",
  14445. description: "添加的设备密码错误",
  14446. solution: "",
  14447. updateTime: 1522034840000
  14448. },
  14449. {
  14450. moduleCode: "",
  14451. detailCode: "110034",
  14452. description: "子账户已存在",
  14453. solution: "",
  14454. updateTime: 1522034840000
  14455. },
  14456. {
  14457. moduleCode: "",
  14458. detailCode: "160043",
  14459. description: "添加的设备超出最大数量",
  14460. solution: "",
  14461. updateTime: 1522034840000
  14462. },
  14463. {
  14464. moduleCode: "",
  14465. detailCode: "110035",
  14466. description: "获取子账户AccessToken异常",
  14467. solution: "",
  14468. updateTime: 1522034840000
  14469. },
  14470. {
  14471. moduleCode: "",
  14472. detailCode: "160044",
  14473. description: "添加的设备网络不可达超时",
  14474. solution: "",
  14475. updateTime: 1522034840000
  14476. },
  14477. {
  14478. moduleCode: "",
  14479. detailCode: "110036",
  14480. description: "子账户被禁用",
  14481. solution: "",
  14482. updateTime: 1522034840000
  14483. },
  14484. {
  14485. moduleCode: "",
  14486. detailCode: "160045",
  14487. description: "添加的设备的IP和其他通道的IP冲突",
  14488. solution: "",
  14489. updateTime: 1522034840000
  14490. },
  14491. {
  14492. moduleCode: "",
  14493. detailCode: "110051",
  14494. description: "无权限进行抓图",
  14495. solution: "",
  14496. updateTime: 1522034840000
  14497. },
  14498. {
  14499. moduleCode: "",
  14500. detailCode: "160046",
  14501. description: "添加的设备的IP和本设备的IP冲突",
  14502. solution: "",
  14503. updateTime: 1522034840000
  14504. },
  14505. {
  14506. moduleCode: "",
  14507. detailCode: "160047",
  14508. description: "码流类型不支持",
  14509. solution: "",
  14510. updateTime: 1522034840000
  14511. },
  14512. {
  14513. moduleCode: "",
  14514. detailCode: "120002",
  14515. description: "设备不存在",
  14516. solution: "①设备没有注册到萤石云平台,请检查下设备网络参数,确保能正常连接网络②设备序列号不存在",
  14517. updateTime: 1522034840000
  14518. },
  14519. {
  14520. moduleCode: "",
  14521. detailCode: "160048",
  14522. description: "带宽超出系统接入带宽",
  14523. solution: "",
  14524. updateTime: 1522034840000
  14525. },
  14526. {
  14527. moduleCode: "",
  14528. detailCode: "120003",
  14529. description: "参数异常,SDK版本过低",
  14530. solution: "",
  14531. updateTime: 1522034840000
  14532. },
  14533. {
  14534. moduleCode: "",
  14535. detailCode: "160049",
  14536. description: "IP或者端口不合法",
  14537. solution: "",
  14538. updateTime: 1522034840000
  14539. },
  14540. {
  14541. moduleCode: "",
  14542. detailCode: "120004",
  14543. description: "参数异常,SDK版本过低",
  14544. solution: "",
  14545. updateTime: 1522034840000
  14546. },
  14547. {
  14548. moduleCode: "",
  14549. detailCode: "160050",
  14550. description: "添加的设备版本不支持需要升级才能接入",
  14551. solution: "",
  14552. updateTime: 1522034840000
  14553. },
  14554. {
  14555. moduleCode: "",
  14556. detailCode: "120005",
  14557. description: "安全认证失败,需进行SDK安全认证",
  14558. solution: "已去掉安全验证",
  14559. updateTime: 1522034840000
  14560. },
  14561. {
  14562. moduleCode: "",
  14563. detailCode: "160051",
  14564. description: "添加的设备不支持接入",
  14565. solution: "",
  14566. updateTime: 1522034840000
  14567. },
  14568. {
  14569. moduleCode: "",
  14570. detailCode: "120006",
  14571. description: "网络异常",
  14572. solution: "",
  14573. updateTime: 1522034840000
  14574. },
  14575. {
  14576. moduleCode: "",
  14577. detailCode: "160052",
  14578. description: "添加的设备通道号出错",
  14579. solution: "",
  14580. updateTime: 1522034840000
  14581. },
  14582. {
  14583. moduleCode: "",
  14584. detailCode: "120007",
  14585. description: "设备不在线",
  14586. solution: "参考服务中心排查方法",
  14587. updateTime: 1522034840000
  14588. },
  14589. {
  14590. moduleCode: "",
  14591. detailCode: "160053",
  14592. description: "添加的设备分辨率不支持",
  14593. solution: "",
  14594. updateTime: 1522034840000
  14595. },
  14596. {
  14597. moduleCode: "",
  14598. detailCode: "120008",
  14599. description: "设备响应超时",
  14600. solution: "设备响应超时,请检测设备网络或重试",
  14601. updateTime: 1522034840000
  14602. },
  14603. {
  14604. moduleCode: "",
  14605. detailCode: "160054",
  14606. description: "添加的设备账号被锁定",
  14607. solution: "",
  14608. updateTime: 1522034840000
  14609. },
  14610. {
  14611. moduleCode: "",
  14612. detailCode: "120009",
  14613. description: "子账号不能添加设备",
  14614. solution: "",
  14615. updateTime: 1522034840000
  14616. },
  14617. {
  14618. moduleCode: "",
  14619. detailCode: "160055",
  14620. description: "添加的设备取码流出错",
  14621. solution: "",
  14622. updateTime: 1522034840000
  14623. },
  14624. {
  14625. moduleCode: "",
  14626. detailCode: "120010",
  14627. description: "设备验证码错误",
  14628. solution: "验证码在设备标签上,六位大写字母,注意大小写",
  14629. updateTime: 1522034840000
  14630. },
  14631. {
  14632. moduleCode: "",
  14633. detailCode: "160056",
  14634. description: "删除设备失败",
  14635. solution: "",
  14636. updateTime: 1522034840000
  14637. },
  14638. {
  14639. moduleCode: "",
  14640. detailCode: "120012",
  14641. description: "设备添加失败",
  14642. solution: "",
  14643. updateTime: 1522034840000
  14644. },
  14645. {
  14646. moduleCode: "",
  14647. detailCode: "160057",
  14648. description: "删除的设备未关联",
  14649. solution: "检查IPC与NVR是否有关联关系",
  14650. updateTime: 1522034840000
  14651. },
  14652. {
  14653. moduleCode: "",
  14654. detailCode: "120013",
  14655. description: "设备已被别人添加",
  14656. solution: "",
  14657. updateTime: 1522034840000
  14658. },
  14659. {
  14660. moduleCode: "",
  14661. detailCode: "160060",
  14662. description: "地址未绑定",
  14663. solution: "请前往官网设置直播",
  14664. updateTime: 1522034840000
  14665. },
  14666. {
  14667. moduleCode: "",
  14668. detailCode: "120014",
  14669. description: "设备序列号不正确",
  14670. solution: "",
  14671. updateTime: 1522034840000
  14672. },
  14673. {
  14674. moduleCode: "",
  14675. detailCode: "160061",
  14676. description: "账户流量已超出或未购买,限制开通",
  14677. solution: "",
  14678. updateTime: 1522034840000
  14679. },
  14680. {
  14681. moduleCode: "",
  14682. detailCode: "120015",
  14683. description: "设备不支持该功能",
  14684. solution: "",
  14685. updateTime: 1522034840000
  14686. },
  14687. {
  14688. moduleCode: "",
  14689. detailCode: "160062",
  14690. description: "该通道直播已开通",
  14691. solution: "",
  14692. updateTime: 1522034840000
  14693. },
  14694. {
  14695. moduleCode: "",
  14696. detailCode: "120016",
  14697. description: "当前设备正在格式化",
  14698. solution: "",
  14699. updateTime: 1522034840000
  14700. },
  14701. {
  14702. moduleCode: "",
  14703. detailCode: "160063",
  14704. description: "直播未使用或直播已关闭",
  14705. solution: "",
  14706. updateTime: 1522034840000
  14707. },
  14708. {
  14709. moduleCode: "",
  14710. detailCode: "120017",
  14711. description: "设备已被自己添加",
  14712. solution: "",
  14713. updateTime: 1522034840000
  14714. },
  14715. {
  14716. moduleCode: "",
  14717. detailCode: "160070",
  14718. description: "设备不能转移给自己",
  14719. solution: "",
  14720. updateTime: 1522034840000
  14721. },
  14722. {
  14723. moduleCode: "",
  14724. detailCode: "120018",
  14725. description: "该用户不拥有该设备",
  14726. solution: "确认设备是否属于用户",
  14727. updateTime: 1522034840000
  14728. },
  14729. {
  14730. moduleCode: "",
  14731. detailCode: "160071",
  14732. description: "设备不能转移,设备与其他设备存在关联关系",
  14733. solution: "",
  14734. updateTime: 1522034840000
  14735. },
  14736. {
  14737. moduleCode: "",
  14738. detailCode: "400001",
  14739. description: "参数为空",
  14740. solution: "",
  14741. updateTime: 1522034840000
  14742. },
  14743. {
  14744. moduleCode: "",
  14745. detailCode: "120019",
  14746. description: "设备不支持云存储服务",
  14747. solution: "",
  14748. updateTime: 1522034840000
  14749. },
  14750. {
  14751. moduleCode: "",
  14752. detailCode: "160072",
  14753. description: "设备不能转移,通道被分享给其他用户或者分享到视频广场",
  14754. solution: "",
  14755. updateTime: 1522034840000
  14756. },
  14757. {
  14758. moduleCode: "",
  14759. detailCode: "400002",
  14760. description: "参数错误",
  14761. solution: "",
  14762. updateTime: 1522034840000
  14763. },
  14764. {
  14765. moduleCode: "",
  14766. detailCode: "120020",
  14767. description: "设备在线,被自己添加",
  14768. solution: "",
  14769. updateTime: 1522034840000
  14770. },
  14771. {
  14772. moduleCode: "",
  14773. detailCode: "160073",
  14774. description: "云存储转移失败",
  14775. solution: "",
  14776. updateTime: 1522034840000
  14777. },
  14778. {
  14779. moduleCode: "",
  14780. detailCode: "400025",
  14781. description: "设备不支持对讲",
  14782. solution: "",
  14783. updateTime: 1522034840000
  14784. },
  14785. {
  14786. moduleCode: "",
  14787. detailCode: "120021",
  14788. description: "设备在线,但是未被用户添加",
  14789. solution: "",
  14790. updateTime: 1522034840000
  14791. },
  14792. {
  14793. moduleCode: "",
  14794. detailCode: "160080",
  14795. description: "当前正在声源定位",
  14796. solution: "",
  14797. updateTime: 1522034840000
  14798. },
  14799. {
  14800. moduleCode: "",
  14801. detailCode: "400029",
  14802. description: "没有初始化或资源被释放",
  14803. solution: "",
  14804. updateTime: 1522034840000
  14805. },
  14806. {
  14807. moduleCode: "",
  14808. detailCode: "120022",
  14809. description: "设备在线,但是已经被别的用户添加",
  14810. solution: "",
  14811. updateTime: 1522034840000
  14812. },
  14813. {
  14814. moduleCode: "",
  14815. detailCode: "160081",
  14816. description: "当前正在轨迹巡航",
  14817. solution: "",
  14818. updateTime: 1522034840000
  14819. },
  14820. {
  14821. moduleCode: "",
  14822. detailCode: "400030",
  14823. description: "json解析异常",
  14824. solution: "",
  14825. updateTime: 1522034840000
  14826. },
  14827. {
  14828. moduleCode: "",
  14829. detailCode: "120023",
  14830. description: "设备不在线,未被用户添加",
  14831. solution: "",
  14832. updateTime: 1522034840000
  14833. },
  14834. {
  14835. moduleCode: "",
  14836. detailCode: "160082",
  14837. description: "设备正在响应本次声源定位",
  14838. solution: "",
  14839. updateTime: 1522034840000
  14840. },
  14841. {
  14842. moduleCode: "",
  14843. detailCode: "400031",
  14844. description: "网络异常",
  14845. solution: "",
  14846. updateTime: 1522034840000
  14847. },
  14848. {
  14849. moduleCode: "",
  14850. detailCode: "120024",
  14851. description: "设备不在线,但是已经被别的用户添加",
  14852. solution: "",
  14853. updateTime: 1522034840000
  14854. },
  14855. {
  14856. moduleCode: "",
  14857. detailCode: "160083",
  14858. description: "当前正在开启隐私遮蔽",
  14859. solution: "设备正在操作隐私遮蔽,无法进行当前操作",
  14860. updateTime: 1522034840000
  14861. },
  14862. {
  14863. moduleCode: "",
  14864. detailCode: "400032",
  14865. description: "设备信息异常为空",
  14866. solution: "",
  14867. updateTime: 1522034840000
  14868. },
  14869. {
  14870. moduleCode: "",
  14871. detailCode: "120025",
  14872. description: "重复申请分享",
  14873. solution: "确认设备是否由添加过该设备且申请过分享的账户下是否还存在分享记录",
  14874. updateTime: 1522034840000
  14875. },
  14876. {
  14877. moduleCode: "",
  14878. detailCode: "160084",
  14879. description: "当前正在关闭隐私遮蔽",
  14880. solution: "设备正在操作隐私遮蔽,无法进行当前操作",
  14881. updateTime: 1522034840000
  14882. },
  14883. {
  14884. moduleCode: "",
  14885. detailCode: "400034",
  14886. description: "取流超时",
  14887. solution: "一般是由于网络状况不好导致,可以尝试下让用户重新播放",
  14888. updateTime: 1522034840000
  14889. },
  14890. {
  14891. moduleCode: "",
  14892. detailCode: "120026",
  14893. description: "视频广场不存在该视频",
  14894. solution: "",
  14895. updateTime: 1522034840000
  14896. },
  14897. {
  14898. moduleCode: "",
  14899. detailCode: "380290",
  14900. description: " 连接CAS服务器失败",
  14901. solution: "",
  14902. updateTime: 1522034840000
  14903. },
  14904. {
  14905. moduleCode: "",
  14906. detailCode: "400035",
  14907. description: "设备已加密,需要输入验证码",
  14908. solution: "收到此错误码,需要让用户输入验证码后,调用EZPlayer.setPlayKey传入验证码,并重新调用播放函数",
  14909. updateTime: 1522034840000
  14910. },
  14911. {
  14912. moduleCode: "",
  14913. detailCode: "120027",
  14914. description: "视频转码失败",
  14915. solution: "",
  14916. updateTime: 1522034840000
  14917. },
  14918. {
  14919. moduleCode: "",
  14920. detailCode: "361001",
  14921. description: "对讲服务端排队超时",
  14922. solution: "",
  14923. updateTime: 1522034840000
  14924. },
  14925. {
  14926. moduleCode: "",
  14927. detailCode: "400036",
  14928. description: "播放验证码错误",
  14929. solution: "收到此错误码,需要让用户输入验证码后,调用EZPlayer.setPlayKey传入验证码,并重新调用播放函数",
  14930. updateTime: 1522034840000
  14931. },
  14932. {
  14933. moduleCode: "",
  14934. detailCode: "120028",
  14935. description: "设备固件升级包不存在",
  14936. solution: "",
  14937. updateTime: 1522034840000
  14938. },
  14939. {
  14940. moduleCode: "",
  14941. detailCode: "361002",
  14942. description: "对讲服务端处理超时",
  14943. solution: "",
  14944. updateTime: 1522034840000
  14945. },
  14946. {
  14947. moduleCode: "",
  14948. detailCode: "400037",
  14949. description: "surfacehold错误",
  14950. solution: "请检查是否是播放之前销毁了surface,收到此错误也可以重新建立surface后播放",
  14951. updateTime: 1522034840000
  14952. },
  14953. {
  14954. moduleCode: "",
  14955. detailCode: "120029",
  14956. description: "设备不在线,但是已经被自己添加",
  14957. solution: "",
  14958. updateTime: 1522034840000
  14959. },
  14960. {
  14961. moduleCode: "",
  14962. detailCode: "361003",
  14963. description: "设备链接对讲服务器超时",
  14964. solution: "",
  14965. updateTime: 1522034840000
  14966. },
  14967. {
  14968. moduleCode: "",
  14969. detailCode: "400100",
  14970. description: "未知错误",
  14971. solution: "",
  14972. updateTime: 1522034840000
  14973. },
  14974. {
  14975. moduleCode: "",
  14976. detailCode: "120030",
  14977. description: "该用户不拥有该视频广场视频",
  14978. solution: "",
  14979. updateTime: 1522034840000
  14980. },
  14981. {
  14982. moduleCode: "",
  14983. detailCode: "361004",
  14984. description: "服务器内部错误",
  14985. solution: "",
  14986. updateTime: 1522034840000
  14987. },
  14988. {
  14989. moduleCode: "",
  14990. detailCode: "400200",
  14991. description: "player sdk出错,这种错误一般开发者也是无法解决,不具体分类传出,传一个统一的inner错误码出去",
  14992. solution: "",
  14993. updateTime: 1522034840000
  14994. },
  14995. {
  14996. moduleCode: "",
  14997. detailCode: "120031",
  14998. description: "开启终端绑定,硬件特征码验证失败",
  14999. solution: "请在萤石客户端关闭终端绑定,参考此步骤",
  15000. updateTime: 1522034840000
  15001. },
  15002. {
  15003. moduleCode: "",
  15004. detailCode: "361005",
  15005. description: "解析消息失败",
  15006. solution: "",
  15007. updateTime: 1522034840000
  15008. },
  15009. {
  15010. moduleCode: "",
  15011. detailCode: "400300",
  15012. description: "内存溢出",
  15013. solution: "",
  15014. updateTime: 1522034840000
  15015. },
  15016. {
  15017. moduleCode: "",
  15018. detailCode: "120032",
  15019. description: "该用户下通道不存在",
  15020. solution: "",
  15021. updateTime: 1522034840000
  15022. },
  15023. {
  15024. moduleCode: "",
  15025. detailCode: "361006",
  15026. description: "请求重定向--需要向其他服务申请对讲",
  15027. solution: "",
  15028. updateTime: 1522034840000
  15029. },
  15030. {
  15031. moduleCode: "",
  15032. detailCode: "400901",
  15033. description: "设备不在线,可以提示用户",
  15034. solution: "",
  15035. updateTime: 1522034840000
  15036. },
  15037. {
  15038. moduleCode: "",
  15039. detailCode: "120033",
  15040. description: "无法收藏自己分享的视频",
  15041. solution: "",
  15042. updateTime: 1522034840000
  15043. },
  15044. {
  15045. moduleCode: "",
  15046. detailCode: "361007",
  15047. description: "请求url非法",
  15048. solution: "",
  15049. updateTime: 1522034840000
  15050. },
  15051. {
  15052. moduleCode: "",
  15053. detailCode: "400902",
  15054. description: "accesstoken异常或失效,需要重新获取accesstoken,并传入到sdk",
  15055. solution: "",
  15056. updateTime: 1522034840000
  15057. },
  15058. {
  15059. moduleCode: "",
  15060. detailCode: "120034",
  15061. description: "该用户下无设备",
  15062. solution: "",
  15063. updateTime: 1522034840000
  15064. },
  15065. {
  15066. moduleCode: "",
  15067. detailCode: "361008",
  15068. description: "token失效",
  15069. solution: "",
  15070. updateTime: 1522034840000
  15071. },
  15072. {
  15073. moduleCode: "",
  15074. detailCode: "400903",
  15075. description: "当前账号开启了终端绑定,只允许指定设备登录操作,提示用户登录i.ys7.com解除终端绑定",
  15076. solution: "",
  15077. updateTime: 1522034840000
  15078. },
  15079. {
  15080. moduleCode: "",
  15081. detailCode: "120090",
  15082. description: "用户反馈失败",
  15083. solution: "",
  15084. updateTime: 1522034840000
  15085. },
  15086. {
  15087. moduleCode: "",
  15088. detailCode: "361009",
  15089. description: "设备验证码或者通信秘钥不匹配",
  15090. solution: "",
  15091. updateTime: 1522034840000
  15092. },
  15093. {
  15094. moduleCode: "",
  15095. detailCode: "400904",
  15096. description: "设备正在对讲中",
  15097. solution: "",
  15098. updateTime: 1522034840000
  15099. },
  15100. {
  15101. moduleCode: "",
  15102. detailCode: "120095",
  15103. description: "APP包下载失败",
  15104. solution: "",
  15105. updateTime: 1522034840000
  15106. },
  15107. {
  15108. moduleCode: "",
  15109. detailCode: "361010",
  15110. description: "设备已经在对讲",
  15111. solution: "",
  15112. updateTime: 1522034840000
  15113. },
  15114. {
  15115. moduleCode: "",
  15116. detailCode: "400905",
  15117. description: "设备开启了隐私保护,不允许预览、对讲等",
  15118. solution: "",
  15119. updateTime: 1522034840000
  15120. },
  15121. {
  15122. moduleCode: "",
  15123. detailCode: "120096",
  15124. description: "APP包信息删除失败",
  15125. solution: "",
  15126. updateTime: 1522034840000
  15127. },
  15128. {
  15129. moduleCode: "",
  15130. detailCode: "361011",
  15131. description: "设备10s响应超时",
  15132. solution: "",
  15133. updateTime: 1522034840000
  15134. },
  15135. {
  15136. moduleCode: "",
  15137. detailCode: "120101",
  15138. description: "视频不支持分享给本人",
  15139. solution: "",
  15140. updateTime: 1522034840000
  15141. },
  15142. {
  15143. moduleCode: "",
  15144. detailCode: "361012",
  15145. description: "设备不在线",
  15146. solution: "",
  15147. updateTime: 1522034840000
  15148. },
  15149. {
  15150. moduleCode: "",
  15151. detailCode: "320002",
  15152. description: "参数无效",
  15153. solution: "",
  15154. updateTime: 1522034840000
  15155. },
  15156. {
  15157. moduleCode: "",
  15158. detailCode: "120102",
  15159. description: "无相应邀请信息",
  15160. solution: "",
  15161. updateTime: 1522034840000
  15162. },
  15163. {
  15164. moduleCode: "",
  15165. detailCode: "361013",
  15166. description: "设备开启隐私保护拒绝对讲",
  15167. solution: "",
  15168. updateTime: 1522034840000
  15169. },
  15170. {
  15171. moduleCode: "",
  15172. detailCode: "320003",
  15173. description: "暂不支持此操作",
  15174. solution: "",
  15175. updateTime: 1522034840000
  15176. },
  15177. {
  15178. moduleCode: "",
  15179. detailCode: "120103",
  15180. description: "好友已存在",
  15181. solution: "",
  15182. updateTime: 1522034840000
  15183. },
  15184. {
  15185. moduleCode: "",
  15186. detailCode: "361014",
  15187. description: "token无权限",
  15188. solution: "",
  15189. updateTime: 1522034840000
  15190. },
  15191. {
  15192. moduleCode: "",
  15193. detailCode: "320004",
  15194. description: "内存溢出",
  15195. solution: "",
  15196. updateTime: 1522034840000
  15197. },
  15198. {
  15199. moduleCode: "",
  15200. detailCode: "120104",
  15201. description: "好友不存在",
  15202. solution: "",
  15203. updateTime: 1522034840000
  15204. },
  15205. {
  15206. moduleCode: "",
  15207. detailCode: "361015",
  15208. description: "设备返回session不存在",
  15209. solution: "",
  15210. updateTime: 1522034840000
  15211. },
  15212. {
  15213. moduleCode: "",
  15214. detailCode: "320005",
  15215. description: "创建CAS session失败",
  15216. solution: "",
  15217. updateTime: 1522034840000
  15218. },
  15219. {
  15220. moduleCode: "",
  15221. detailCode: "120105",
  15222. description: "好友状态错误",
  15223. solution: "",
  15224. updateTime: 1522034840000
  15225. },
  15226. {
  15227. moduleCode: "",
  15228. detailCode: "361016",
  15229. description: "验证token其他异常错误",
  15230. solution: "",
  15231. updateTime: 1522034840000
  15232. },
  15233. {
  15234. moduleCode: "",
  15235. detailCode: "320006",
  15236. description: "创建cloud session失败",
  15237. solution: "",
  15238. updateTime: 1522034840000
  15239. },
  15240. {
  15241. moduleCode: "",
  15242. detailCode: "120106",
  15243. description: "对应群组不存在",
  15244. solution: "",
  15245. updateTime: 1522034840000
  15246. },
  15247. {
  15248. moduleCode: "",
  15249. detailCode: "361017",
  15250. description: "服务端监听设备建立端口超时",
  15251. solution: "",
  15252. updateTime: 1522034840000
  15253. },
  15254. {
  15255. moduleCode: "",
  15256. detailCode: "320007",
  15257. description: "token失效",
  15258. solution: "重新设置token后再重试",
  15259. updateTime: 1522034840000
  15260. },
  15261. {
  15262. moduleCode: "",
  15263. detailCode: "120107",
  15264. description: "不能添加自己为好友",
  15265. solution: "",
  15266. updateTime: 1522034840000
  15267. },
  15268. {
  15269. moduleCode: "",
  15270. detailCode: "361018",
  15271. description: "设备链路异常",
  15272. solution: "",
  15273. updateTime: 1522034840000
  15274. },
  15275. {
  15276. moduleCode: "",
  15277. detailCode: "320008",
  15278. description: "token池里面没有token,请传入token",
  15279. solution: "",
  15280. updateTime: 1522034840000
  15281. },
  15282. {
  15283. moduleCode: "",
  15284. detailCode: "120108",
  15285. description: "当前用户和所添加用户不是好友关系",
  15286. solution: "",
  15287. updateTime: 1522034840000
  15288. },
  15289. {
  15290. moduleCode: "",
  15291. detailCode: "361019",
  15292. description: "对讲服务端不支持的信令消息",
  15293. solution: "",
  15294. updateTime: 1522034840000
  15295. },
  15296. {
  15297. moduleCode: "",
  15298. detailCode: "320009",
  15299. description: "传入新的INIT_PARAM并reset(保留,目前未用)",
  15300. solution: "",
  15301. updateTime: 1522034840000
  15302. },
  15303. {
  15304. moduleCode: "",
  15305. detailCode: "120109",
  15306. description: "对应分享不存在",
  15307. solution: "",
  15308. updateTime: 1522034840000
  15309. },
  15310. {
  15311. moduleCode: "",
  15312. detailCode: "361020",
  15313. description: "对讲服务端解析对讲请求未携带会话描述能力集",
  15314. solution: "",
  15315. updateTime: 1522034840000
  15316. },
  15317. {
  15318. moduleCode: "",
  15319. detailCode: "320010",
  15320. description: "请重试",
  15321. solution: "",
  15322. updateTime: 1522034840000
  15323. },
  15324. {
  15325. moduleCode: "",
  15326. detailCode: "120110",
  15327. description: "好友群组不属于当前用户",
  15328. solution: "",
  15329. updateTime: 1522034840000
  15330. },
  15331. {
  15332. moduleCode: "",
  15333. detailCode: "361021",
  15334. description: "对讲服务端优先能力集结果为空",
  15335. solution: "",
  15336. updateTime: 1522034840000
  15337. },
  15338. {
  15339. moduleCode: "",
  15340. detailCode: "320011",
  15341. description: "500毫秒后请重试",
  15342. solution: "",
  15343. updateTime: 1522034840000
  15344. },
  15345. {
  15346. moduleCode: "",
  15347. detailCode: "120111",
  15348. description: "好友不是等待验证状态",
  15349. solution: "",
  15350. updateTime: 1522034840000
  15351. },
  15352. {
  15353. moduleCode: "",
  15354. detailCode: "361022",
  15355. description: "cas链路异常",
  15356. solution: "",
  15357. updateTime: 1522034840000
  15358. },
  15359. {
  15360. moduleCode: "",
  15361. detailCode: "320012",
  15362. description: "token池已满",
  15363. solution: "",
  15364. updateTime: 1522034840000
  15365. },
  15366. {
  15367. moduleCode: "",
  15368. detailCode: "120112",
  15369. description: "添加应用下的用户为好友失败",
  15370. solution: "",
  15371. updateTime: 1522034840000
  15372. },
  15373. {
  15374. moduleCode: "",
  15375. detailCode: "361023",
  15376. description: "对讲服务端分配对讲会话资源失败",
  15377. solution: "",
  15378. updateTime: 1522034840000
  15379. },
  15380. {
  15381. moduleCode: "",
  15382. detailCode: "320013",
  15383. description: "P2P client超过限制",
  15384. solution: "",
  15385. updateTime: 1522034840000
  15386. },
  15387. {
  15388. moduleCode: "",
  15389. detailCode: "120201",
  15390. description: "操作报警信息失败",
  15391. solution: "",
  15392. updateTime: 1522034840000
  15393. },
  15394. {
  15395. moduleCode: "",
  15396. detailCode: "361024",
  15397. description: "对讲服务端解析信令消息失败",
  15398. solution: "",
  15399. updateTime: 1522034840000
  15400. },
  15401. {
  15402. moduleCode: "",
  15403. detailCode: "320014",
  15404. description: "sdk未初始化",
  15405. solution: "",
  15406. updateTime: 1522034840000
  15407. },
  15408. {
  15409. moduleCode: "",
  15410. detailCode: "120202",
  15411. description: "操作留言信息失败",
  15412. solution: "",
  15413. updateTime: 1522034840000
  15414. },
  15415. {
  15416. moduleCode: "",
  15417. detailCode: "390001",
  15418. description: "通用错误返回",
  15419. solution: "",
  15420. updateTime: 1522034840000
  15421. },
  15422. {
  15423. moduleCode: "",
  15424. detailCode: "320015",
  15425. description: "超时",
  15426. solution: "",
  15427. updateTime: 1522034840000
  15428. },
  15429. {
  15430. moduleCode: "",
  15431. detailCode: "120301",
  15432. description: "根据UUID查询报警消息不存在",
  15433. solution: "",
  15434. updateTime: 1522034840000
  15435. },
  15436. {
  15437. moduleCode: "",
  15438. detailCode: "390002",
  15439. description: "入参为空指针",
  15440. solution: "",
  15441. updateTime: 1522034840000
  15442. },
  15443. {
  15444. moduleCode: "",
  15445. detailCode: "320016",
  15446. description: "正在打洞中",
  15447. solution: "",
  15448. updateTime: 1522034840000
  15449. },
  15450. {
  15451. moduleCode: "",
  15452. detailCode: "120302",
  15453. description: "根据UUID查询图片不存在",
  15454. solution: "",
  15455. updateTime: 1522034840000
  15456. },
  15457. {
  15458. moduleCode: "",
  15459. detailCode: "390003",
  15460. description: "入参值无效",
  15461. solution: "",
  15462. updateTime: 1522034840000
  15463. },
  15464. {
  15465. moduleCode: "",
  15466. detailCode: "320017",
  15467. description: "没有视频文件头(播放器层面产生和处理此错误)",
  15468. solution: "",
  15469. updateTime: 1522034840000
  15470. },
  15471. {
  15472. moduleCode: "",
  15473. detailCode: "120303",
  15474. description: "根据FID查询图片不存在",
  15475. solution: "",
  15476. updateTime: 1522034840000
  15477. },
  15478. {
  15479. moduleCode: "",
  15480. detailCode: "390004",
  15481. description: "信令消息解析非法",
  15482. solution: "",
  15483. updateTime: 1522034840000
  15484. },
  15485. {
  15486. moduleCode: "",
  15487. detailCode: "320018",
  15488. description: "解码错误/超时(播放器层面产生和处理此错误)",
  15489. solution: "",
  15490. updateTime: 1522034840000
  15491. },
  15492. {
  15493. moduleCode: "",
  15494. detailCode: "120305",
  15495. description: "设备ip解析错误",
  15496. solution: "",
  15497. updateTime: 1522034840000
  15498. },
  15499. {
  15500. moduleCode: "",
  15501. detailCode: "390005",
  15502. description: "内存资源不足",
  15503. solution: "",
  15504. updateTime: 1522034840000
  15505. },
  15506. {
  15507. moduleCode: "",
  15508. detailCode: "320019",
  15509. description: "取消(保留,用户不用处理)",
  15510. solution: "",
  15511. updateTime: 1522034840000
  15512. },
  15513. {
  15514. moduleCode: "",
  15515. detailCode: "120401",
  15516. description: "用户云空间信息不存在",
  15517. solution: "",
  15518. updateTime: 1522034840000
  15519. },
  15520. {
  15521. moduleCode: "",
  15522. detailCode: "390006",
  15523. description: "协议格式不对或者消息体长度超过STREAM_MAX_MSGBODY_LEN",
  15524. solution: "",
  15525. updateTime: 1522034840000
  15526. },
  15527. {
  15528. moduleCode: "",
  15529. detailCode: "320020",
  15530. description: "播放过程中预连接被用户清除预操作信息",
  15531. solution: "",
  15532. updateTime: 1522034840000
  15533. },
  15534. {
  15535. moduleCode: "",
  15536. detailCode: "120402",
  15537. description: "云空间操作失败",
  15538. solution: "",
  15539. updateTime: 1522034840000
  15540. },
  15541. {
  15542. moduleCode: "",
  15543. detailCode: "390007",
  15544. description: "设备序列号长度不合法",
  15545. solution: "",
  15546. updateTime: 1522034840000
  15547. },
  15548. {
  15549. moduleCode: "",
  15550. detailCode: "320021",
  15551. description: "流加密码不对",
  15552. solution: "",
  15553. updateTime: 1522034840000
  15554. },
  15555. {
  15556. moduleCode: "",
  15557. detailCode: "120403",
  15558. description: "用户目录不存在",
  15559. solution: "",
  15560. updateTime: 1522034840000
  15561. },
  15562. {
  15563. moduleCode: "",
  15564. detailCode: "390008",
  15565. description: "取流url长度不合法",
  15566. solution: "",
  15567. updateTime: 1522034840000
  15568. },
  15569. {
  15570. moduleCode: "",
  15571. detailCode: "320022",
  15572. description: "未传入播放窗口",
  15573. solution: "",
  15574. updateTime: 1522034840000
  15575. },
  15576. {
  15577. moduleCode: "",
  15578. detailCode: "120404",
  15579. description: "要操作的目标目录不存在",
  15580. solution: "",
  15581. updateTime: 1522034840000
  15582. },
  15583. {
  15584. moduleCode: "",
  15585. detailCode: "390009",
  15586. description: "解析vtm返回vtdu地址不合法",
  15587. solution: "",
  15588. updateTime: 1522034840000
  15589. },
  15590. {
  15591. moduleCode: "",
  15592. detailCode: "100200",
  15593. description: "操作成功",
  15594. solution: "",
  15595. updateTime: 1522034840000
  15596. },
  15597. {
  15598. moduleCode: "",
  15599. detailCode: "120405",
  15600. description: "要删除的文件信息不存在",
  15601. solution: "",
  15602. updateTime: 1522034840000
  15603. },
  15604. {
  15605. moduleCode: "",
  15606. detailCode: "390010",
  15607. description: "解析vtm返回级联vtdu地址不合法",
  15608. solution: "",
  15609. updateTime: 1522034840000
  15610. },
  15611. {
  15612. moduleCode: "",
  15613. detailCode: "101001",
  15614. description: "用户名不合法",
  15615. solution: "",
  15616. updateTime: 1522034840000
  15617. },
  15618. {
  15619. moduleCode: "",
  15620. detailCode: "120406",
  15621. description: "已开通云存储",
  15622. solution: "",
  15623. updateTime: 1522034840000
  15624. },
  15625. {
  15626. moduleCode: "",
  15627. detailCode: "390011",
  15628. description: "解析vtm返回会话标识长度不合法",
  15629. solution: "",
  15630. updateTime: 1522034840000
  15631. },
  15632. {
  15633. moduleCode: "",
  15634. detailCode: "101002",
  15635. description: "用户名已被占用",
  15636. solution: "",
  15637. updateTime: 1522034840000
  15638. },
  15639. {
  15640. moduleCode: "",
  15641. detailCode: "120407",
  15642. description: "开通记录失败",
  15643. solution: "",
  15644. updateTime: 1522034840000
  15645. },
  15646. {
  15647. moduleCode: "",
  15648. detailCode: "390012",
  15649. description: "vtdu返回流头长度不合法",
  15650. solution: "",
  15651. updateTime: 1522034840000
  15652. },
  15653. {
  15654. moduleCode: "",
  15655. detailCode: "101003",
  15656. description: "密码不合法",
  15657. solution: "",
  15658. updateTime: 1522034840000
  15659. },
  15660. {
  15661. moduleCode: "",
  15662. detailCode: "120500",
  15663. description: "获取数据错误",
  15664. solution: "",
  15665. updateTime: 1522034840000
  15666. },
  15667. {
  15668. moduleCode: "",
  15669. detailCode: "390013",
  15670. description: "vtdu会话长度非法",
  15671. solution: "",
  15672. updateTime: 1522034840000
  15673. },
  15674. {
  15675. moduleCode: "",
  15676. detailCode: "101004",
  15677. description: "密码为同一字符",
  15678. solution: "",
  15679. updateTime: 1522034840000
  15680. },
  15681. {
  15682. moduleCode: "",
  15683. detailCode: "120501",
  15684. description: "开锁失败",
  15685. solution: "",
  15686. updateTime: 1522034840000
  15687. },
  15688. {
  15689. moduleCode: "",
  15690. detailCode: "390014",
  15691. description: "回调函数未注册",
  15692. solution: "",
  15693. updateTime: 1522034840000
  15694. },
  15695. {
  15696. moduleCode: "",
  15697. detailCode: "101006",
  15698. description: "手机号码已经被注册",
  15699. solution: "",
  15700. updateTime: 1522034840000
  15701. },
  15702. {
  15703. moduleCode: "",
  15704. detailCode: "120502",
  15705. description: "室内机未收到呼叫",
  15706. solution: "",
  15707. updateTime: 1522034840000
  15708. },
  15709. {
  15710. moduleCode: "",
  15711. detailCode: "390015",
  15712. description: "vtdu成功响应未携带会话标识",
  15713. solution: "",
  15714. updateTime: 1522034840000
  15715. }
  15716. ];
  15717. var code = "200";
  15718. var msg$1 = "操作成功!";
  15719. var errorCode = {
  15720. data: data$8,
  15721. code: code,
  15722. msg: msg$1
  15723. };
  15724. var Code = /*#__PURE__*/function () {
  15725. function Code(x, y) {
  15726. _classCallCheck$1(this, Code);
  15727. this.coreX = x;
  15728. this.coreY = y;
  15729. console.log("ErrorCode", errorCode);
  15730. }
  15731. _createClass$1(Code, [{
  15732. key: "toString",
  15733. value: function toString() {
  15734. return "".concat(this.coreX, "-").concat(this.coreY);
  15735. }
  15736. }, {
  15737. key: "matchErrorInfo",
  15738. value: function matchErrorInfo(code) {
  15739. return errorCode.data.find(function (item) {
  15740. return item.detailCode.substr(-4) == code;
  15741. });
  15742. }
  15743. }]);
  15744. return Code;
  15745. }();
  15746. var header = {
  15747. color: "red",
  15748. backgroundColor: "red",
  15749. activeColor: "red",
  15750. btnList: [
  15751. {
  15752. btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-0",
  15753. iconId: "deviceID",
  15754. part: "left",
  15755. defaultActive: 1,
  15756. isrender: 1,
  15757. themeId: "934f270c08b14e928bf0c2ae8e1a937d"
  15758. },
  15759. {
  15760. btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-1",
  15761. iconId: "deviceName",
  15762. part: "left",
  15763. defaultActive: 1,
  15764. isrender: 1,
  15765. themeId: "934f270c08b14e928bf0c2ae8e1a937d"
  15766. }
  15767. ]
  15768. };
  15769. var footer = {
  15770. color: "blue",
  15771. backgroundColor: "blue",
  15772. activeColor: "blue",
  15773. btnList: [
  15774. {
  15775. btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-footer-0",
  15776. iconId: "play",
  15777. part: "left",
  15778. defaultActive: 0,
  15779. isrender: 0,
  15780. themeId: "934f270c08b14e928bf0c2ae8e1a937d"
  15781. }
  15782. ]
  15783. };
  15784. var defaultTheme = {
  15785. header: header,
  15786. footer: footer
  15787. };
  15788. // 通用请求方法
  15789. var TimeLine$1 = function TimeLine(jsPlugin) {
  15790. this.jsPlugin = jsPlugin;
  15791. var status = {
  15792. isMouseDown: false,
  15793. // 鼠标是否按下
  15794. isOver: false,
  15795. // 鼠标是否悬浮在进度条上
  15796. mousePosition: null,
  15797. oldTime: null,
  15798. nowTime: null,
  15799. moved: null,
  15800. hoverTime: '2018-12-07 12:00:00',
  15801. hoverLeft: 0,
  15802. timeTipShow: false,
  15803. randomNum: 123,
  15804. timeWidthTbls: [60, 1800, 3600, 86400],
  15805. // 时间宽度单位(秒)
  15806. timeUnits: ['范围: 1分钟; 单位: 秒', '范围: 30分钟; 单位: 分钟', '范围: 1小时; 单位: 分钟', '范围: 1天; 单位: 小时', '范围: 3天; 单位: 小时'],
  15807. // 时间单位
  15808. drawPen: null,
  15809. timeSection: [],
  15810. canvasWidth: null,
  15811. canvasHeight: null,
  15812. timeTips: null
  15813. };
  15814. // Object.keys(status).forEach(element => {
  15815. // this[element] = status[element];
  15816. // });
  15817. var _this = this;
  15818. Object.keys(status).forEach(function (element) {
  15819. _this[element] = status[element];
  15820. });
  15821. this.options = {
  15822. width: this.canvasWidth,
  15823. height: 48,
  15824. time: new Date().getTime(),
  15825. //new Date("2019-10-31 00:00:00"),//
  15826. timeSection: [],
  15827. timeWidth: 0 // 0-3
  15828. };
  15829. TimeLine.prototype.subTime = function (time) {
  15830. if (time < 10) {
  15831. return '0' + time;
  15832. } else {
  15833. return time;
  15834. }
  15835. };
  15836. TimeLine.prototype.tranTime = function (time) {
  15837. var stringTime = time;
  15838. if (time) {
  15839. var newDate = new Date(time);
  15840. stringTime = newDate.getFullYear() + '/' + (newDate.getMonth() + 1) + '/' + newDate.getDate() + ' ' + this.subTime(newDate.getHours()) + ':' + this.subTime(newDate.getMinutes()) + ':' + this.subTime(newDate.getSeconds());
  15841. }
  15842. return stringTime;
  15843. };
  15844. TimeLine.prototype.init = function (params) {
  15845. // document.getElementsByTagName("html")[0].addEventListener("mouseup", this.mouseUpFn(e,params.));
  15846. if (params.width) {
  15847. document.getElementById(params.id).setAttribute("width", parseInt(params.width, 10) + 'px');
  15848. }
  15849. var that = this;
  15850. var opts = this.options;
  15851. that.randomNum = (Math.random() + '').split('.').join('');
  15852. that.timeWidthTblIndex = opts.timeWidth; // 当前使用时间宽度索引
  15853. // 12-10
  15854. //that.drawPanal = this.$refs.drawPanal;
  15855. var canvas = document.querySelector("#".concat(this.jsPlugin.id, "-canvas"));
  15856. that.drawPen = canvas.getContext('2d');
  15857. that.nowTime = opts.time || Date.now(); // 当前时间点
  15858. that.timeSection = opts.timeSection || []; // 时间段记录区间
  15859. that.canvasWidth = canvas.offsetWidth;
  15860. that.canvasHeight = canvas.offsetHeight;
  15861. that.updata(); // 展示进度条
  15862. // 事件监听
  15863. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mousemove', function (e) {
  15864. if (that.options.readOnly) {
  15865. return;
  15866. }
  15867. that.mousemove(e);
  15868. });
  15869. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseover', function (e) {
  15870. if (that.options.readOnly) {
  15871. return;
  15872. }
  15873. that.mouseover(e);
  15874. });
  15875. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseleave', function (e) {
  15876. if (that.options.readOnly) {
  15877. return;
  15878. }
  15879. that.mouseleave(e);
  15880. });
  15881. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mousedown', function (e) {
  15882. if (that.options.readOnly) {
  15883. return;
  15884. }
  15885. that.mousedown(e);
  15886. });
  15887. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseup', function (e) {
  15888. if (that.options.readOnly) {
  15889. return;
  15890. }
  15891. //debugger
  15892. var callback = params.onChange;
  15893. that.mouseUpFn(e, callback);
  15894. });
  15895. };
  15896. TimeLine.prototype.setWidth = function (params) {
  15897. var _this2 = this;
  15898. var that = this;
  15899. if (params.width) {
  15900. document.getElementById(this.jsPlugin.id).style.width = params.width;
  15901. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.width = params.width;
  15902. document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.width = params.width;
  15903. that.canvasWidth = params.width;
  15904. setTimeout(function () {
  15905. _this2.updata({
  15906. time: new Date()
  15907. });
  15908. }, 500);
  15909. }
  15910. };
  15911. TimeLine.prototype.mousemove = function (e) {
  15912. // console.log("鼠标移动",e)
  15913. if (this.isMouseDown && this.isOver) {
  15914. var mouseOffset = this.mousePosition - e.pageX;
  15915. // fix点击引起mousemove的问题
  15916. if (mouseOffset === 0) {
  15917. return;
  15918. }
  15919. var timeOffsetUnit = 0;
  15920. switch (this.timeWidth) {
  15921. case 60:
  15922. timeOffsetUnit = 1 / 10;
  15923. break;
  15924. case 1800:
  15925. timeOffsetUnit = 1 / 20 * 60;
  15926. break;
  15927. case 3600:
  15928. timeOffsetUnit = 1 / 20 * 60;
  15929. break;
  15930. case 86400:
  15931. //timeOffset =
  15932. timeOffsetUnit = 1 / 30 * 60 * 60;
  15933. break;
  15934. }
  15935. var currentTime = new Date(this.oldTime).getTime() + mouseOffset * timeOffsetUnit * 1000;
  15936. //console.log("rurrentTime",this.oldTime,mouseOffset,currentTime,new Date(currentTime))
  15937. //console.log("currentTime", new Date(currentTime))
  15938. // var currentTime =
  15939. // this.oldTime +
  15940. // (mouseOffset / this.canvasWidth) *
  15941. // this.timeWidth *
  15942. // 1000;
  15943. // console.log("currentTime",new Date(this.oldTime), new Date(currentTime))
  15944. this.updata({
  15945. time: currentTime
  15946. });
  15947. this.moved = true;
  15948. } else {
  15949. // 12-10
  15950. //var { left, top } = this.$utils.getOffset(this.$refs.drawPanal);
  15951. var left = parseInt(document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).offsetLeft, 10);
  15952. //12 -10
  15953. this.mousePosition = e.pageX - left;
  15954. this.updata(); // 更新画面
  15955. }
  15956. };
  15957. TimeLine.prototype.mousedown = function (e) {
  15958. this.isMouseDown = true;
  15959. this.mousePosition = e.pageX;
  15960. this.oldTime = this.nowTime;
  15961. // this.$emit('drag', true);
  15962. };
  15963. TimeLine.prototype.mouseover = function (e) {
  15964. this.isOver = true;
  15965. };
  15966. TimeLine.prototype.mouseleave = function (e) {
  15967. this.isOver = false;
  15968. this.isMouseDown = false;
  15969. this.updata();
  15970. };
  15971. TimeLine.prototype.changeSize = function (timeWidth) {
  15972. console.log("changeSize", timeWidth);
  15973. // if (w) {
  15974. // this.options.width = w;
  15975. // this.canvasWidth = w;
  15976. // }
  15977. // if (h) {
  15978. // this.options.height = h;
  15979. // this.canvasHeight = h;
  15980. // }
  15981. // console.log("tehis.optiosn",this.options)
  15982. this.options.timeWidth = timeWidth;
  15983. this.updata({
  15984. timeWidth: timeWidth
  15985. });
  15986. // this.$nextTick(() => {
  15987. // this.updata();
  15988. // });
  15989. };
  15990. TimeLine.prototype.mouseUpFn = function (e, callback) {
  15991. if (this.isMouseDown) {
  15992. this.isMouseDown = false;
  15993. if (this.moved) {
  15994. this.moved = false;
  15995. // 限制拖动只更改时分秒
  15996. var newStringTime =
  15997. // new Date(this.nowTime).getFullYear() +
  15998. // '/' +
  15999. // ( new Date(this.nowTime).getMonth() + 1) +
  16000. // '/' +
  16001. // new Date(this.nowTime).getDate() +
  16002. // ' ' +
  16003. this.subTime(new Date(this.nowTime).getHours()) + ':' + this.subTime(new Date(this.nowTime).getMinutes()) + ':' + this.subTime(new Date(this.nowTime).getSeconds());
  16004. var oldStringTime = new Date(this.oldTime).getFullYear() + '/' + (new Date(this.oldTime).getMonth() + 1) + '/' + new Date(this.oldTime).getDate();
  16005. // ' ' +
  16006. // this.subTime(new Date(this.oldTime).getHours()) +
  16007. // ':' +
  16008. // this.subTime( new Date(this.oldTime).getMinutes()) +
  16009. // ':' +
  16010. // this.subTime( new Date(this.oldTime).getSeconds());
  16011. // this.nowTime = new Date(`${oldStringTime.substring(0,11) + newStringTime.substring(11,19)}`).getTime();
  16012. this.nowTime = new Date("".concat(oldStringTime, " ").concat(newStringTime));
  16013. this.updata({
  16014. time: this.nowTime
  16015. });
  16016. this.oldTime = this.nowTime;
  16017. console.log("nowTime", new Date(this.nowTime), "".concat(oldStringTime, " ").concat(newStringTime));
  16018. // 限制只能拖动当天;
  16019. callback(this.nowTime);
  16020. }
  16021. }
  16022. };
  16023. TimeLine.prototype.readOnly = function (data) {
  16024. console.log("更改为只读");
  16025. this.options.readOnly = true;
  16026. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.cursor = "not-allowed";
  16027. };
  16028. TimeLine.prototype.unReadOnly = function (data) {
  16029. console.log("更改为只读");
  16030. this.options.readOnly = false;
  16031. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.cursor = "pointer";
  16032. };
  16033. TimeLine.prototype.run = function (data) {
  16034. if (!this.isMouseDown) {
  16035. this.updata(data);
  16036. }
  16037. };
  16038. TimeLine.prototype.getTime = function (data) {
  16039. console.log("this", this);
  16040. console.log("当前时间", new Date(this.nowTime));
  16041. };
  16042. TimeLine.prototype.updata = function (data) {
  16043. var that = this;
  16044. data = data || {};
  16045. that.nowTime = data.time || that.nowTime;
  16046. that.timeSection = data.timeSection || that.timeSection;
  16047. that.timeWidthTblIndex = data.timeWidth || that.timeWidthTblIndex;
  16048. that.timeWidth = that.timeWidthTbls[data.timeWidth || that.timeWidthTblIndex];
  16049. that.timeUnit = that.timeUnits[data.timeWidth || that.timeWidthTblIndex];
  16050. if (data.timeWidth === 0) {
  16051. that.timeWidthTblIndex = 0;
  16052. that.timeWidth = that.timeWidthTbls[0];
  16053. that.timeUnit = that.timeUnits[0];
  16054. }
  16055. that.drawPen.fillStyle = '#000000';
  16056. that.drawPen.fillRect(0, 0, that.canvasWidth, that.canvasHeight);
  16057. that.drawScale(); // 画刻度
  16058. that.drawRecord(); // 画录像区间
  16059. that.drawOtherMsg(); // 画录像的其他信息
  16060. // 12-10
  16061. //that.$emit('update-time', that.nowTime);
  16062. document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.width = that.options.width + 'px';
  16063. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.width = that.options.width + 'px';
  16064. document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.height = that.options.height + 'px';
  16065. document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.height = that.options.height + 'px';
  16066. };
  16067. TimeLine.prototype.drawSolidLine = function (startX, startY, endX, endY, lineWidth, color) {
  16068. this.drawPen.save();
  16069. this.drawPen.strokeStyle = color;
  16070. this.drawPen.lineWidth = lineWidth;
  16071. this.drawPen.beginPath();
  16072. this.drawPen.moveTo(startX, startY);
  16073. this.drawPen.lineTo(endX, endY);
  16074. this.drawPen.stroke();
  16075. this.drawPen.restore();
  16076. };
  16077. TimeLine.prototype.drawString = function (text, x, y, aling, color) {
  16078. this.drawPen.font = '12px serif';
  16079. this.drawPen.fillStyle = '#ffffff';
  16080. this.drawPen.textAlign = aling || 'left';
  16081. this.drawPen.fillText(text, x, y + 10);
  16082. };
  16083. TimeLine.prototype.drawScale = function () {
  16084. // console.log("drawScale",new Date(this.nowTime))
  16085. var that = this;
  16086. var lineColor = 'rgba(255,255,255)';
  16087. //that.nowTime = new Date("2019-12-31 01:50:00")
  16088. var startDate = new Date(that.nowTime); // 开始时间
  16089. var startYears = startDate.getFullYear(); // 起始的秒数
  16090. var starSecond = startDate.getSeconds(); // 起始的秒数
  16091. var starMin = startDate.getMinutes(); // 起始的分钟数
  16092. var startHours = startDate.getHours(); // 起始的小时
  16093. var startDay = startDate.getDate(); // 起始的日期
  16094. // debugger;
  16095. var curScale = 0; // 计算时间点
  16096. switch (that.timeWidth) {
  16097. case 60:
  16098. {
  16099. // debugger
  16100. var dotNum = parseInt(that.canvasWidth / 10); // 每10像素一个点
  16101. startDate.setSeconds(startDate.getSeconds() - parseInt(dotNum / 2, 10)); // 从现在时间的一半开始画起
  16102. startDay = startDate.getDate();
  16103. startHours = startDate.getHours();
  16104. starMin = startDate.getMinutes();
  16105. starSecond = startDate.getSeconds();
  16106. // console.log("domNum",dotNum);
  16107. // console.log("starSecond",starSecond)
  16108. for (var i = 0; i < dotNum; i++) {
  16109. curScale = starSecond + i;
  16110. startDate.setSeconds(curScale);
  16111. // debugger;
  16112. //debugger;
  16113. // console.log("startDate",startDate,curScale)
  16114. // 每一个整10秒画一次线和文字
  16115. if (curScale % 10 === 0) {
  16116. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 + 8, 1, lineColor);
  16117. var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes()) + ':' + this.subTime(startDate.getSeconds());
  16118. that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
  16119. // console.log("timeString",timeString)
  16120. } else {
  16121. // console.log("画短线",(i * that.canvasWidth) / 60,0,(i * that.canvasWidth) / 60,(that.canvasHeight / 5) * 0.5,1)
  16122. // 只画一次线
  16123. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
  16124. }
  16125. /**
  16126. * 偏移距离超过60,setSeconds会每次累加1到分钟,因此绘图完成后需要复原到当前分钟,再次计算偏移
  16127. */
  16128. startDate.setDate(startDay);
  16129. startDate.setHours(startHours);
  16130. startDate.setMinutes(starMin);
  16131. }
  16132. break;
  16133. }
  16134. case 1800:
  16135. {
  16136. // 30分钟
  16137. var dotNum = parseInt(that.canvasWidth / 20); // 每10像素一个点
  16138. startDate.setMinutes(startDate.getMinutes() - parseInt(dotNum / 2, 10));
  16139. // starSecond = startDate.getSeconds();
  16140. startHours = startDate.getHours();
  16141. starMin = startDate.getMinutes();
  16142. //console.log("dotNum",dotNum,starMin)
  16143. for (var i = 0; i <= dotNum; i++) {
  16144. curScale = starMin + i;
  16145. startDate.setMinutes(curScale);
  16146. if (curScale % 5 === 0) {
  16147. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 1.5 + 8, 1, lineColor);
  16148. var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes());
  16149. that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
  16150. } else {
  16151. // console.log("画短线",((i - starMin) * that.canvasWidth) / dotNum)
  16152. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
  16153. }
  16154. startDate.setHours(startHours);
  16155. }
  16156. break;
  16157. }
  16158. case 3600:
  16159. {
  16160. // 60分钟
  16161. var dotNum = parseInt(that.canvasWidth / 20); // 每10像素一个点
  16162. startDate.setMinutes(startDate.getMinutes() - parseInt(dotNum / 2, 10));
  16163. startHours = startDate.getHours();
  16164. starMin = startDate.getMinutes();
  16165. for (var i = 0; i <= dotNum; i++) {
  16166. curScale = starMin + i;
  16167. // if (curScale > 60) {
  16168. // curScale = curScale - 60;
  16169. // }
  16170. startDate.setMinutes(curScale);
  16171. if (curScale % 10 === 0) {
  16172. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 1.5 + 8, 1, lineColor);
  16173. var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes());
  16174. that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
  16175. } else {
  16176. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
  16177. }
  16178. startDate.setHours(startHours);
  16179. }
  16180. break;
  16181. }
  16182. case 86400:
  16183. {
  16184. var dotNum = parseInt(that.canvasWidth / 30); // 每10像素一个点
  16185. // 1天,24小时
  16186. //console.log("dotNum",dotNum);
  16187. //startDate.setDate(startDay - parseInt(dotNum / 2,10));
  16188. startDate.setHours(startDate.getHours() - parseInt(dotNum / 2, 10));
  16189. // console.log("startDat111e",startDate);
  16190. // debugger;
  16191. starSecond = startDate.getSeconds();
  16192. starMin = startDate.getMinutes();
  16193. startHours = startDate.getHours();
  16194. startDay = startDate.getDate();
  16195. startYears = startDate.getFullYear();
  16196. for (var i = 0; i <= dotNum; i++) {
  16197. curScale = startHours + i;
  16198. // if (curScale >= 24) {
  16199. // curScale = curScale - 24;
  16200. // }
  16201. startDate.setHours(curScale);
  16202. var timeString;
  16203. // 不等于24的时候,画短线
  16204. //console.log("curScale",curScale)
  16205. //if (curScale % 24 !=0) {
  16206. // console.log("curScale",curScale)
  16207. timeString = this.subTime(startDate.getHours()) + ":00";
  16208. // timeString = startDate.toLocaleDateString();
  16209. // debugger
  16210. that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
  16211. // } else {
  16212. // // debugger;
  16213. // // console.log("画图")
  16214. // // 不等于24的时候,画长线
  16215. // timeString = startDate.toLocaleDateString();
  16216. // // console.log("startDatestartDate",startDate,i)
  16217. // // debugger;
  16218. // that.drawSolidLine(
  16219. // ((i ) * that.canvasWidth) /
  16220. // dotNum,
  16221. // 8,
  16222. // ((i) * that.canvasWidth) /
  16223. // dotNum,
  16224. // (that.canvasHeight / 5) * 1 + 8,
  16225. // 1,
  16226. // lineColor
  16227. // );
  16228. // }
  16229. // 每2个小时一个时间文字
  16230. if (curScale % 2 === 0) {
  16231. that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2, 'center', 'rgba(255,255,255,0.3)');
  16232. }
  16233. startDate.setFullYear(startYears);
  16234. startDate.setDate(startDay);
  16235. startDate.setHours(startHours);
  16236. }
  16237. break;
  16238. }
  16239. }
  16240. };
  16241. TimeLine.prototype.getRecord = function (timeArr, startTime, endTime) {
  16242. this.timeSection = timeArr;
  16243. this.drawRecord();
  16244. };
  16245. TimeLine.prototype.drawRecord = function () {
  16246. var timeArr = this.timeSection || [];
  16247. var that = this;
  16248. var drawPen = that.drawPen;
  16249. // var startDate = new Date(that.nowTime);
  16250. // var timeScale = that.canvasWidth / that.timeWidth;
  16251. // 根据时间查找当前位置
  16252. for (var i = 0; i < timeArr.length; i++) {
  16253. //console.log("timeArr[i]",timeArr[i],findPosition(timeArr[i].startTime),findPosition(timeArr[i].endTime))
  16254. var startPosition = findPosition(timeArr[i].startTime);
  16255. var endPosition = findPosition(timeArr[i].endTime);
  16256. drawPen.fillStyle = '#1890ff80';
  16257. drawPen.fillRect(startPosition, 0, endPosition - startPosition, 48);
  16258. }
  16259. function findPosition(time) {
  16260. var scale = 10;
  16261. switch (that.timeWidth) {
  16262. case 60:
  16263. scale = 10;
  16264. break;
  16265. case 1800:
  16266. scale = 20 / 60;
  16267. break;
  16268. case 3600:
  16269. scale = 20 / 60;
  16270. break;
  16271. case 86400:
  16272. scale = 20 / 60 / 60;
  16273. break;
  16274. }
  16275. var nowTimePostion = that.canvasWidth / 2; //总宽度一半
  16276. var position = nowTimePostion + (time - that.nowTime) / 1000 * scale;
  16277. if (position > that.canvasWidth) {
  16278. position = that.canvasWidth;
  16279. }
  16280. if (position <= 0) {
  16281. position = 0;
  16282. }
  16283. return position;
  16284. }
  16285. };
  16286. TimeLine.prototype.drawOtherMsg = function () {
  16287. // 画中心线
  16288. this.drawSolidLine(this.canvasWidth / 2, 0, this.canvasWidth / 2, this.canvasHeight, 2, '#1890FF');
  16289. this.drawPen.shadowBlur = 0;
  16290. if (this.isOver && !this.isMouseDown) {
  16291. this.mouseTime = this.mousePosition / this.canvasWidth * this.timeWidth * 1000 + this.nowTime - this.timeWidth / 2 * 1000; // 鼠标的悬浮点对应的时间
  16292. this.mouseString = this.tranTime(this.mouseTime); // 鼠标悬浮点显示的文字
  16293. this.hoverTime = this.mouseString;
  16294. this.hoverLeft = this.mousePosition - 60;
  16295. this.timeTipShow = true;
  16296. } else {
  16297. this.timeTipShow = false;
  16298. }
  16299. };
  16300. };
  16301. var Rec = /*#__PURE__*/function () {
  16302. function Rec(jSPlugin) {
  16303. _classCallCheck$1(this, Rec);
  16304. this.jSPlugin = jSPlugin;
  16305. if (!document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
  16306. return false;
  16307. }
  16308. this.currentTimeWidth = 0; //回放时间轴尺度 0~3
  16309. this.date = new Date();
  16310. this.datepickerVisible = false;
  16311. this.seekTimer = null;
  16312. this.disabled = false;
  16313. this.seekFrequency = 2000;
  16314. if (this.jSPlugin.params && this.jSPlugin.params.seekFrequency) {
  16315. this.seekFrequency = this.jSPlugin.params.seekFrequency;
  16316. }
  16317. this.recInit();
  16318. }
  16319. _createClass$1(Rec, [{
  16320. key: "recInit",
  16321. value: function recInit() {
  16322. var _this = this;
  16323. // 重置时间轴尺度
  16324. this.currentTimeWidth = 0;
  16325. var canvasItemWidth = parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width, 10) - 100;
  16326. var canvasContainer = document.createElement('div');
  16327. canvasContainer.style = "display:inline-block;height:48px;";
  16328. canvasContainer.id = this.jSPlugin.id + "-canvas-container";
  16329. var canvasItem = document.createElement('canvas');
  16330. canvasItem.id = this.jSPlugin.id + "-canvas";
  16331. canvasItem.className = "time-line-body";
  16332. canvasItem.height = "48";
  16333. canvasItem.width = canvasItemWidth;
  16334. canvasItem.style = "display:inline-block;";
  16335. canvasItem.innerHTML = "该浏览器不支持canvas";
  16336. canvasContainer.appendChild(canvasItem);
  16337. insertAfter$1(canvasContainer, document.getElementById("".concat(this.jSPlugin.id, "-audioControls")));
  16338. var timeLineControlsContainer = document.createElement('div');
  16339. timeLineControlsContainer.className = "timeline-controls";
  16340. timeLineControlsContainer.style = "display:flex;width:100px;height:48px;text-align:center;line-height: 48px;vertical-align: top;background: #000000;";
  16341. var timeLineControls = "\n<div class=\"timeline-controls-scale\" style=\"display: inline-flex;flex-direction: column;justify-content: center;vertical-align: top;padding: 0 20px;\">\n <span style=\"vertical-Align: middle;line-height: 14px;height: 18px; width: 18px;cursor:pointer;\" id=\"".concat(this.jSPlugin.id, "-timeline-scale-add\">\n <svg fill=\"#2C2C2C\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\"\n viewBox=\"0 0 20 20\">\n <title>add</title>\n <g>\n <polygon points=\"0.1,0.5 15,0.5 15,15.4 0.1,15.4 \t\" />\n </g>\n <g>\n <path\n fill=\"#FFFFFF\";\n d=\"M7.6,12.4c-0.3,0-0.5-0.2-0.5-0.5v-8c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v8C8.1,12.2,7.9,12.4,7.6,12.4z\" />\n </g>\n <g>\n <path\n fill=\"#FFFFFF\";\n d=\"M11.6,8.4h-8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h8c0.3,0,0.5,0.2,0.5,0.5S11.8,8.4,11.6,8.4z\" />\n </g>\n </svg>\n </span>\n <span style=\"vertical-Align: middle;line-height: 14px;height: 18px; width: 18px;cursor:pointer;\" id=\"").concat(this.jSPlugin.id, "-timeline-scale-sub\">\n <svg fill=\"#2C2C2C\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\"\n viewBox=\"0 0 20 20\">\n <title>reduce</title>\n <g>\n <polygon class=\"st0\" points=\"1,0.8 15.2,0.8 15.2,15 1,15 \t\" />\n </g>\n <g>\n <path class=\"st1\"\n fill=\"#FFFFFF\";\n d=\"M12.1,8.4h-8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h8c0.3,0,0.5,0.2,0.5,0.5S12.4,8.4,12.1,8.4z\" />\n </g>\n </svg>\n </span>\n</div>\n<label for=\"").concat(this.jSPlugin.id, "-datepicker\">\n <div class=\"timeline-controls-date\">\n <span>\n <svg fill=\"#2C2C2C\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\"\n viewBox=\"0 0 20 20\">\n <title>ifttt</title>\n <g id=\"Rectangle\">\n <rect x=\"0.6\" y=\"0.9\" class=\"st0\" width=\"20\" height=\"20\" />\n </g>\n <g id=\"Stroke-1\">\n <path fill=\"#FFFFFF\"; class=\"st1\"\n d=\"M14,7.2c-0.3,0-0.5-0.2-0.5-0.5V3.4c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v3.3C14.5,7,14.2,7.2,14,7.2z\" />\n </g>\n <g id=\"Stroke-3\">\n <path fill=\"#FFFFFF\"; class=\"st1\"\n d=\"M7.3,7.2C7,7.2,6.8,7,6.8,6.7V3.4c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v3.3C7.8,7,7.6,7.2,7.3,7.2z\" />\n </g>\n <g id=\"Stroke-5\">\n <path fill=\"#FFFFFF\"; class=\"st1\"\n d=\"M18.1,9.7h-15c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h15c0.3,0,0.5,0.2,0.5,0.5S18.4,9.7,18.1,9.7z\" />\n </g>\n <g id=\"Stroke-7\">\n <path fill=\"#FFFFFF\"; class=\"st1\" d=\"M16.5,19.7H4.8c-1.2,0-2.2-1-2.2-2.2V6.7c0-1.2,1-2.2,2.2-2.2h11.7c1.2,0,2.2,1,2.2,2.2v10.8\nC18.6,18.8,17.7,19.7,16.5,19.7z M4.8,5.6c-0.6,0-1.2,0.5-1.2,1.2v10.8c0,0.6,0.5,1.2,1.2,1.2h11.7c0.6,0,1.2-0.5,1.2-1.2V6.7\nc0-0.6-0.5-1.2-1.2-1.2H4.8z\" />\n </g>\n <g id=\"Stroke-9\">\n <path fill=\"#FFFFFF\"; class=\"st1\" d=\"M10.6,13.3c-0.4,0-0.7-0.3-0.7-0.7c0-0.2,0.1-0.4,0.2-0.5s0.3-0.2,0.5-0.2h0h0c0.4,0,0.7,0.3,0.7,0.7\nS11,13.3,10.6,13.3z\" />\n </g>\n <g id=\"Stroke-11\">\n <path fill=\"#FFFFFF\"; class=\"st1\" d=\"M14.8,13.3c-0.4,0-0.7-0.3-0.7-0.7c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2c0.4,0,0.7,0.3,0.7,0.7\nS15.2,13.3,14.8,13.3z M14.8,12.3c-0.2,0-0.3,0.1-0.3,0.3c0,0.2,0.3,0.4,0.5,0.2c0.1-0.1,0.1-0.1,0.1-0.2\nC15.1,12.4,15,12.3,14.8,12.3z\" />\n </g>\n <g id=\"Stroke-13\">\n <path fill=\"#FFFFFF\"; class=\"st1\" d=\"M6.5,16.6c-0.4,0-0.7-0.3-0.7-0.7c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2h0h0c0.4,0,0.7,0.3,0.7,0.7\nC7.2,16.3,6.9,16.6,6.5,16.6z\" />\n </g>\n <g id=\"Stroke-15\">\n <path fill=\"#FFFFFF\"; class=\"st1\" d=\"M10.6,16.6c-0.4,0-0.7-0.3-0.7-0.7c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2h0h0c0.4,0,0.7,0.3,0.7,0.7\nC11.4,16.3,11,16.6,10.6,16.6z\" />\n </g>\n </svg>\n </span>\n </div>\n</label>\n<input autocomplete=\"off\" data-toggle=\"").concat(this.jSPlugin.id, "-datepicker\" id=\"").concat(this.jSPlugin.id, "-datepicker\" name=\"").concat(this.jSPlugin.id, "-datepicker\" style=\"opacity:0;width:24px;margin-left:-24px;cursor:pointer;\" />\n");
  16342. timeLineControlsContainer.innerHTML = timeLineControls;
  16343. insertAfter$1(timeLineControlsContainer, canvasContainer);
  16344. this.timeLine = new TimeLine$1(this.jSPlugin);
  16345. this.timeLine.init({
  16346. id: this.jSPlugin.id + '-canvas',
  16347. width: canvasItemWidth,
  16348. onChange: function onChange(time) {
  16349. console.log("time", time, new Date(time).Format('yyyyMMddhhmmss'));
  16350. var newBegin = new Date(time).Format('yyyyMMddhhmmss');
  16351. console.log('----------------this.jSPlugin.url', _this.jSPlugin.url);
  16352. //云录制、支持seek功能的设备开启seek回放功能
  16353. if (matchEzopenUrl(_this.jSPlugin.url).type === 'cloud.rec' || _this.jSPlugin.capacity && _this.jSPlugin.capacity.support_seek_playback == '1') {
  16354. var cloudSeek = function cloudSeek() {
  16355. _this.jSPlugin.seek(newBegin.substr(8, 6), "235959");
  16356. _this.unSyncTimeLine();
  16357. setTimeout(function () {
  16358. _this.syncTimeLine();
  16359. }, 6000);
  16360. };
  16361. if (_this.seekTimer) {
  16362. clearTimeout(_this.seekTimer);
  16363. } else {
  16364. cloudSeek();
  16365. }
  16366. // 限制每2秒只触发一次拖动
  16367. _this.seekTimer = setTimeout(function () {
  16368. cloudSeek();
  16369. clearTimeout(_this.seekTimer);
  16370. _this.seekTimer = null;
  16371. }, _this.seekFrequency);
  16372. } else {
  16373. var callback = function callback() {
  16374. setTimeout(function () {
  16375. _this.disabled = false;
  16376. }, _this.seekFrequency);
  16377. };
  16378. var localRecSeek = function localRecSeek(callback) {
  16379. _this.disabled = true;
  16380. _this.jSPlugin.pause().then(function () {
  16381. console.log("暂停成功");
  16382. _this.jSPlugin.resume(newBegin).then(function (data) {
  16383. console.log("恢复成功:", data);
  16384. if (_this.jSPlugin.Theme) {
  16385. _this.jSPlugin.Theme.setDecoderState({
  16386. play: true
  16387. });
  16388. }
  16389. // 打开声音
  16390. if (_this.jSPlugin.Theme && _this.jSPlugin.Theme.decoderState.state.sound) {
  16391. _this.jSPlugin.openSound();
  16392. }
  16393. if (callback) {
  16394. callback();
  16395. }
  16396. })["catch"](function (err) {
  16397. console.log("恢复失败", err);
  16398. });
  16399. })["catch"](function () {
  16400. console.log("暂停失败");
  16401. _this.jSPlugin.resume(newBegin).then(function (data) {
  16402. console.log("恢复成功");
  16403. if (_this.jSPlugin.Theme) {
  16404. _this.jSPlugin.Theme.setDecoderState({
  16405. play: true
  16406. });
  16407. }
  16408. if (callback) {
  16409. callback();
  16410. }
  16411. })["catch"](function (err) {
  16412. console.log("恢复失败", err);
  16413. });
  16414. });
  16415. };
  16416. if (_this.disabled) {
  16417. console.log("操作频繁,等待2秒后执行");
  16418. // 限制每2秒只触发一次拖动
  16419. if (_this.seekTimer) {
  16420. clearTimeout(_this.seekTimer);
  16421. }
  16422. _this.seekTimer = setTimeout(function () {
  16423. localRecSeek(callback);
  16424. }, _this.seekFrequency);
  16425. } else {
  16426. localRecSeek(callback);
  16427. }
  16428. }
  16429. }
  16430. });
  16431. this.syncTimeLine();
  16432. // 加载日期选择器
  16433. addCss("".concat(this.jSPlugin.staticPath, "/rec/datepicker.min.css"));
  16434. addJs("".concat(this.jSPlugin.staticPath, "/rec/jquery.min.js"), function () {
  16435. addJs("".concat(_this.jSPlugin.staticPath, "/rec/datepicker.js"), function () {
  16436. addJs("".concat(_this.jSPlugin.staticPath, "/rec/datepicker.zh-CN.js"), function () {
  16437. // 日期选择:
  16438. if (!document.getElementsByClassName("datepicker-container")[0] && $("#".concat(_this.jSPlugin.id, "-datepicker")).datepicker) {
  16439. $("#".concat(_this.jSPlugin.id, "-datepicker")).datepicker({
  16440. autoShow: false,
  16441. autoHide: true,
  16442. autoPick: true,
  16443. language: 'zh-CN',
  16444. date: new Date(getQueryString('begin', _this.jSPlugin.params.url).replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3')) || new Date(),
  16445. format: 'yyyy-mm-dd',
  16446. endDate: new Date(),
  16447. inline: true,
  16448. container: document.getElementById("".concat(_this.jSPlugin.id, "-wrap"))
  16449. });
  16450. }
  16451. if (document.getElementsByClassName("datepicker-container")[0]) {
  16452. document.getElementsByClassName("datepicker-container")[0].style.display = "none";
  16453. }
  16454. _this.datepickerVisible = false;
  16455. $("#".concat(_this.jSPlugin.id, "-datepicker")).on('pick.datepicker', function (e) {
  16456. console.log("重新选择日期", e.date, new Date(e.date).Format('yyyyMMdd'), new Date(document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value).Format('yyyyMMdd'));
  16457. if (e.date > new Date() || new Date(e.date).Format('yyyyMMdd') === new Date(document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value).Format('yyyyMMdd')) {
  16458. e.preventDefault(); // Prevent to pick the date
  16459. } else {
  16460. document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value = new Date(e.date).Format('yyyy-MM-dd');
  16461. _this.renderRec(e.date);
  16462. if (_this.jSPlugin.decoderState && _this.jSPlugin.decoderState.state) {
  16463. if (_this.jSPlugin.decoderState.state.cloudRec) {
  16464. _this.jSPlugin.changePlayUrl({
  16465. begin: new Date(e.date).Format('yyyyMMdd'),
  16466. type: 'cloud.rec'
  16467. });
  16468. } else if (_this.jSPlugin.decoderState.state.rec) {
  16469. _this.jSPlugin.changePlayUrl({
  16470. begin: new Date(e.date).Format('yyyyMMdd'),
  16471. type: 'rec'
  16472. });
  16473. } else {
  16474. _this.jSPlugin.changePlayUrl({
  16475. begin: new Date(e.date).Format('yyyyMMdd')
  16476. });
  16477. }
  16478. } else {
  16479. _this.jSPlugin.changePlayUrl({
  16480. begin: new Date(e.date).Format('yyyyMMdd')
  16481. });
  16482. }
  16483. }
  16484. if (document.getElementsByClassName("datepicker-container")[0]) {
  16485. document.getElementsByClassName("datepicker-container")[0].style.display = "none";
  16486. }
  16487. _this.datepickerVisible = false;
  16488. //xuehb 重置放大倍数
  16489. if (_this.jSPlugin.decoderState && _this.jSPlugin.decoderState && _this.jSPlugin.decoderState.state && _this.jSPlugin.decoderState.state.zoom) {
  16490. _this.jSPlugin.setDecoderState({
  16491. zoom: false
  16492. });
  16493. _this.jSPlugin.Zoom.stopZoom();
  16494. }
  16495. });
  16496. $("#".concat(_this.jSPlugin.id, "-datepicker")).off('click').on("click", function (e) {
  16497. console.log("点击日期");
  16498. if (!_this.datepickerVisible) {
  16499. if (document.getElementsByClassName("datepicker-container")[0]) {
  16500. document.getElementsByClassName("datepicker-container")[0].style.display = "inline";
  16501. }
  16502. } else {
  16503. if (document.getElementsByClassName("datepicker-container")[0]) {
  16504. document.getElementsByClassName("datepicker-container")[0].style.display = "none";
  16505. }
  16506. }
  16507. _this.datepickerVisible = !_this.datepickerVisible;
  16508. });
  16509. });
  16510. });
  16511. });
  16512. // 尺度变化监听
  16513. document.getElementById("".concat(this.jSPlugin.id, "-timeline-scale-add")).onclick = function () {
  16514. var currentTimeWidth = _this.currentTimeWidth;
  16515. if (currentTimeWidth < 3) {
  16516. _this.timeLine.changeSize(++_this.currentTimeWidth);
  16517. }
  16518. };
  16519. document.getElementById("".concat(this.jSPlugin.id, "-timeline-scale-sub")).onclick = function () {
  16520. var currentTimeWidth = _this.currentTimeWidth;
  16521. if (currentTimeWidth > 0) {
  16522. _this.timeLine.changeSize(--_this.currentTimeWidth);
  16523. }
  16524. };
  16525. // 渲染回放
  16526. var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
  16527. this.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
  16528. this.observer = new MutationObserver(function (mutations, observer) {
  16529. _this.recAutoSize();
  16530. });
  16531. var config = {
  16532. attributes: true,
  16533. attributeOldValue: true,
  16534. attributeFilter: ['style']
  16535. };
  16536. var el = document.getElementById("".concat(this.jSPlugin.id));
  16537. this.observer.observe(el, config);
  16538. }
  16539. }, {
  16540. key: "setDatepickerDate",
  16541. value: function setDatepickerDate(date) {
  16542. if (document.getElementsByClassName("datepicker-container")[0]) {
  16543. var dom = document.getElementsByClassName("datepicker-container")[0];
  16544. var parentNode = dom.parentNode;
  16545. parentNode.removeChild(dom);
  16546. document.getElementById("".concat(this.jSPlugin.id, "-datepicker")).value = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
  16547. $("#".concat(this.jSPlugin.id, "-datepicker")).datepicker({
  16548. autoShow: false,
  16549. autoHide: true,
  16550. autoPick: true,
  16551. language: 'zh-CN',
  16552. defaultDate: date,
  16553. format: 'yyyy-mm-dd',
  16554. endDate: new Date(),
  16555. inline: true,
  16556. container: document.getElementById("".concat(this.jSPlugin.id, "-wrap"))
  16557. });
  16558. }
  16559. }
  16560. }, {
  16561. key: "datepickerHide",
  16562. value: function datepickerHide() {
  16563. if (document.getElementsByClassName("datepicker-container")[0]) {
  16564. document.getElementsByClassName("datepicker-container")[0].style.display = "none";
  16565. }
  16566. this.datepickerVisible = false;
  16567. }
  16568. }, {
  16569. key: "datepickerShow",
  16570. value: function datepickerShow() {
  16571. if (document.getElementsByClassName("datepicker-container")[0]) {
  16572. document.getElementsByClassName("datepicker-container")[0].style.display = "inline";
  16573. }
  16574. this.datepickerVisible = true;
  16575. }
  16576. }, {
  16577. key: "recAutoSize",
  16578. value: function recAutoSize() {
  16579. var _this2 = this;
  16580. if (document.getElementById("".concat(this.jSPlugin.id, "-canvas"))) {
  16581. var canvasItemWidth = parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width, 10) - 100;
  16582. if (canvasItemWidth !== parseInt(document.getElementById("".concat(this.jSPlugin.id, "-canvas")).width)) {
  16583. document.getElementById("".concat(this.jSPlugin.id, "-canvas")).width = canvasItemWidth;
  16584. this.timeLine.init({
  16585. id: "".concat(this.jSPlugin.id, "-canvas"),
  16586. width: canvasItemWidth,
  16587. onChange: function onChange(time) {
  16588. console.log("time", time, new Date(time).Format('yyyyMMddhhmmss'));
  16589. console.log("jSPlugin", _this2.jSPlugin);
  16590. var newBegin = new Date(time).Format('yyyyMMddhhmmss');
  16591. _this2.jSPlugin.changePlayUrl({
  16592. begin: newBegin
  16593. });
  16594. }
  16595. });
  16596. // this.timeLine.setWidth({
  16597. // id: `${this.jSPlugin.id}-canvas`,
  16598. // width: canvasItemWidth,
  16599. // })
  16600. this.renderRec(this.date);
  16601. this.syncTimeLine();
  16602. }
  16603. }
  16604. }
  16605. }, {
  16606. key: "syncTimeLine",
  16607. value: function syncTimeLine() {
  16608. var _this3 = this;
  16609. if (this.jSPlugin.recTimer) {
  16610. clearInterval(this.jSPlugin.recTimer);
  16611. }
  16612. // let end = setInterval(function () { }, 10000);
  16613. // for (let i = 1; i <= end && i != this.jSPlugin.recTimer; i++) {
  16614. // clearInterval(i);
  16615. // }
  16616. this.jSPlugin.recTimer = setInterval(function () {
  16617. var getOSDTimePromise = _this3.jSPlugin.getOSDTime();
  16618. getOSDTimePromise.then(function (data) {
  16619. var v = data.data;
  16620. if (v === -1) {
  16621. console.log("获取播放时间错误");
  16622. } else {
  16623. if (v > 0) {
  16624. // console.log("获取播放时间", v, this.timeLine.run);
  16625. _this3.timeLine.run({
  16626. time: new Date(v > 1000000000000 ? v : v * 1000)
  16627. });
  16628. //$(".current-time").text(new Date(new Date(v > 1000000000000 ? v : v * 1000)).Format('yyyy-MM-dd hh:mm:ss'))
  16629. }
  16630. }
  16631. })["catch"](function (err) {});
  16632. }, 1000);
  16633. }
  16634. }, {
  16635. key: "unSyncTimeLine",
  16636. value: function unSyncTimeLine() {
  16637. if (this.jSPlugin.recTimer) {
  16638. clearInterval(this.jSPlugin.recTimer);
  16639. }
  16640. }
  16641. }, {
  16642. key: "renderRec",
  16643. value: function renderRec(date) {
  16644. var _this4 = this;
  16645. this.date = date;
  16646. var that = this;
  16647. var dateStart = new Date(new Date(date).Format('yyyy-MM-dd 00:00:00').replace(/-/g, "/")).getTime();
  16648. var dateEnd = new Date(new Date(date).Format('yyyy-MM-dd 23:59:59').replace(/-/g, "/")).getTime();
  16649. this.timeLine.getRecord([], dateStart, dateEnd);
  16650. console.log('-----------233---------this.jSPlugin.url', this.jSPlugin.url);
  16651. var recSliceParams = {
  16652. accessToken: this.jSPlugin.accessToken,
  16653. recType: matchEzopenUrl(this.jSPlugin.url).type === 'cloud.rec' ? 1 : 2,
  16654. deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial,
  16655. channelNo: matchEzopenUrl(this.jSPlugin.url).channelNo,
  16656. startTime: dateStart,
  16657. endTime: dateEnd,
  16658. version: '2.0'
  16659. };
  16660. var recAPISuccess = function recAPISuccess(data) {
  16661. if (data.data && data.data.files && data.data.files.length > 0) {
  16662. var dataArr = data.data.files;
  16663. var nextFileTime = new Date().getTime();
  16664. var isAll = data.data.isAll;
  16665. if (isAll) {
  16666. _this4.timeLine.getRecord(dataArr, dateStart, dateEnd);
  16667. } else {
  16668. // 云存储回调事务
  16669. var recTransaction = function recTransaction() {
  16670. function recAPIV2Success(data) {
  16671. if (data.data && data.data.files && data.data.files.length > 0) {
  16672. if (data.data.isAll == false) {
  16673. if (data.data.files) {
  16674. dataArr = dataArr.concat(data.data.files);
  16675. }
  16676. nextFileTime = data.data.nextFileTime > 0 ? data.data.nextFileTime : new Date().getTime();
  16677. recTransaction();
  16678. } else {
  16679. console.log("云存储执行渲染片段");
  16680. that.timeLine.getRecord(dataArr, dateStart, dateEnd);
  16681. }
  16682. } else {
  16683. that.timeLine.getRecord(dataArr, dateStart, dateEnd);
  16684. }
  16685. }
  16686. recSliceParams.startTime = nextFileTime;
  16687. request(this.jSPlugin.env.domain + "/api/lapp/video/by/time", 'POST', recSliceParams, '', recAPIV2Success);
  16688. };
  16689. recTransaction();
  16690. }
  16691. _this4.timeLine.run({
  16692. time: new Date(dateStart)
  16693. });
  16694. } else if (data.data && data.data.length > 0) {
  16695. console.log("获取本地录像片段成功", data);
  16696. that.timeLine.getRecord(data.data, dateStart, dateEnd);
  16697. that.timeLine.run({
  16698. time: new Date(dateStart)
  16699. });
  16700. } else ;
  16701. };
  16702. var recAPIUrl = this.jSPlugin.env.domain + "/api/lapp/video/by/time";
  16703. request(recAPIUrl, 'POST', recSliceParams, '', recAPISuccess);
  16704. }
  16705. }]);
  16706. return Rec;
  16707. }();
  16708. var TimeLine = function TimeLine(params) {
  16709. console.log("执行TimeLine - params", params);
  16710. this.state = {
  16711. id: params.id,
  16712. start: '00:00:00',
  16713. // 传入最近片段起始时刻
  16714. end: '24:00:00',
  16715. // 传入最近片段结束时刻 默认结束时间为24:00:00, 1440 24
  16716. current: 0,
  16717. // 当前播放时刻
  16718. // rate: 1, // 1:2小时, 2:1小时, 3:半小时, 4:10分钟, 5:1分钟
  16719. timelag: 30,
  16720. // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
  16721. timeArr: [],
  16722. // 时间轴列表
  16723. availTimeLine: [],
  16724. // 由实际存在视频片段的时间组成,[{st: '', et: ''}, {st: '', et: ''}, ...]
  16725. scrollTop: 0,
  16726. // 页面滚动偏移量 页面偏移量由传入时刻决定
  16727. // currentTimer: '', // 时刻定时器
  16728. // timelineTimer: '', //时间轴定时器,
  16729. index: 0,
  16730. // 初始时刻在availtimeLine中的index
  16731. // playCode: 0, // 当前播放状态值
  16732. date: '',
  16733. noTimeLineTxt: '',
  16734. disabled: false // 禁用拖动轴
  16735. };
  16736. var _this = this;
  16737. this.setState = function (obj) {
  16738. Object.keys(obj).forEach(function (key) {
  16739. _this.state[key] = obj[key];
  16740. if (key === 'scrollTop') {
  16741. document.getElementById('time-line-item').parentNode.scrollTo(0, obj[key]);
  16742. }
  16743. if (key === 'current') {
  16744. document.getElementById('time-line-current').innerHTML = obj[key];
  16745. }
  16746. });
  16747. };
  16748. this.setDisabled = function (value) {
  16749. this.setState({
  16750. disabled: value
  16751. });
  16752. document.getElementById('time-line-item').parentNode.style.overflowY = value ? 'hidden' : 'scroll';
  16753. // console.log(" document.getElementById('time-line-item').parentNode.style", document.getElementById('time-line-item').parentNode)
  16754. };
  16755. this.timeToSecond = function (time) {
  16756. var e = time.split(':');
  16757. var h = Number(e[0]);
  16758. var m = Number(e[1]);
  16759. var s = Number(e[2]);
  16760. return h * 60 * 60 + m * 60 + (s ? s : 0);
  16761. };
  16762. this.minuteToTime = function (minute) {
  16763. var hour = Math.floor(minute / 60);
  16764. var m = minute % 60;
  16765. return (hour > 9 ? hour : '0' + hour) + ':' + (m > 9 ? m : '0' + m);
  16766. };
  16767. this.timeToMinute = function (time) {
  16768. var e = time.split(':');
  16769. var h = Number(e[0]);
  16770. var m = Number(e[1]);
  16771. // const s = Number(e[2]);
  16772. return h * 60 + m;
  16773. };
  16774. this.getPalyParam = params.getPalyParam;
  16775. // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
  16776. document.getElementById('time-line-item').parentNode.ontouchstart = function () {
  16777. if (_this.state.disabled) {
  16778. return false;
  16779. }
  16780. params.ontouchstart();
  16781. };
  16782. // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
  16783. document.getElementById('time-line-item').parentNode.ontouchmove = function () {
  16784. if (_this.state.disabled) {
  16785. return false;
  16786. }
  16787. params.ontouchmove();
  16788. };
  16789. // 手动滚动停止,选定时刻自动播放
  16790. document.getElementById('time-line-item').parentNode.ontouchend = function () {
  16791. // var _this = this;
  16792. if (_this.state.disabled) {
  16793. return false;
  16794. }
  16795. //
  16796. var timer;
  16797. var scollPromise = new Promise(function (resolve, reject) {
  16798. var preTop = -1;
  16799. timer = setInterval(function () {
  16800. // debugger
  16801. var reactTop = document.getElementById('time-line-item').parentNode.scrollTop; // 实际偏移高度
  16802. if (reactTop !== preTop) {
  16803. console.log("scolling", reactTop, preTop);
  16804. preTop = reactTop;
  16805. } else {
  16806. console.log("scoll stop", reactTop, preTop);
  16807. clearInterval(timer);
  16808. resolve(reactTop);
  16809. }
  16810. }, 100);
  16811. });
  16812. //
  16813. scollPromise.then(function (reactTop) {
  16814. console.log("scollPromise: then", reactTop, _this);
  16815. _this.rectTopTotime(reactTop);
  16816. console.log('页面滚动实际高度', reactTop, _this.state);
  16817. _this.getPalyParam({
  16818. current: _this.state.current
  16819. });
  16820. });
  16821. params.ontouchend();
  16822. };
  16823. this.matchTimeDot();
  16824. };
  16825. TimeLine.prototype.changeScale = function (value) {
  16826. this.setState({
  16827. timelag: value // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
  16828. });
  16829. this.matchTimeDot();
  16830. };
  16831. TimeLine.prototype.setDateLine = function (news, defaultIndex) {
  16832. // if( news.length > 0 ){
  16833. // if(!defaultIndex){
  16834. // defaultIndex = 0;
  16835. // }
  16836. // this.setState({
  16837. // availTimeLine: news,
  16838. // start: news[defaultIndex].st,
  16839. // end: news[defaultIndex].et,
  16840. // current: news[defaultIndex].st,
  16841. // })
  16842. // console.log("this.state", this.state);
  16843. // this.matchTimeDot();
  16844. // this.primaryOffsetH();
  16845. // // 将当前播放时间片段传给父组件
  16846. // this.getPalyParam(news[defaultIndex]);
  16847. // }
  16848. if (news.length > 0) {
  16849. if (typeof defaultIndex === 'undefined') {
  16850. defaultIndex = news.length - 1;
  16851. }
  16852. this.setState({
  16853. availTimeLine: news,
  16854. start: news[defaultIndex].st,
  16855. end: news[defaultIndex].et,
  16856. current: news[defaultIndex].st
  16857. });
  16858. console.log("this.state", this.state);
  16859. this.matchRecTimeDot();
  16860. this.primaryOffsetH();
  16861. // 将当前播放时间片段传给父组件
  16862. //this.getPalyParam({ current: news[defaultIndex].st });
  16863. } else {
  16864. this.setState({
  16865. availTimeLine: []
  16866. });
  16867. console.log("this.state", this.state);
  16868. this.matchRecTimeDot();
  16869. }
  16870. };
  16871. TimeLine.prototype.matchTimeDot = function () {
  16872. var _this$state = this.state,
  16873. start = _this$state.start,
  16874. end = _this$state.end,
  16875. timelag = _this$state.timelag;
  16876. _this$state.availTimeLine;
  16877. console.log("start", start, 'end', end);
  16878. var timeArr = [];
  16879. // // 播放时间片段时刻转分钟
  16880. // let availArr = [];
  16881. // let len = availTimeLine.length;
  16882. // for (let i = 0; i < len; i++) {
  16883. // const temp = availTimeLine[i];
  16884. // let st = this.timeToSecond(temp.st);
  16885. // let et = this.timeToSecond(temp.et);
  16886. // // console.log('st: ', st, 'et:', et);
  16887. // let stminute;
  16888. // let etminute;
  16889. // let stAvailPercent = 0;
  16890. // let etAvailPercent = 0;
  16891. // stminute = Math.floor(st / (timelag * 60)) * timelag;
  16892. // stAvailPercent = (st - (stminute * 60)) / timelag;
  16893. // etminute = Math.floor(et / (timelag * 60)) * timelag;
  16894. // etAvailPercent = (et - (etminute * 60)) / timelag;
  16895. // availArr[i] = {
  16896. // st: stminute,
  16897. // et: etminute,
  16898. // stAvailPercent: stAvailPercent,
  16899. // etAvailPercent: etAvailPercent
  16900. // }
  16901. // }
  16902. // console.log('availArr: ', availArr);
  16903. // 时间转分钟
  16904. var minute = this.timeToMinute(end);
  16905. // // 检测是否包含秒,则实际分钟加1
  16906. // const e = end.split(':');
  16907. // const s = Number(e[2]);
  16908. // if (s > 0) {
  16909. // minute = minute + 1
  16910. // }
  16911. minute = Math.floor(minute / timelag) * timelag;
  16912. for (var i = minute; i >= 0;) {
  16913. var marginTop = 0;
  16914. var marginBottom = 0;
  16915. // 视频片段
  16916. var recArr = [];
  16917. if (i == minute) {
  16918. marginTop = 70;
  16919. }
  16920. if (i == 0) {
  16921. marginBottom = 230;
  16922. }
  16923. // for (let j = 0; j < len; j++) {
  16924. // if (i >= availArr[j].st && i <= availArr[j].et) {
  16925. // // borderColor = '#f7a670';
  16926. // // console.log("i",i,availArr[j])
  16927. // if (i == availArr[j].st && i == availArr[j].et) {
  16928. // var height = availArr[j].etAvailPercent - availArr[j].stAvailPercent;
  16929. // var top = 60 - availArr[j].etAvailPercent;
  16930. // recArr.push({
  16931. // height: height,
  16932. // top: top
  16933. // })
  16934. // } else {
  16935. // if (i == availArr[j].st) {
  16936. // recArr.push({
  16937. // height: 60 - availArr[j].stAvailPercent,
  16938. // top: 0
  16939. // })
  16940. // } else if (i == availArr[j].et) {
  16941. // recArr.push({
  16942. // height: availArr[j].etAvailPercent,
  16943. // top: 60 - availArr[j].etAvailPercent,
  16944. // })
  16945. // } else if (i > availArr[j].st && i < availArr[j].et) {
  16946. // // 跨越多个区域
  16947. // recArr.push({
  16948. // height: 60,
  16949. // top: 0,
  16950. // })
  16951. // }
  16952. // }
  16953. // }
  16954. // }
  16955. var time = this.minuteToTime(i);
  16956. timeArr.push({
  16957. id: i,
  16958. current: time,
  16959. label: "a" + i,
  16960. marginTop: marginTop,
  16961. marginBottom: marginBottom,
  16962. recArr: recArr
  16963. });
  16964. i = i - timelag;
  16965. }
  16966. this.setState({
  16967. timeArr: timeArr
  16968. });
  16969. this.renderDateLine();
  16970. };
  16971. TimeLine.prototype.matchRecTimeDot = function () {
  16972. var _this$state2 = this.state,
  16973. start = _this$state2.start,
  16974. end = _this$state2.end,
  16975. timelag = _this$state2.timelag,
  16976. availTimeLine = _this$state2.availTimeLine,
  16977. timeArr = _this$state2.timeArr;
  16978. console.log("start", start, 'end', end);
  16979. // 播放时间片段时刻转分钟
  16980. var availArr = [];
  16981. var len = availTimeLine.length;
  16982. if (len === 0) {
  16983. for (var j = 0; j < timeArr.length; j++) {
  16984. timeArr[j].recArr = [];
  16985. }
  16986. } else {
  16987. //xuehb 切换回放时要把上一次的回放时间段重置清空掉
  16988. for (var k = 0; k < timeArr.length; k++) {
  16989. timeArr[k].recArr = [];
  16990. }
  16991. for (var i = 0; i < len; i++) {
  16992. var temp = availTimeLine[i];
  16993. var st = this.timeToSecond(temp.st);
  16994. var et = this.timeToSecond(temp.et);
  16995. // console.log('st: ', st, 'et:', et);
  16996. var stminute = void 0;
  16997. var etminute = void 0;
  16998. var stAvailPercent = 0;
  16999. var etAvailPercent = 0;
  17000. stminute = Math.floor(st / (timelag * 60)) * timelag;
  17001. stAvailPercent = (st - stminute * 60) / timelag;
  17002. etminute = Math.floor(et / (timelag * 60)) * timelag;
  17003. etAvailPercent = (et - etminute * 60) / timelag;
  17004. availArr[i] = {
  17005. st: stminute,
  17006. et: etminute,
  17007. stAvailPercent: stAvailPercent,
  17008. etAvailPercent: etAvailPercent
  17009. };
  17010. for (var j = 0; j < timeArr.length; j++) {
  17011. if (timeArr[j].id == stminute && timeArr[j].id == etminute) {
  17012. var height = etAvailPercent - stAvailPercent;
  17013. var top = 60 - etAvailPercent;
  17014. timeArr[j].recArr.push({
  17015. height: height,
  17016. top: top
  17017. });
  17018. } else {
  17019. if (timeArr[j].id == stminute) {
  17020. timeArr[j].recArr.push({
  17021. height: 60 - stAvailPercent,
  17022. top: 0
  17023. });
  17024. } else if (timeArr[j].id == etminute) {
  17025. timeArr[j].recArr.push({
  17026. height: etAvailPercent,
  17027. top: 60 - etAvailPercent
  17028. });
  17029. } else if (timeArr[j].id > stminute && timeArr[j].id < etminute) {
  17030. timeArr[j].recArr.push({
  17031. height: 60,
  17032. top: 0
  17033. });
  17034. }
  17035. }
  17036. }
  17037. }
  17038. }
  17039. console.log('availArr: ', availArr);
  17040. this.setState({
  17041. timeArr: timeArr
  17042. });
  17043. console.log('timeArr:', this.state);
  17044. this.renderDateLine();
  17045. };
  17046. TimeLine.prototype.renderDateLine = function () {
  17047. var _this$state3 = this.state,
  17048. id = _this$state3.id,
  17049. timeArr = _this$state3.timeArr;
  17050. console.log("id,timeArr", id, timeArr);
  17051. var container = document.getElementById("time-line-item");
  17052. container.innerHTML = "";
  17053. timeArr.forEach(function (item, index) {
  17054. var timeItemDOM = document.createElement('div');
  17055. timeItemDOM.setAttribute("class", "time-item");
  17056. timeItemDOM.style = "margin-top: ".concat(item.marginTop, "px; margin-bottom: ").concat(item.marginBottom, "px; border-right-color: ").concat(item.borderColor, ";");
  17057. var scaleDOM = document.createElement('div');
  17058. scaleDOM.setAttribute("class", "scale");
  17059. var timeItemHtml = '<div class="scale"></div><div class="scale"></div><div class="scale"></div><div class="scale"></div><div class="scale"></div><div class="scale" style="width:10px"></div>';
  17060. item.recArr.forEach(function (i, j) {
  17061. timeItemHtml += "<div class=\"item-unavail\" style=\"height: ".concat(i.height, "px;background-color:#A8B9ED; top: ").concat(i.top, "px\"></div>");
  17062. });
  17063. //timeItemHtml += `<div class="item-unavail" style="height: ${item.availPercent}px; top: ${item.availTop}px"></div>`
  17064. timeItemHtml += "<div id=".concat(item.label, " style=\"position: relative; top: 51px; left: 40%\"> ").concat(item.current, "</div>");
  17065. timeItemDOM.innerHTML = timeItemHtml;
  17066. container.appendChild(timeItemDOM);
  17067. });
  17068. };
  17069. // 计算初始偏移量
  17070. TimeLine.prototype.primaryOffsetH = function () {
  17071. var _this$state4 = this.state,
  17072. start = _this$state4.start,
  17073. timelag = _this$state4.timelag,
  17074. timeArr = _this$state4.timeArr;
  17075. var currentItem = timeArr[0].current;
  17076. var currentTime = this.timeToSecond(currentItem);
  17077. var startSecond = this.timeToSecond(start);
  17078. var offsetS = currentTime - startSecond;
  17079. var offsetH = Math.ceil(offsetS / timelag) + 60; // offsetS / (timelag * 60) * 60
  17080. this.setState({
  17081. scrollTop: offsetH
  17082. });
  17083. console.log('起始偏移量', offsetH);
  17084. };
  17085. // 计算当前偏移量
  17086. TimeLine.prototype.currentOffsetH = function () {
  17087. var _this$state5 = this.state,
  17088. current = _this$state5.current,
  17089. timelag = _this$state5.timelag,
  17090. timeArr = _this$state5.timeArr;
  17091. var startItem = timeArr[0].current;
  17092. var startSecond = this.timeToSecond(startItem);
  17093. var currentSecond = this.timeToSecond(current);
  17094. var offsetS = startSecond - currentSecond;
  17095. var offsetH = Math.ceil(offsetS / timelag) + 60; // offsetS / (timelag * 60) * 60
  17096. this.setState({
  17097. scrollTop: offsetH
  17098. });
  17099. };
  17100. // 通过时间轴位置获取当前时间
  17101. TimeLine.prototype.rectTopTotime = function (reactTop) {
  17102. var timelag = this.state.timelag;
  17103. // let rectTop = rect.top; // 获取当前元素距离父元素顶部的高度
  17104. // let reactTop = 0 - rectTop; // 实际偏移高度
  17105. var index = Math.floor(reactTop / 60); // 以分钟为刻度时,每个元素初始高度为60px, 向下取整并除以时刻倍数得出偏移item;
  17106. var offsetH = reactTop - index * 60; // 偏移高度
  17107. var current;
  17108. var offsetSecond;
  17109. console.log('index:', index, 'offsetH:', offsetH);
  17110. if (offsetH == 0) {
  17111. current = this.state.timeArr[index - 1].current;
  17112. offsetSecond = 0;
  17113. } else {
  17114. // 当timelag==120,timelag==60,timelag==30,timelag==10,timelag==1
  17115. var time = this.state.timeArr[index].current;
  17116. var minute = this.timeToMinute(time);
  17117. // 相对于下一元素偏移
  17118. var offsetY = 60 - offsetH;
  17119. var offsetS = offsetY * timelag; // offsetY / 60 * timelag * 60
  17120. var offsetM = Math.floor(offsetS / 60) + minute;
  17121. var second = Math.floor(offsetS / 60) * 60;
  17122. offsetSecond = Math.ceil(offsetS - second); // 保留两位小数
  17123. current = this.minuteToTime(offsetM);
  17124. }
  17125. this.setState({
  17126. current: current + ':' + (offsetSecond > 9 ? offsetSecond : '0' + offsetSecond),
  17127. scrollTop: reactTop
  17128. });
  17129. // console.log("rectLeft", reactTop);
  17130. // console.log("currentTime", current + ':' + (offsetSecond > 9 ? offsetSecond : '0' + offsetSecond));
  17131. };
  17132. // 时间轴滚动,根据传参变化
  17133. TimeLine.prototype.stepScrollTimeLine = function (time) {
  17134. this.setState({
  17135. current: time
  17136. });
  17137. this.currentOffsetH();
  17138. };
  17139. TimeLine.prototype.secondCountDown = function (time) {
  17140. var current = this.state.current;
  17141. // console.log('currentTime', current);
  17142. var temp = current.split(':');
  17143. var hour = Number(temp[0]);
  17144. var minute = Number(temp[1]);
  17145. var second = Number(temp[2]);
  17146. var t = hour * 60 * 60 + minute * 60 + second + 1;
  17147. var h = Math.floor(t / 3600);
  17148. var m = Math.floor((t - h * 3600) / 60);
  17149. var s = t - h * 3600 - m * 60;
  17150. this.setState({
  17151. current: (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s)
  17152. });
  17153. };
  17154. var MobileTimeLine = TimeLine;
  17155. Date.prototype.Format = function (fmt) {
  17156. //author: meizz
  17157. var o = {
  17158. "M+": this.getMonth() + 1,
  17159. //月份
  17160. "d+": this.getDate(),
  17161. //日
  17162. "h+": this.getHours(),
  17163. //小时
  17164. "m+": this.getMinutes(),
  17165. //分
  17166. "s+": this.getSeconds(),
  17167. //秒
  17168. "q+": Math.floor((this.getMonth() + 3) / 3),
  17169. //季度
  17170. "S": this.getMilliseconds() //毫秒
  17171. };
  17172. if (/(y+)/.test(fmt)) {
  17173. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  17174. }
  17175. for (var k in o) {
  17176. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  17177. }
  17178. return fmt;
  17179. };
  17180. function format(now) {
  17181. var time = new Date(now);
  17182. var h = time.getHours(); //返回日期中的小时数(0到23)
  17183. var m = time.getMinutes(); //返回日期中的分钟数(0到59)
  17184. var s = time.getSeconds(); //返回日期中的秒数(0到59)
  17185. return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
  17186. }
  17187. var MobileRec = /*#__PURE__*/function () {
  17188. function MobileRec(jSPlugin, changeRecSpeed, resetMobileZoomStatus) {
  17189. var _this = this;
  17190. _classCallCheck$1(this, MobileRec);
  17191. //xuehb 修改播放速度方法
  17192. this.changeRecSpeed = changeRecSpeed;
  17193. //xuehb 重置放大状态
  17194. this.resetMobileZoomStatus = resetMobileZoomStatus;
  17195. this.isMobile = true;
  17196. this.jSPlugin = jSPlugin;
  17197. this.timer = null;
  17198. this.date = new Date().Format('yyyy-MM-dd');
  17199. this.begin = (new Date().Format('yyyy-MM-dd') + ' 00:00:00').replace(/-/g, "/");
  17200. this.end = (new Date().Format('yyyy-MM-dd') + ' 23:59:59').replace(/-/g, "/");
  17201. this.initBegin = null;
  17202. this.initEnd = null;
  17203. this.type = matchEzopenUrl(this.jSPlugin.url).type;
  17204. this.operating = false;
  17205. this.seekTimer = null;
  17206. this.disabled = false;
  17207. this.seekFrequency = 2000;
  17208. if (this.jSPlugin.params && this.jSPlugin.params.seekFrequency) {
  17209. this.seekFrequency = this.jSPlugin.params.seekFrequency;
  17210. }
  17211. var oS = document.createElement('style');
  17212. oS.innerHTML = "\n body{\n padding: 0;\n margin: 0;\n }\n .time-line-container {\n text-align: left;\n height: 300px;\n /* outline: 1px solid red; */\n /* background: gray; */\n position: relative;\n /* padding-top: 60px; */\n margin-top: 20px;\n }\n\n .time-line-container .time-line-item-container {\n display: inline-block;\n /* height: 400px; */\n width: 30%;\n /* background: indianred; */\n overflow-y: scroll;\n overflow-x: hidden;\n /* padding-top: 60px; */\n height: 300px;\n box-sizing: border-box;\n white-space: nowrap;\n position: relative;\n }\n\n .time-line-container .time-line-item-container::-webkit-scrollbar {\n width: 0px;\n /*\u6EDA\u52A8\u6761\u5BBD\u5EA6*/\n height: 0px;\n /*\u6EDA\u52A8\u6761\u9AD8\u5EA6*/\n }\n\n .time-line-item .time-item {\n position: relative;\n box-sizing: border-box;\n height: 60px;\n font-size: 12px;\n color: rgb(150, 150, 150);\n border-right: 6px solid;\n border-right-color: #ddd;\n }\n\n .time-line-item .time-item .scale {\n width: 6px;\n height: 9px;\n border-bottom: 1px solid #ccc;\n float: right;\n clear: both;\n }\n\n .time-line-item .time-item .item-unavail {\n width: 6px;\n position: absolute;\n left: 100%;\n background-color: #ddd;\n }\n\n .time-line-container .current-time {\n position: absolute;\n left: 0;\n top: 40px;\n height: 29px;\n /* line-height: 58px; */\n border-bottom: 1px solid #648FFC;\n width: 60%;\n margin-left: 26%;\n }\n\n .time-line-container .current-time .current-time-bg {\n position: relative;\n top: 15px;\n width: 100px;\n height: 29px;\n line-height: 29px;\n left: -70px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .time-line-container .current-time .current-time-bg::before {\n content: '';\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 100%;\n background: #648FFC;\n top: 11px;\n position: absolute;\n right: 30px;\n }\n\n .date-switch-container {\n height: 40px;\n position: relative;\n text-align: center;\n margin: 20px 10px;\n }\n\n .date-switch-container .current-date {\n line-height: 40px;\n height: 22px;\n font-size: 16px;\n color: #2C2C2C;\n text-align: center;\n font-weight: bold;\n }\n\n .date-container {\n width: 40px;\n height: 40px;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .rec-type-container {\n display: flex;\n justify-content: space-between;\n }\n\n .rec-type-container .rec-type-text {\n padding: 0 15px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .rec-type-container .rec-type-switch {\n padding: 0 20px;\n }\n\n .date-container input {\n position: absolute;\n opacity: 0;\n display: inline-block;\n width: 40px;\n height: 40px;\n z-index: 10;\n left: 0;\n }\n\n .date-container label {\n position: absolute;\n left: 0;\n top: 0;\n /* display: none; */\n z-index: 0;\n }\n\n .date-icon {\n display: inline-block;\n width: 40px;\n height: 40px;\n background: url('https://resource.eziot.com/group2/M00/00/6A/CtwQF2F6VieAQrU9AAABP-_Nsqo949.png') no-repeat 100% 100%;\n }\n .select-container {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n }\n\n .advice {\n height: 24px;\n width: 70px;\n display: flex;\n justify-content: space-between;\n line-height: 24px;\n background: #F8F8F8;\n border-radius: 8px;\n }\n\n .advice span {\n width: 40px;\n display: inline-block;\n }\n\n input[type=\"checkbox\"]:not(:checked)+.advice span:first-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n\n }\n\n input[type=\"checkbox\"]:checked+.advice span:last-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n }\n\n input[type=\"checkbox\"]:not(:checked)+.advice span:first-child svg {\n fill: #648FFC !important;\n }\n\n input[type=\"checkbox\"]:checked+.advice span:last-child svg {\n fill: #648FFC !important;\n }";
  17213. document.getElementsByTagName("head")[0].appendChild(oS);
  17214. if (getQueryString("begin", this.jSPlugin.url)) {
  17215. var begin = getQueryString("begin", this.jSPlugin.url);
  17216. this.date = begin.slice(0, 4) + '/' + begin.slice(4, 6) + '/' + begin.slice(6, 8);
  17217. this.begin = this.date + " ".concat(begin.slice(8, 10) || "00", ":").concat(begin.slice(10, 12) || "00", ":").concat(begin.slice(12, 14) || "00");
  17218. this.end = this.date + ' 23:59:59';
  17219. this.initBegin = this.begin;
  17220. }
  17221. if (getQueryString("end", this.jSPlugin.url)) {
  17222. var end = getQueryString("end", this.jSPlugin.url);
  17223. this.end = this.date + " ".concat(end.slice(8, 10) || "23", ":").concat(end.slice(10, 12) || "59", ":").concat(end.slice(12, 14) || "59");
  17224. this.initEnd = this.end;
  17225. }
  17226. // 回放时间标题
  17227. var mobileRecTitleWrap = document.createElement('div');
  17228. mobileRecTitleWrap.id = "date-switch-container-wrap";
  17229. mobileRecTitleWrap.className = "date-switch-container-wrap";
  17230. mobileRecTitleWrap.style = "";
  17231. mobileRecTitleWrap.innerHTML = "\n <div class=\"date-switch-container\">\n <div class=\"current-date\" id=\"current-date\">\u4ECA\u65E5\u5F55\u50CF</div>\n <div class=\"date-container\">\n <label for=\"date\">\n <div class=\"date-icon\"></div>\n </label>\n <input type=\"date\" name=\"date\" id=\"date\" />\n </div>\n </div>\n ";
  17232. insertAfter$1(mobileRecTitleWrap, document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
  17233. // 回放时间类型选择
  17234. var mobileRecSwitchWrap = document.createElement('div');
  17235. mobileRecSwitchWrap.id = "rec-type-container-wrap";
  17236. mobileRecSwitchWrap.className = "rec-type-container-wrap";
  17237. mobileRecSwitchWrap.style = "";
  17238. mobileRecSwitchWrap.innerHTML = "\n <div class=\"rec-type-container\">\n <div class=\"rec-type-text\">\u5171<span id=\"recCount\">0</span>\u4E2A\u5F55\u50CF</div>\n <div class=\"rec-type-switch\">\n <label>\n <input type=\"checkbox\" name=\"type\" id=\"cloudType\" value=\"1\" hidden />\n <label for=\"cloudType\" class=\"advice\">\n <span>\n <svg fill=\"#CCCCCC\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"2 0 20 20\">\n <path class=\"st0\" d=\"M12.6,5c-2.3,0.1-4.3,1.4-5.3,3.3L7.2,8.6c-2.4,0.5-4.1,2.5-4.1,4.9c0,2.8,2.4,5,5.2,5h9.9\n c2.4,0,4.3-1.9,4.3-4.2l0-0.2c-0.1-2-1.6-3.5-3.5-3.9l-0.1,0l0-0.2c-0.4-2.8-3-5-6.1-5L12.6,5z\"/>\n </svg>\n </span>\n <span>\n <svg fill=\"#CCCCCC\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"2 0 20 20\">\n <path id=\"\u5F62\u72B6\u7ED3\u5408\" class=\"st0\" d=\"M14.3,4c0.6,0,1.2,0.2,1.7,0.7l0,0L18.3,7C18.7,7.4,19,8,19,8.6l0,0v9c0,1.3-1.1,2.3-2.4,2.3\n\tl0,0H8.4C7.1,20,6,19,6,17.7l0,0V6.3C6,5,7.1,4,8.4,4l0,0H14.3z M9.7,7.2C9.3,7.2,8.9,7.6,8.9,8l0,0v2.5l0,0.1\n\tc0,0.4,0.4,0.6,0.7,0.6c0.4,0,0.8-0.3,0.8-0.8l0,0V8l0-0.1C10.4,7.5,10,7.2,9.7,7.2z M12.2,7.2c-0.4,0-0.8,0.3-0.8,0.8l0,0v2.5\n\tl0,0.1c0,0.4,0.4,0.6,0.7,0.6c0.4,0,0.8-0.3,0.8-0.8l0,0V8l0-0.1C12.9,7.5,12.5,7.2,12.2,7.2z M14.7,7.2c-0.4,0-0.8,0.3-0.8,0.8l0,0\n\tv2.5l0,0.1c0,0.4,0.4,0.6,0.7,0.6c0.4,0,0.8-0.3,0.8-0.8l0,0V8l0-0.1C15.4,7.5,15,7.2,14.7,7.2z\"/>\n </svg>\n </span>\n </label>\n </label>\n </div>\n </div>\n ";
  17239. insertAfter$1(mobileRecSwitchWrap, mobileRecTitleWrap);
  17240. // 回放时间轴
  17241. var mobileRecWrap = document.createElement('div');
  17242. mobileRecWrap.id = "mobile-rec-wrap";
  17243. mobileRecWrap.className = "mobileRec-wrap";
  17244. mobileRecWrap.style = "";
  17245. mobileRecWrap.innerHTML = "\n <div class=\"time-line-container\">\n <div class=\"current-time\">\n <div class=\"current-time-bg\" id=\"time-line-current\">2020-01-01 00:00:00</div>\n </div>\n <div class=\"time-line-item-container\">\n <div class=\"time-line-item\" id=\"time-line-item\">\n </div>\n </div>\n </div>\n ";
  17246. insertAfter$1(mobileRecWrap, mobileRecSwitchWrap);
  17247. var getPalyParam = function getPalyParam(data) {
  17248. console.log("子组件传值到父组件", data, data.current);
  17249. var st = data.current;
  17250. var date = new Date(_this.date).Format('yyyyMMdd').substr(0, 8) + (data.current ? st.replace(/:/g, "") : data.current.replace(/:/g, ""));
  17251. if (_this.initBegin && new Date("".concat(_this.date, " ").concat(data.current)).getTime() < new Date(_this.initBegin).getTime()) {
  17252. console.log("超过限制最低值");
  17253. date = new Date(_this.initBegin).Format("yyyyMMddhhmmss");
  17254. }
  17255. if (_this.initEnd && new Date("".concat(_this.date, " ").concat(data.current)).getTime() > new Date(_this.initEnd).getTime()) {
  17256. console.log("超过限制最高值");
  17257. date = new Date(_this.initBegin).Format("yyyyMMddhhmmss");
  17258. }
  17259. if (_this.type === 'cloud.rec') {
  17260. var cloudSeek = function cloudSeek() {
  17261. _this.jSPlugin.seek(date.substr(8, 6), "235959");
  17262. setTimeout(function () {
  17263. _this.syncTimeLine();
  17264. }, 6000);
  17265. };
  17266. if (_this.seekTimer) {
  17267. clearTimeout(_this.seekTimer);
  17268. } else {
  17269. cloudSeek();
  17270. }
  17271. console.log("this.jsPlug", _this.jSPlugin.params);
  17272. // 限制每2秒只触发一次拖动
  17273. _this.seekTimer = setTimeout(function () {
  17274. cloudSeek();
  17275. clearTimeout(_this.seekTimer);
  17276. _this.seekTimer = null;
  17277. }, _this.seekFrequency);
  17278. } else {
  17279. var callback = function callback() {
  17280. setTimeout(function () {
  17281. _this.disabled = false;
  17282. }, _this.seekFrequency);
  17283. };
  17284. var localRecSeek = function localRecSeek(callback) {
  17285. _this.disabled = true;
  17286. _this.jSPlugin.pause().then(function () {
  17287. console.log("暂停成功");
  17288. _this.jSPlugin.resume(date).then(function (data) {
  17289. console.log("恢复成功");
  17290. if (_this.jSPlugin.Theme) {
  17291. _this.jSPlugin.Theme.setDecoderState({
  17292. play: true
  17293. });
  17294. }
  17295. // 打开声音
  17296. if (_this.jSPlugin.Theme && _this.jSPlugin.Theme.decoderState.state.sound) {
  17297. _this.jSPlugin.openSound();
  17298. }
  17299. _this.syncTimeLine();
  17300. if (callback) {
  17301. callback();
  17302. }
  17303. });
  17304. })["catch"](function () {
  17305. console.log("暂停失败");
  17306. _this.jSPlugin.resume(date).then(function (data) {
  17307. console.log("恢复成功");
  17308. if (_this.jSPlugin.Theme) {
  17309. _this.jSPlugin.Theme.setDecoderState({
  17310. play: true
  17311. });
  17312. }
  17313. _this.syncTimeLine();
  17314. if (callback) {
  17315. callback();
  17316. }
  17317. });
  17318. });
  17319. };
  17320. if (_this.disabled) {
  17321. console.log("操作频繁,等待2秒后执行");
  17322. if (_this.seekTimer) {
  17323. clearTimeout(_this.seekTimer);
  17324. }
  17325. _this.seekTimer = setTimeout(function () {
  17326. localRecSeek(callback);
  17327. }, _this.seekFrequency);
  17328. } else {
  17329. // 限制每2秒只触发一次拖动
  17330. localRecSeek(callback);
  17331. }
  17332. }
  17333. };
  17334. var ontouchstart = function ontouchstart() {
  17335. _this.operating = true;
  17336. _this.unSyncTimeLine();
  17337. // if (currentTimer) {
  17338. // clearInterval(currentTimer)
  17339. // }
  17340. // if (decoder) {
  17341. // var stopPromise = decoder.stop();
  17342. // stopPromise.then(() => {
  17343. // console.log("停止成功")
  17344. // });
  17345. // }
  17346. };
  17347. var ontouchmove = function ontouchmove() {
  17348. // if (currentTimer) {
  17349. // clearInterval(currentTimer)
  17350. // }
  17351. };
  17352. var ontouchend = function ontouchend() {
  17353. _this.operating = false;
  17354. console.log("ontouchend");
  17355. // if (currentTimer) {
  17356. // clearInterval(currentTimer)
  17357. // }
  17358. };
  17359. this.TimeLineOBJ = new MobileTimeLine({
  17360. id: "time-line-item",
  17361. getPalyParam: getPalyParam,
  17362. ontouchstart: ontouchstart,
  17363. ontouchmove: ontouchmove,
  17364. ontouchend: ontouchend
  17365. });
  17366. this.fetchDeviceRec();
  17367. // 监听日期变化
  17368. document.getElementById("date").addEventListener('change', function (e) {
  17369. console.log("日期变化", e.target.value);
  17370. // if(this.initBegin && new Date(`${e.target.value}`.replace(/-/g, "/")).getTime() < new Date(this.initBegin.slice(0, 10)).getTime()) {
  17371. // console.log("超过限制最低值")
  17372. // return false;
  17373. // }
  17374. // if(this.initEnd && new Date(`${e.target.value}`.replace(/-/g, "/")).getTime() > new Date(this.initEnd.slice(0, 10)).getTime()) {
  17375. // console.log("超过限制最高值")
  17376. // return false;
  17377. // }
  17378. if (_this.initBegin || _this.initEnd) {
  17379. console.log("您开启了时间限制,无法切换日期");
  17380. return false;
  17381. }
  17382. _this.date = new Date(e.target.value).Format("yyyy/MM/dd");
  17383. _this.begin = _this.date + ' 00:00:00';
  17384. _this.end = _this.date + ' 23:59:59';
  17385. _this.fetchDeviceRec();
  17386. _this.jSPlugin.changePlayUrl({
  17387. type: _this.type,
  17388. begin: "".concat(new Date(_this.date).Format('yyyyMMdd'), "000000")
  17389. });
  17390. //xuehb 将播放倍速重置为1
  17391. _this.changeRecSpeed(1);
  17392. //xuehb 重置放大状态
  17393. _this.resetMobileZoomStatus();
  17394. });
  17395. document.getElementById("cloudType").checked = this.type === 'rec';
  17396. document.getElementById("cloudType").addEventListener('change', function (e) {
  17397. var recType = e.target.checked ? 2 : 1;
  17398. _this.type = e.target.checked ? "rec" : 'cloud.rec';
  17399. console.log("recType", recType);
  17400. _this.fetchDeviceRec();
  17401. _this.jSPlugin.changePlayUrl({
  17402. type: _this.type,
  17403. begin: "".concat(new Date(_this.date).Format('yyyyMMdd'), "000000")
  17404. }).then(function () {
  17405. console.log("切换类型成功");
  17406. _this.syncTimeLine();
  17407. //xuehb 将播放倍速重置为1
  17408. _this.changeRecSpeed(1);
  17409. //xuehb 重置放大状态
  17410. _this.resetMobileZoomStatus();
  17411. }, function (err) {
  17412. console.log("err", err);
  17413. })["catch"](function (err) {
  17414. console.log(err);
  17415. });
  17416. // document.getElementById("cloudType").setAttribute("checked", true);
  17417. // $("#cloudType").attr("checked", recType == '2');
  17418. // $("#cloudType .device svg").attr("checked", recType == '2');
  17419. });
  17420. this.syncTimeLine();
  17421. }
  17422. _createClass$1(MobileRec, [{
  17423. key: "fetchDeviceRec",
  17424. value: function fetchDeviceRec() {
  17425. var _this2 = this;
  17426. var doRender = function doRender(result) {
  17427. var len = result.length;
  17428. document.getElementById("recCount").innerHTML = len;
  17429. var availArr = [];
  17430. for (var i = len - 1; i >= 0; i--) {
  17431. var res = result[i];
  17432. var et = format(res.endTime);
  17433. var st = format(res.startTime);
  17434. availArr.push({
  17435. st: st,
  17436. et: et
  17437. });
  17438. }
  17439. // document.getElementById("time-line-item").style.display = "block";
  17440. {
  17441. _this2.TimeLineOBJ.setDateLine(availArr);
  17442. }
  17443. };
  17444. var data = new FormData();
  17445. data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
  17446. data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
  17447. data.append("accessToken", this.jSPlugin.accessToken);
  17448. data.append("recType", this.type === 'cloud.rec' ? 1 : 2);
  17449. data.append("startTime", new Date(this.begin).getTime());
  17450. data.append("endTime", new Date(this.end).getTime());
  17451. fetch(this.jSPlugin.env.domain + '/api/lapp/video/by/time', {
  17452. method: "POST",
  17453. body: data
  17454. }).then(function (response) {
  17455. return response.json();
  17456. }).then(function (res) {
  17457. // 本地回放
  17458. if (res.code == 200 && res.data) {
  17459. var result = [];
  17460. result = res.data;
  17461. doRender(result);
  17462. } else {
  17463. doRender([]);
  17464. }
  17465. });
  17466. }
  17467. }, {
  17468. key: "syncTimeLine",
  17469. value: function syncTimeLine() {
  17470. var _this3 = this;
  17471. var dateFormat = function dateFormat(now) {
  17472. var time = new Date(now);
  17473. var h = time.getHours(); //返回日期中的小时数(0到23)
  17474. var m = time.getMinutes(); //返回日期中的分钟数(0到59)
  17475. var s = time.getSeconds(); //返回日期中的秒数(0到59)
  17476. return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
  17477. };
  17478. if (this.timer) {
  17479. clearInterval(this.timer);
  17480. }
  17481. this.timer = setInterval(function () {
  17482. // 定时器
  17483. if (_this3.operating) {
  17484. console.log("操作中");
  17485. return false;
  17486. }
  17487. _this3.jSPlugin.getOSDTime().then(function (res) {
  17488. if (res.data > 0) {
  17489. _this3.TimeLineOBJ.stepScrollTimeLine(dateFormat(res.data * 1000));
  17490. } else {
  17491. console.log("未找到当前获取播放时间,等待中...");
  17492. console.log('res:-----------------', res);
  17493. }
  17494. })["catch"](function (err) {
  17495. console.log('err:-----', err);
  17496. console.log("未找到当前获取播放时间,等待中...");
  17497. });
  17498. }, 1000);
  17499. }
  17500. }, {
  17501. key: "unSyncTimeLine",
  17502. value: function unSyncTimeLine() {
  17503. if (this.timer) {
  17504. clearInterval(this.timer);
  17505. }
  17506. }
  17507. }]);
  17508. return MobileRec;
  17509. }();
  17510. var ptzStart = [
  17511. {
  17512. code: 200,
  17513. msg: "",
  17514. desc: "请求成功",
  17515. text: "操作成功",
  17516. type: "ptzStart"
  17517. },
  17518. {
  17519. code: 10001,
  17520. msg: "操作失败",
  17521. desc: "参数为空或格式不正确",
  17522. text: "参数错误",
  17523. type: "ptzStart"
  17524. },
  17525. {
  17526. code: 10002,
  17527. msg: "账号异常,操作失败",
  17528. desc: "重新获取accessToken",
  17529. text: "accessToken异常或过期",
  17530. type: "ptzStart"
  17531. },
  17532. {
  17533. code: 10005,
  17534. msg: "账号异常,操作失败",
  17535. desc: "appKey被冻结",
  17536. text: "appKey异常",
  17537. type: "ptzStart"
  17538. },
  17539. {
  17540. code: 20002,
  17541. msg: "设备不存在,请检查设备连接情况",
  17542. desc: "",
  17543. text: "设备不存在",
  17544. type: "ptzStart"
  17545. },
  17546. {
  17547. code: 20006,
  17548. msg: "操作失败,请检查设备网络情况",
  17549. desc: "检查设备网络状况,稍后再试",
  17550. text: "网络异常",
  17551. type: "ptzStart"
  17552. },
  17553. {
  17554. code: 20007,
  17555. msg: "操作失败,请检查设备在线情况",
  17556. desc: "检查设备是否在线",
  17557. text: "设备不在线",
  17558. type: "ptzStart"
  17559. },
  17560. {
  17561. code: 20008,
  17562. msg: "操作过于频繁,稍后再试",
  17563. desc: "操作过于频繁,稍后再试",
  17564. text: "设备响应超时",
  17565. type: "ptzStart"
  17566. },
  17567. {
  17568. code: 20014,
  17569. msg: "操作失败",
  17570. desc: "",
  17571. text: "deviceSerial不合法",
  17572. type: "ptzStart"
  17573. },
  17574. {
  17575. code: 20032,
  17576. msg: "通道不存在请检查设备连接情况",
  17577. desc: "该用户下通道不存在",
  17578. text: "该用户下通道不存在",
  17579. type: "ptzStart"
  17580. },
  17581. {
  17582. code: 49999,
  17583. msg: "操作失败,请重试",
  17584. desc: "接口调用异常",
  17585. text: "数据异常",
  17586. type: "ptzStart"
  17587. },
  17588. {
  17589. code: 60000,
  17590. msg: "操作失败,设备不支持该操作",
  17591. desc: "",
  17592. text: "设备不支持云台控制",
  17593. type: "ptzStart"
  17594. },
  17595. {
  17596. code: 60001,
  17597. msg: "操作失败,用户无权限",
  17598. desc: "",
  17599. text: "用户无云台控制权限",
  17600. type: "ptzStart"
  17601. },
  17602. {
  17603. code: 60002,
  17604. msg: "设备已旋转到上限位",
  17605. desc: "",
  17606. text: "设备云台旋转达到上限位",
  17607. type: "ptzStart"
  17608. },
  17609. {
  17610. code: 60003,
  17611. msg: "设备已旋转到下限位",
  17612. desc: "",
  17613. text: "设备云台旋转达到下限位",
  17614. type: "ptzStart"
  17615. },
  17616. {
  17617. code: 60004,
  17618. msg: "设备已旋转到左限位",
  17619. desc: "",
  17620. text: "设备云台旋转达到左限位",
  17621. type: "ptzStart"
  17622. },
  17623. {
  17624. code: 60005,
  17625. msg: "设备已旋转到右限位",
  17626. desc: "",
  17627. text: "设备云台旋转达到右限位",
  17628. type: "ptzStart"
  17629. },
  17630. {
  17631. code: 60006,
  17632. msg: "操作失败,请重试",
  17633. desc: "稍候再试",
  17634. text: "云台当前操作失败",
  17635. type: "ptzStart"
  17636. },
  17637. {
  17638. code: 60009,
  17639. msg: "设备正在操作中",
  17640. desc: "",
  17641. text: "正在调用预置点",
  17642. type: "ptzStart"
  17643. },
  17644. {
  17645. code: 60020,
  17646. msg: "操作失败",
  17647. desc: "确认设备是否支持该操作",
  17648. text: "不支持该命令",
  17649. type: "ptzStart"
  17650. }
  17651. ];
  17652. var ptzStop = [
  17653. {
  17654. code: 200,
  17655. msg: "",
  17656. desc: "请求成功",
  17657. text: "操作成功",
  17658. type: "ptzStop"
  17659. },
  17660. {
  17661. code: 10001,
  17662. msg: "操作失败",
  17663. desc: "参数为空或格式不正确",
  17664. text: "参数错误",
  17665. type: "ptzStop"
  17666. },
  17667. {
  17668. code: 10002,
  17669. msg: "账号异常,操作失败",
  17670. desc: "重新获取accessToken",
  17671. text: "accessToken异常或过期",
  17672. type: "ptzStop"
  17673. },
  17674. {
  17675. code: 10005,
  17676. msg: "账号异常,操作失败",
  17677. desc: "appKey被冻结",
  17678. text: "appKey异常",
  17679. type: "ptzStop"
  17680. },
  17681. {
  17682. code: 20002,
  17683. msg: "设备不存在,请检查设备连接情况",
  17684. desc: "",
  17685. text: "设备不存在",
  17686. type: "ptzStop"
  17687. },
  17688. {
  17689. code: 20006,
  17690. msg: "操作失败,请检查设备网络情况",
  17691. desc: "检查设备网络状况,稍后再试",
  17692. text: "网络异常",
  17693. type: "ptzStop"
  17694. },
  17695. {
  17696. code: 20007,
  17697. msg: "操作失败,请检查设备在线情况",
  17698. desc: "检查设备是否在线",
  17699. text: "设备不在线",
  17700. type: "ptzStop"
  17701. },
  17702. {
  17703. code: 20008,
  17704. msg: "操作过于频繁,稍后再试",
  17705. desc: "操作过于频繁,稍后再试",
  17706. text: "设备响应超时",
  17707. type: "ptzStop"
  17708. },
  17709. {
  17710. code: 20014,
  17711. msg: "操作失败",
  17712. desc: "",
  17713. text: "deviceSerial不合法",
  17714. type: "ptzStop"
  17715. },
  17716. {
  17717. code: 20032,
  17718. msg: "通道不存在请检查设备连接情况",
  17719. desc: "该用户下通道不存在",
  17720. text: "该用户下通道不存在",
  17721. type: "ptzStop"
  17722. },
  17723. {
  17724. code: 49999,
  17725. msg: "操作失败,请重试",
  17726. desc: "接口调用异常",
  17727. text: "数据异常",
  17728. type: "ptzStop"
  17729. },
  17730. {
  17731. code: 60000,
  17732. msg: "操作失败,设备不支持该操作",
  17733. desc: "",
  17734. text: "设备不支持云台控制",
  17735. type: "ptzStop"
  17736. },
  17737. {
  17738. code: 60001,
  17739. msg: "操作失败,用户无权限",
  17740. desc: "",
  17741. text: "用户无云台控制权限",
  17742. type: "ptzStop"
  17743. },
  17744. {
  17745. code: 60006,
  17746. msg: "操作失败,请重试",
  17747. desc: "稍候再试",
  17748. text: "云台当前操作失败",
  17749. type: "ptzStop"
  17750. },
  17751. {
  17752. code: 60009,
  17753. msg: "设备正在操作中",
  17754. desc: "",
  17755. text: "正在调用预置点",
  17756. type: "ptzStop"
  17757. },
  17758. {
  17759. code: 60020,
  17760. msg: "操作失败",
  17761. desc: "确认设备是否支持该操作",
  17762. text: "不支持该命令",
  17763. type: "ptzStop"
  17764. }
  17765. ];
  17766. var talk = [
  17767. {
  17768. code: 200,
  17769. msg: "",
  17770. desc: "请求成功",
  17771. text: "操作成功",
  17772. type: "talk"
  17773. },
  17774. {
  17775. code: 10001,
  17776. msg: "播放失败",
  17777. desc: "参数为空或格式不正确",
  17778. text: "参数错误",
  17779. type: "talk"
  17780. },
  17781. {
  17782. code: 10002,
  17783. msg: "账号异常,操作失败",
  17784. desc: "",
  17785. text: "accessToken异常或过期",
  17786. type: "talk"
  17787. },
  17788. {
  17789. code: 10031,
  17790. msg: "账号异常,操作失败",
  17791. desc: "",
  17792. text: "子账户或萤石用户没有权限",
  17793. type: "talk"
  17794. },
  17795. {
  17796. code: 20002,
  17797. msg: "设备不存在请检查设备连接情况",
  17798. desc: "设备序列号输入有误或者设备未被添加或者通道异常",
  17799. text: "设备不存在",
  17800. type: "talk"
  17801. },
  17802. {
  17803. code: 60059,
  17804. msg: "播放失败",
  17805. desc: "",
  17806. text: "ezopen地址均不可用",
  17807. type: "talk"
  17808. }
  17809. ];
  17810. var time = [
  17811. {
  17812. code: 200,
  17813. msg: "",
  17814. desc: "",
  17815. text: "操作成功",
  17816. type: "time"
  17817. },
  17818. {
  17819. code: 10001,
  17820. msg: "播放失败",
  17821. desc: "参数为空或格式不正确",
  17822. text: "参数错误",
  17823. type: "time"
  17824. },
  17825. {
  17826. code: 10002,
  17827. msg: "账号异常,播放失败",
  17828. desc: "",
  17829. text: "accessToken异常或过期",
  17830. type: "time"
  17831. },
  17832. {
  17833. code: 10004,
  17834. msg: "账号异常,播放失败",
  17835. desc: "",
  17836. text: "用户不存在",
  17837. type: "time"
  17838. },
  17839. {
  17840. code: 10005,
  17841. msg: "账号异常,播放失败",
  17842. desc: "",
  17843. text: "appKey异常",
  17844. type: "time"
  17845. },
  17846. {
  17847. code: 10011,
  17848. msg: "播放失败",
  17849. desc: "设备对应用户未注册至应用下",
  17850. text: "未开通萤石服务",
  17851. type: "time"
  17852. },
  17853. {
  17854. code: 10013,
  17855. msg: "账号异常,播放失败",
  17856. desc: "",
  17857. text: "非开发者账号无权限调用",
  17858. type: "time"
  17859. },
  17860. {
  17861. code: 10030,
  17862. msg: "播放失败",
  17863. desc: "",
  17864. text: "appkey和appsecret不匹配",
  17865. type: "time"
  17866. },
  17867. {
  17868. code: 20002,
  17869. msg: "设备不存在请检查设备连接情况",
  17870. desc: "设备序列号输入有误或者设备未被添加或者通道异常",
  17871. text: "设备不存在",
  17872. type: "time"
  17873. },
  17874. {
  17875. code: 20014,
  17876. msg: "播放失败",
  17877. desc: "",
  17878. text: "deviceSerial不合法",
  17879. type: "time"
  17880. },
  17881. {
  17882. code: 20032,
  17883. msg: "设备不存在请检查设备连接情况",
  17884. desc: "",
  17885. text: "该用户下通道不存在",
  17886. type: "time"
  17887. },
  17888. {
  17889. code: 60024,
  17890. msg: "播放失败请重试",
  17891. desc: "",
  17892. text: "取消订阅操作失败",
  17893. type: "time"
  17894. },
  17895. {
  17896. code: 49999,
  17897. msg: "播放失败请重试",
  17898. desc: "",
  17899. text: "操作异常",
  17900. type: "time"
  17901. }
  17902. ];
  17903. var uikitCode = {
  17904. ptzStart: ptzStart,
  17905. ptzStop: ptzStop,
  17906. talk: talk,
  17907. time: time
  17908. };
  17909. var UikitCode = /*#__PURE__*/function () {
  17910. function UikitCode(x, y) {
  17911. _classCallCheck$1(this, UikitCode);
  17912. this.coreX = x;
  17913. this.coreY = y;
  17914. console.log("uikitCode", uikitCode);
  17915. }
  17916. _createClass$1(UikitCode, [{
  17917. key: "toString",
  17918. value: function toString() {
  17919. return "".concat(this.coreX, "-").concat(this.coreY);
  17920. }
  17921. }, {
  17922. key: "matchInfo",
  17923. value: function matchInfo(code, type) {
  17924. if (uikitCode[type]) {
  17925. var obj = {};
  17926. uikitCode[type].map(function (item) {
  17927. if (item.code == code) {
  17928. obj = item;
  17929. }
  17930. });
  17931. return obj;
  17932. } else {
  17933. return {
  17934. code: 500,
  17935. msg: "未知错误",
  17936. desc: "未知的错误码,或错误码类型有误",
  17937. text: "",
  17938. type: type
  17939. };
  17940. }
  17941. }
  17942. }]);
  17943. return UikitCode;
  17944. }();
  17945. var Ptz = /*#__PURE__*/function () {
  17946. function Ptz(jSPlugin) {
  17947. var _this = this;
  17948. _classCallCheck$1(this, Ptz);
  17949. this.jSPlugin = jSPlugin;
  17950. this.codeHandler = new UikitCode();
  17951. this.pluginStatus = new Status(this, this.jSPlugin.id);
  17952. console.log("云台初始化");
  17953. if (document.getElementById(this.jSPlugin.id + "-ez-ptz-item")) {
  17954. return false;
  17955. }
  17956. var ptzWrap = document.createElement('div');
  17957. ptzWrap.id = this.jSPlugin.id + "-ez-ptz-item";
  17958. ptzWrap.className = "ez-ptz-wrap";
  17959. ptzWrap.style = "display:none";
  17960. var oS = document.createElement('style');
  17961. oS.innerHTML = "\n .ez-ptz-container {\n position: relative;\n width: 80px;\n height: 80px;\n background: rgba(255, 255, 255, 0.80);\n box-shadow: 0px 0px 33px 4px rgb(0 0 0 / 15%);\n border: 1px solid rgba(255, 255, 255, 0.80);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n user-select: none;\n }\n .ez-ptz-container .ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 3px solid transparent;\n border-right: 3px solid transparent;\n border-bottom: 6px solid #333333;\n position: absolute;\n display: inline-block;\n left: calc(50% - 3px);\n top: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.top.active {\n border-bottom-color: #1890FF;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 3px solid transparent;\n border-right: 3px solid transparent;\n border-top: 6px solid #333333;\n position: absolute;\n display: inline-block;\n left: calc(50% - 3px);\n bottom: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom.active {\n border-top-color: #1890FF;\n }\n\n .ez-ptz-container .ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 3px solid transparent;\n border-bottom: 3px solid transparent;\n border-left: 6px solid #333333;\n position: absolute;\n display: inline-block;\n top: calc(50% - 3px);\n right: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.right.active {\n border-left-color: #1890FF;\n }\n\n .ez-ptz-container .ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 3px solid transparent;\n border-bottom: 3px solid transparent;\n border-right: 6px solid #333333;\n position: absolute;\n display: inline-block;\n top: calc(50% - 3px);\n left: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.left.active {\n border-right-color: #1890FF;\n }\n\n .ez-ptz-container .ez-ptz-main.center {\n width: 23px;\n height: 23px;\n background: #1890FF;\n border-radius: 100%;\n top: calc(50% - 12.3px);\n left: calc(50% - 12.3px);\n position: absolute;\n }\n\n .ez-ptz-wrap {\n position: absolute;\n right: 20px;\n top: calc(50% - 50px);\n width: 100px;\n height: 100px;\n z-index: 999;\n }\n\n .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }";
  17962. document.getElementsByTagName("head")[0].appendChild(oS);
  17963. ptzWrap.innerHTML = "\n <div class=\"ez-ptz-container\" id=\"".concat(this.jSPlugin.id, "-ez-ptz-container\" style=\"position: relative;width: 80px;height: 80px;background: rgba(255, 255, 255, 0.80);box-shadow: 0px 0px 33px 4px rgba(0, 0, 0, 0.15);border: 1px solid rgba(255, 255, 255, 0.80);border-radius: 100%;cursor: pointer;overflow: hidden;user-select: none;\">\n <div class=\"ez-ptz-main center\"></div>\n <div class=\"ez-ptz-icon top active\"></div>\n <div class=\"ez-ptz-icon left active\"></div>\n <div class=\"ez-ptz-icon bottom active\"></div>\n <div class=\"ez-ptz-icon right active\"></div>\n ");
  17964. document.getElementById("".concat(jSPlugin.id, "-wrap")).appendChild(ptzWrap);
  17965. // 云台控制事件绑定
  17966. // 云台控制
  17967. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).onmousedown = function (e) {
  17968. e.preventDefault();
  17969. console.log("触摸开始");
  17970. _this._handlePtzTouch(e, 'start');
  17971. };
  17972. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).onmouseup = function (e) {
  17973. e.preventDefault();
  17974. console.log("触摸结束");
  17975. _this._handlePtzTouch(e, 'stop');
  17976. };
  17977. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).ontouchstart = function (e) {
  17978. e.preventDefault();
  17979. console.log("触摸开始");
  17980. _this._handlePtzTouch(e, 'start');
  17981. };
  17982. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).ontouchend = function (e) {
  17983. e.preventDefault();
  17984. console.log("触摸结束", e);
  17985. _this._handlePtzTouch(e, 'stop');
  17986. };
  17987. }
  17988. _createClass$1(Ptz, [{
  17989. key: "show",
  17990. value: function show() {
  17991. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-item")).style = "display: inline-block";
  17992. }
  17993. }, {
  17994. key: "hide",
  17995. value: function hide() {
  17996. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-item")).style = "display: none";
  17997. }
  17998. }, {
  17999. key: "_handlePtzTouch",
  18000. value: function _handlePtzTouch(e, type) {
  18001. var _this2 = this;
  18002. var container = document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).getBoundingClientRect();
  18003. var containerCenterX = container.left + 41;
  18004. var containerCenterY = container.top + 41;
  18005. var eventX = e.x || e.changedTouches[0].clientX;
  18006. var eventY = e.y || e.changedTouches[0].clientY;
  18007. var left = eventX - containerCenterX;
  18008. var top = eventY - containerCenterY;
  18009. var direction = 0; //操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
  18010. var url = this.jSPlugin.env.domain + "/api/lapp/device/ptz/start";
  18011. // var nextPtzImg = ptzNormalImg;
  18012. // var nextPtzImgFailed = ptzNormalImg;
  18013. // 判读方位
  18014. if (Math.abs(left) > Math.abs(top)) {
  18015. if (left > 0) {
  18016. direction = 3;
  18017. // nextPtzImg = ptzRightImgSuccess;
  18018. // nextPtzImgFailed = ptzRightImgFailed;
  18019. } else {
  18020. direction = 2;
  18021. // nextPtzImg = ptzLeftImgSuccess;
  18022. // nextPtzImgFailed = ptzLeftImgFailed;
  18023. }
  18024. } else {
  18025. if (top > 0) {
  18026. direction = 1;
  18027. // nextPtzImg = ptzDownImgSuccess;
  18028. // nextPtzImgFailed = ptzDownImgFailed;
  18029. } else {
  18030. direction = 0;
  18031. // nextPtzImg = ptzTopImgSuccess;
  18032. // nextPtzImgFailed = ptzTopImgFailed;
  18033. }
  18034. }
  18035. // 兼容画面旋转90度
  18036. if (/^rotate\(90/.test(document.getElementById("".concat(this.jSPlugin.id, "-wrap")).style.transform)) {
  18037. switch (direction) {
  18038. case 0:
  18039. direction = 2; // 上转化为左
  18040. break;
  18041. case 1:
  18042. direction = 3; // 下转化为右
  18043. break;
  18044. case 2:
  18045. direction = 1; // 左转化为下
  18046. break;
  18047. case 3:
  18048. direction = 0; // 右转化为上
  18049. break;
  18050. }
  18051. }
  18052. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).style = "background-image:linear-gradient(".concat(direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270, "deg, #1d8dd8 0%, rgba(100,143,252,0.00) 30%)");
  18053. if (type === 'stop') {
  18054. url = this.jSPlugin.env.domain + '/api/lapp/device/ptz/stop';
  18055. document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).style = "";
  18056. }
  18057. var data = new FormData();
  18058. data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
  18059. data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
  18060. data.append("speed", 1);
  18061. data.append("direction", direction);
  18062. data.append("accessToken", this.jSPlugin.accessToken);
  18063. fetch(url, {
  18064. method: "POST",
  18065. body: data
  18066. }).then(function (response) {
  18067. return response.json();
  18068. }).then(function (rt) {
  18069. if (rt.code == 200) ; else {
  18070. //document.getElementById('ptz-img-container').childNodes[0].src = nextPtzImgFailed;
  18071. // layer.msg(data.msg);
  18072. console.log(rt.code, _this2.codeHandler.matchInfo(rt.code, type === 'start' ? 'ptzStart' : 'ptzStop'));
  18073. _this2.pluginStatus.loadingSetText({
  18074. text: _this2.codeHandler.matchInfo(rt.code, type === 'start' ? 'ptzStart' : 'ptzStop').msg,
  18075. color: 'red',
  18076. delayClear: 2000
  18077. });
  18078. if (rt.code == 60005 || rt.code == 60002 || rt.code == 60003 || rt.code == 60004) {
  18079. document.getElementById("".concat(_this2.jSPlugin.id, "-ez-ptz-container")).style = "background-image:linear-gradient(".concat(direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270, "deg, #f45656 0%, rgba(100,143,252,0.00) 30%)");
  18080. }
  18081. }
  18082. })["catch"](function (err) {
  18083. console.log("云台调用异常", err);
  18084. });
  18085. }
  18086. }]);
  18087. return Ptz;
  18088. }();
  18089. (function (f) {
  18090. if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  18091. module.exports = f();
  18092. } else if (typeof define === "function" && define.amd) {
  18093. define([], f);
  18094. } else {
  18095. var g;
  18096. if (typeof window !== "undefined") {
  18097. g = window;
  18098. } else if (typeof global !== "undefined") {
  18099. g = global;
  18100. } else if (typeof self !== "undefined") {
  18101. g = self;
  18102. } else {
  18103. g = this;
  18104. }
  18105. g.adapter = f();
  18106. }
  18107. })(function () {
  18108. return function () {
  18109. function r(e, n, t) {
  18110. function o(i, f) {
  18111. if (!n[i]) {
  18112. if (!e[i]) {
  18113. var c = "function" == typeof require && require;
  18114. if (!f && c) return c(i, !0);
  18115. if (u) return u(i, !0);
  18116. var a = new Error("Cannot find module '" + i + "'");
  18117. throw a.code = "MODULE_NOT_FOUND", a;
  18118. }
  18119. var p = n[i] = {
  18120. exports: {}
  18121. };
  18122. e[i][0].call(p.exports, function (r) {
  18123. var n = e[i][1][r];
  18124. return o(n || r);
  18125. }, p, p.exports, r, e, n, t);
  18126. }
  18127. return n[i].exports;
  18128. }
  18129. for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
  18130. o(t[i]);
  18131. }
  18132. return o;
  18133. }
  18134. return r;
  18135. }()({
  18136. 1: [function (require, module, exports) {
  18137. var _adapter_factory = require('./adapter_factory.js');
  18138. var adapter = (0, _adapter_factory.adapterFactory)({
  18139. window: window
  18140. });
  18141. window.adapter = adapter;
  18142. module.exports = adapter; // this is the difference from adapter_core.
  18143. }, {
  18144. "./adapter_factory.js": 2
  18145. }],
  18146. 2: [function (require, module, exports) {
  18147. Object.defineProperty(exports, "__esModule", {
  18148. value: true
  18149. });
  18150. exports.adapterFactory = adapterFactory;
  18151. var _utils = require('./utils');
  18152. var utils = _interopRequireWildcard(_utils);
  18153. var _chrome_shim = require('./chrome/chrome_shim');
  18154. var chromeShim = _interopRequireWildcard(_chrome_shim);
  18155. var _edge_shim = require('./edge/edge_shim');
  18156. var edgeShim = _interopRequireWildcard(_edge_shim);
  18157. var _firefox_shim = require('./firefox/firefox_shim');
  18158. var firefoxShim = _interopRequireWildcard(_firefox_shim);
  18159. var _safari_shim = require('./safari/safari_shim');
  18160. var safariShim = _interopRequireWildcard(_safari_shim);
  18161. var _common_shim = require('./common_shim');
  18162. var commonShim = _interopRequireWildcard(_common_shim);
  18163. function _interopRequireWildcard(obj) {
  18164. if (obj && obj.__esModule) {
  18165. return obj;
  18166. } else {
  18167. var newObj = {};
  18168. if (obj != null) {
  18169. for (var key in obj) {
  18170. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  18171. }
  18172. }
  18173. newObj["default"] = obj;
  18174. return newObj;
  18175. }
  18176. }
  18177. // Shimming starts here.
  18178. /*
  18179. * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
  18180. *
  18181. * Use of this source code is governed by a BSD-style license
  18182. * that can be found in the LICENSE file in the root of the source
  18183. * tree.
  18184. */
  18185. function adapterFactory() {
  18186. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18187. window = _ref.window;
  18188. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
  18189. shimChrome: true,
  18190. shimFirefox: true,
  18191. shimEdge: true,
  18192. shimSafari: true
  18193. };
  18194. // Utils.
  18195. var logging = utils.log;
  18196. var browserDetails = utils.detectBrowser(window);
  18197. var adapter = {
  18198. browserDetails: browserDetails,
  18199. commonShim: commonShim,
  18200. extractVersion: utils.extractVersion,
  18201. disableLog: utils.disableLog,
  18202. disableWarnings: utils.disableWarnings
  18203. };
  18204. // Shim browser if found.
  18205. switch (browserDetails.browser) {
  18206. case 'chrome':
  18207. if (!chromeShim || !chromeShim.shimPeerConnection || !options.shimChrome) {
  18208. logging('Chrome shim is not included in this adapter release.');
  18209. return adapter;
  18210. }
  18211. logging('adapter.js shimming chrome.');
  18212. // Export to the adapter global object visible in the browser.
  18213. adapter.browserShim = chromeShim;
  18214. chromeShim.shimGetUserMedia(window);
  18215. chromeShim.shimMediaStream(window);
  18216. chromeShim.shimPeerConnection(window);
  18217. chromeShim.shimOnTrack(window);
  18218. chromeShim.shimAddTrackRemoveTrack(window);
  18219. chromeShim.shimGetSendersWithDtmf(window);
  18220. chromeShim.shimGetStats(window);
  18221. chromeShim.shimSenderReceiverGetStats(window);
  18222. chromeShim.fixNegotiationNeeded(window);
  18223. commonShim.shimRTCIceCandidate(window);
  18224. commonShim.shimConnectionState(window);
  18225. commonShim.shimMaxMessageSize(window);
  18226. commonShim.shimSendThrowTypeError(window);
  18227. commonShim.removeAllowExtmapMixed(window);
  18228. break;
  18229. case 'firefox':
  18230. if (!firefoxShim || !firefoxShim.shimPeerConnection || !options.shimFirefox) {
  18231. logging('Firefox shim is not included in this adapter release.');
  18232. return adapter;
  18233. }
  18234. logging('adapter.js shimming firefox.');
  18235. // Export to the adapter global object visible in the browser.
  18236. adapter.browserShim = firefoxShim;
  18237. firefoxShim.shimGetUserMedia(window);
  18238. firefoxShim.shimPeerConnection(window);
  18239. firefoxShim.shimOnTrack(window);
  18240. firefoxShim.shimRemoveStream(window);
  18241. firefoxShim.shimSenderGetStats(window);
  18242. firefoxShim.shimReceiverGetStats(window);
  18243. firefoxShim.shimRTCDataChannel(window);
  18244. firefoxShim.shimAddTransceiver(window);
  18245. firefoxShim.shimCreateOffer(window);
  18246. firefoxShim.shimCreateAnswer(window);
  18247. commonShim.shimRTCIceCandidate(window);
  18248. commonShim.shimConnectionState(window);
  18249. commonShim.shimMaxMessageSize(window);
  18250. commonShim.shimSendThrowTypeError(window);
  18251. break;
  18252. case 'edge':
  18253. if (!edgeShim || !edgeShim.shimPeerConnection || !options.shimEdge) {
  18254. logging('MS edge shim is not included in this adapter release.');
  18255. return adapter;
  18256. }
  18257. logging('adapter.js shimming edge.');
  18258. // Export to the adapter global object visible in the browser.
  18259. adapter.browserShim = edgeShim;
  18260. edgeShim.shimGetUserMedia(window);
  18261. edgeShim.shimGetDisplayMedia(window);
  18262. edgeShim.shimPeerConnection(window);
  18263. edgeShim.shimReplaceTrack(window);
  18264. // the edge shim implements the full RTCIceCandidate object.
  18265. commonShim.shimMaxMessageSize(window);
  18266. commonShim.shimSendThrowTypeError(window);
  18267. break;
  18268. case 'safari':
  18269. if (!safariShim || !options.shimSafari) {
  18270. logging('Safari shim is not included in this adapter release.');
  18271. return adapter;
  18272. }
  18273. logging('adapter.js shimming safari.');
  18274. // Export to the adapter global object visible in the browser.
  18275. adapter.browserShim = safariShim;
  18276. safariShim.shimRTCIceServerUrls(window);
  18277. safariShim.shimCreateOfferLegacy(window);
  18278. safariShim.shimCallbacksAPI(window);
  18279. safariShim.shimLocalStreamsAPI(window);
  18280. safariShim.shimRemoteStreamsAPI(window);
  18281. safariShim.shimTrackEventTransceiver(window);
  18282. safariShim.shimGetUserMedia(window);
  18283. commonShim.shimRTCIceCandidate(window);
  18284. commonShim.shimMaxMessageSize(window);
  18285. commonShim.shimSendThrowTypeError(window);
  18286. commonShim.removeAllowExtmapMixed(window);
  18287. break;
  18288. default:
  18289. logging('Unsupported browser!');
  18290. break;
  18291. }
  18292. return adapter;
  18293. }
  18294. // Browser shims.
  18295. }, {
  18296. "./chrome/chrome_shim": 3,
  18297. "./common_shim": 6,
  18298. "./edge/edge_shim": 7,
  18299. "./firefox/firefox_shim": 11,
  18300. "./safari/safari_shim": 14,
  18301. "./utils": 15
  18302. }],
  18303. 3: [function (require, module, exports) {
  18304. Object.defineProperty(exports, "__esModule", {
  18305. value: true
  18306. });
  18307. exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
  18308. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  18309. return _typeof(obj);
  18310. } : function (obj) {
  18311. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  18312. };
  18313. var _getusermedia = require('./getusermedia');
  18314. Object.defineProperty(exports, 'shimGetUserMedia', {
  18315. enumerable: true,
  18316. get: function get() {
  18317. return _getusermedia.shimGetUserMedia;
  18318. }
  18319. });
  18320. var _getdisplaymedia = require('./getdisplaymedia');
  18321. Object.defineProperty(exports, 'shimGetDisplayMedia', {
  18322. enumerable: true,
  18323. get: function get() {
  18324. return _getdisplaymedia.shimGetDisplayMedia;
  18325. }
  18326. });
  18327. exports.shimMediaStream = shimMediaStream;
  18328. exports.shimOnTrack = shimOnTrack;
  18329. exports.shimGetSendersWithDtmf = shimGetSendersWithDtmf;
  18330. exports.shimGetStats = shimGetStats;
  18331. exports.shimSenderReceiverGetStats = shimSenderReceiverGetStats;
  18332. exports.shimAddTrackRemoveTrackWithNative = shimAddTrackRemoveTrackWithNative;
  18333. exports.shimAddTrackRemoveTrack = shimAddTrackRemoveTrack;
  18334. exports.shimPeerConnection = shimPeerConnection;
  18335. exports.fixNegotiationNeeded = fixNegotiationNeeded;
  18336. var _utils = require('../utils.js');
  18337. var utils = _interopRequireWildcard(_utils);
  18338. function _interopRequireWildcard(obj) {
  18339. if (obj && obj.__esModule) {
  18340. return obj;
  18341. } else {
  18342. var newObj = {};
  18343. if (obj != null) {
  18344. for (var key in obj) {
  18345. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  18346. }
  18347. }
  18348. newObj["default"] = obj;
  18349. return newObj;
  18350. }
  18351. }
  18352. function _defineProperty(obj, key, value) {
  18353. if (key in obj) {
  18354. Object.defineProperty(obj, key, {
  18355. value: value,
  18356. enumerable: true,
  18357. configurable: true,
  18358. writable: true
  18359. });
  18360. } else {
  18361. obj[key] = value;
  18362. }
  18363. return obj;
  18364. }
  18365. function shimMediaStream(window) {
  18366. window.MediaStream = window.MediaStream || window.webkitMediaStream;
  18367. }
  18368. function shimOnTrack(window) {
  18369. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && !('ontrack' in window.RTCPeerConnection.prototype)) {
  18370. Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {
  18371. get: function get() {
  18372. return this._ontrack;
  18373. },
  18374. set: function set(f) {
  18375. if (this._ontrack) {
  18376. this.removeEventListener('track', this._ontrack);
  18377. }
  18378. this.addEventListener('track', this._ontrack = f);
  18379. },
  18380. enumerable: true,
  18381. configurable: true
  18382. });
  18383. var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
  18384. window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
  18385. var _this = this;
  18386. if (!this._ontrackpoly) {
  18387. this._ontrackpoly = function (e) {
  18388. // onaddstream does not fire when a track is added to an existing
  18389. // stream. But stream.onaddtrack is implemented so we use that.
  18390. e.stream.addEventListener('addtrack', function (te) {
  18391. var receiver = void 0;
  18392. if (window.RTCPeerConnection.prototype.getReceivers) {
  18393. receiver = _this.getReceivers().find(function (r) {
  18394. return r.track && r.track.id === te.track.id;
  18395. });
  18396. } else {
  18397. receiver = {
  18398. track: te.track
  18399. };
  18400. }
  18401. var event = new Event('track');
  18402. event.track = te.track;
  18403. event.receiver = receiver;
  18404. event.transceiver = {
  18405. receiver: receiver
  18406. };
  18407. event.streams = [e.stream];
  18408. _this.dispatchEvent(event);
  18409. });
  18410. e.stream.getTracks().forEach(function (track) {
  18411. var receiver = void 0;
  18412. if (window.RTCPeerConnection.prototype.getReceivers) {
  18413. receiver = _this.getReceivers().find(function (r) {
  18414. return r.track && r.track.id === track.id;
  18415. });
  18416. } else {
  18417. receiver = {
  18418. track: track
  18419. };
  18420. }
  18421. var event = new Event('track');
  18422. event.track = track;
  18423. event.receiver = receiver;
  18424. event.transceiver = {
  18425. receiver: receiver
  18426. };
  18427. event.streams = [e.stream];
  18428. _this.dispatchEvent(event);
  18429. });
  18430. };
  18431. this.addEventListener('addstream', this._ontrackpoly);
  18432. }
  18433. return origSetRemoteDescription.apply(this, arguments);
  18434. };
  18435. } else {
  18436. // even if RTCRtpTransceiver is in window, it is only used and
  18437. // emitted in unified-plan. Unfortunately this means we need
  18438. // to unconditionally wrap the event.
  18439. utils.wrapPeerConnectionEvent(window, 'track', function (e) {
  18440. if (!e.transceiver) {
  18441. Object.defineProperty(e, 'transceiver', {
  18442. value: {
  18443. receiver: e.receiver
  18444. }
  18445. });
  18446. }
  18447. return e;
  18448. });
  18449. }
  18450. }
  18451. function shimGetSendersWithDtmf(window) {
  18452. // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.
  18453. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && !('getSenders' in window.RTCPeerConnection.prototype) && 'createDTMFSender' in window.RTCPeerConnection.prototype) {
  18454. var shimSenderWithDtmf = function shimSenderWithDtmf(pc, track) {
  18455. return {
  18456. track: track,
  18457. get dtmf() {
  18458. if (this._dtmf === undefined) {
  18459. if (track.kind === 'audio') {
  18460. this._dtmf = pc.createDTMFSender(track);
  18461. } else {
  18462. this._dtmf = null;
  18463. }
  18464. }
  18465. return this._dtmf;
  18466. },
  18467. _pc: pc
  18468. };
  18469. };
  18470. // augment addTrack when getSenders is not available.
  18471. if (!window.RTCPeerConnection.prototype.getSenders) {
  18472. window.RTCPeerConnection.prototype.getSenders = function getSenders() {
  18473. this._senders = this._senders || [];
  18474. return this._senders.slice(); // return a copy of the internal state.
  18475. };
  18476. var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  18477. window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
  18478. var sender = origAddTrack.apply(this, arguments);
  18479. if (!sender) {
  18480. sender = shimSenderWithDtmf(this, track);
  18481. this._senders.push(sender);
  18482. }
  18483. return sender;
  18484. };
  18485. var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
  18486. window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
  18487. origRemoveTrack.apply(this, arguments);
  18488. var idx = this._senders.indexOf(sender);
  18489. if (idx !== -1) {
  18490. this._senders.splice(idx, 1);
  18491. }
  18492. };
  18493. }
  18494. var origAddStream = window.RTCPeerConnection.prototype.addStream;
  18495. window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
  18496. var _this2 = this;
  18497. this._senders = this._senders || [];
  18498. origAddStream.apply(this, [stream]);
  18499. stream.getTracks().forEach(function (track) {
  18500. _this2._senders.push(shimSenderWithDtmf(_this2, track));
  18501. });
  18502. };
  18503. var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
  18504. window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
  18505. var _this3 = this;
  18506. this._senders = this._senders || [];
  18507. origRemoveStream.apply(this, [stream]);
  18508. stream.getTracks().forEach(function (track) {
  18509. var sender = _this3._senders.find(function (s) {
  18510. return s.track === track;
  18511. });
  18512. if (sender) {
  18513. // remove sender
  18514. _this3._senders.splice(_this3._senders.indexOf(sender), 1);
  18515. }
  18516. });
  18517. };
  18518. } else if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && 'getSenders' in window.RTCPeerConnection.prototype && 'createDTMFSender' in window.RTCPeerConnection.prototype && window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) {
  18519. var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
  18520. window.RTCPeerConnection.prototype.getSenders = function getSenders() {
  18521. var _this4 = this;
  18522. var senders = origGetSenders.apply(this, []);
  18523. senders.forEach(function (sender) {
  18524. return sender._pc = _this4;
  18525. });
  18526. return senders;
  18527. };
  18528. Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
  18529. get: function get() {
  18530. if (this._dtmf === undefined) {
  18531. if (this.track.kind === 'audio') {
  18532. this._dtmf = this._pc.createDTMFSender(this.track);
  18533. } else {
  18534. this._dtmf = null;
  18535. }
  18536. }
  18537. return this._dtmf;
  18538. }
  18539. });
  18540. }
  18541. }
  18542. function shimGetStats(window) {
  18543. if (!window.RTCPeerConnection) {
  18544. return;
  18545. }
  18546. var origGetStats = window.RTCPeerConnection.prototype.getStats;
  18547. window.RTCPeerConnection.prototype.getStats = function getStats() {
  18548. var _this5 = this;
  18549. var _arguments = Array.prototype.slice.call(arguments),
  18550. selector = _arguments[0],
  18551. onSucc = _arguments[1],
  18552. onErr = _arguments[2];
  18553. // If selector is a function then we are in the old style stats so just
  18554. // pass back the original getStats format to avoid breaking old users.
  18555. if (arguments.length > 0 && typeof selector === 'function') {
  18556. return origGetStats.apply(this, arguments);
  18557. }
  18558. // When spec-style getStats is supported, return those when called with
  18559. // either no arguments or the selector argument is null.
  18560. if (origGetStats.length === 0 && (arguments.length === 0 || typeof selector !== 'function')) {
  18561. return origGetStats.apply(this, []);
  18562. }
  18563. var fixChromeStats_ = function fixChromeStats_(response) {
  18564. var standardReport = {};
  18565. var reports = response.result();
  18566. reports.forEach(function (report) {
  18567. var standardStats = {
  18568. id: report.id,
  18569. timestamp: report.timestamp,
  18570. type: {
  18571. localcandidate: 'local-candidate',
  18572. remotecandidate: 'remote-candidate'
  18573. }[report.type] || report.type
  18574. };
  18575. report.names().forEach(function (name) {
  18576. standardStats[name] = report.stat(name);
  18577. });
  18578. standardReport[standardStats.id] = standardStats;
  18579. });
  18580. return standardReport;
  18581. };
  18582. // shim getStats with maplike support
  18583. var makeMapStats = function makeMapStats(stats) {
  18584. return new Map(Object.keys(stats).map(function (key) {
  18585. return [key, stats[key]];
  18586. }));
  18587. };
  18588. if (arguments.length >= 2) {
  18589. var successCallbackWrapper_ = function successCallbackWrapper_(response) {
  18590. onSucc(makeMapStats(fixChromeStats_(response)));
  18591. };
  18592. return origGetStats.apply(this, [successCallbackWrapper_, selector]);
  18593. }
  18594. // promise-support
  18595. return new Promise(function (resolve, reject) {
  18596. origGetStats.apply(_this5, [function (response) {
  18597. resolve(makeMapStats(fixChromeStats_(response)));
  18598. }, reject]);
  18599. }).then(onSucc, onErr);
  18600. };
  18601. }
  18602. function shimSenderReceiverGetStats(window) {
  18603. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender && window.RTCRtpReceiver)) {
  18604. return;
  18605. }
  18606. // shim sender stats.
  18607. if (!('getStats' in window.RTCRtpSender.prototype)) {
  18608. var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
  18609. if (origGetSenders) {
  18610. window.RTCPeerConnection.prototype.getSenders = function getSenders() {
  18611. var _this6 = this;
  18612. var senders = origGetSenders.apply(this, []);
  18613. senders.forEach(function (sender) {
  18614. return sender._pc = _this6;
  18615. });
  18616. return senders;
  18617. };
  18618. }
  18619. var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  18620. if (origAddTrack) {
  18621. window.RTCPeerConnection.prototype.addTrack = function addTrack() {
  18622. var sender = origAddTrack.apply(this, arguments);
  18623. sender._pc = this;
  18624. return sender;
  18625. };
  18626. }
  18627. window.RTCRtpSender.prototype.getStats = function getStats() {
  18628. var sender = this;
  18629. return this._pc.getStats().then(function (result) {
  18630. return (
  18631. /* Note: this will include stats of all senders that
  18632. * send a track with the same id as sender.track as
  18633. * it is not possible to identify the RTCRtpSender.
  18634. */
  18635. utils.filterStats(result, sender.track, true)
  18636. );
  18637. });
  18638. };
  18639. }
  18640. // shim receiver stats.
  18641. if (!('getStats' in window.RTCRtpReceiver.prototype)) {
  18642. var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
  18643. if (origGetReceivers) {
  18644. window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {
  18645. var _this7 = this;
  18646. var receivers = origGetReceivers.apply(this, []);
  18647. receivers.forEach(function (receiver) {
  18648. return receiver._pc = _this7;
  18649. });
  18650. return receivers;
  18651. };
  18652. }
  18653. utils.wrapPeerConnectionEvent(window, 'track', function (e) {
  18654. e.receiver._pc = e.srcElement;
  18655. return e;
  18656. });
  18657. window.RTCRtpReceiver.prototype.getStats = function getStats() {
  18658. var receiver = this;
  18659. return this._pc.getStats().then(function (result) {
  18660. return utils.filterStats(result, receiver.track, false);
  18661. });
  18662. };
  18663. }
  18664. if (!('getStats' in window.RTCRtpSender.prototype && 'getStats' in window.RTCRtpReceiver.prototype)) {
  18665. return;
  18666. }
  18667. // shim RTCPeerConnection.getStats(track).
  18668. var origGetStats = window.RTCPeerConnection.prototype.getStats;
  18669. window.RTCPeerConnection.prototype.getStats = function getStats() {
  18670. if (arguments.length > 0 && arguments[0] instanceof window.MediaStreamTrack) {
  18671. var track = arguments[0];
  18672. var sender = void 0;
  18673. var receiver = void 0;
  18674. var err = void 0;
  18675. this.getSenders().forEach(function (s) {
  18676. if (s.track === track) {
  18677. if (sender) {
  18678. err = true;
  18679. } else {
  18680. sender = s;
  18681. }
  18682. }
  18683. });
  18684. this.getReceivers().forEach(function (r) {
  18685. if (r.track === track) {
  18686. if (receiver) {
  18687. err = true;
  18688. } else {
  18689. receiver = r;
  18690. }
  18691. }
  18692. return r.track === track;
  18693. });
  18694. if (err || sender && receiver) {
  18695. return Promise.reject(new DOMException('There are more than one sender or receiver for the track.', 'InvalidAccessError'));
  18696. } else if (sender) {
  18697. return sender.getStats();
  18698. } else if (receiver) {
  18699. return receiver.getStats();
  18700. }
  18701. return Promise.reject(new DOMException('There is no sender or receiver for the track.', 'InvalidAccessError'));
  18702. }
  18703. return origGetStats.apply(this, arguments);
  18704. };
  18705. }
  18706. function shimAddTrackRemoveTrackWithNative(window) {
  18707. // shim addTrack/removeTrack with native variants in order to make
  18708. // the interactions with legacy getLocalStreams behave as in other browsers.
  18709. // Keeps a mapping stream.id => [stream, rtpsenders...]
  18710. window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
  18711. var _this8 = this;
  18712. this._shimmedLocalStreams = this._shimmedLocalStreams || {};
  18713. return Object.keys(this._shimmedLocalStreams).map(function (streamId) {
  18714. return _this8._shimmedLocalStreams[streamId][0];
  18715. });
  18716. };
  18717. var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  18718. window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
  18719. if (!stream) {
  18720. return origAddTrack.apply(this, arguments);
  18721. }
  18722. this._shimmedLocalStreams = this._shimmedLocalStreams || {};
  18723. var sender = origAddTrack.apply(this, arguments);
  18724. if (!this._shimmedLocalStreams[stream.id]) {
  18725. this._shimmedLocalStreams[stream.id] = [stream, sender];
  18726. } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {
  18727. this._shimmedLocalStreams[stream.id].push(sender);
  18728. }
  18729. return sender;
  18730. };
  18731. var origAddStream = window.RTCPeerConnection.prototype.addStream;
  18732. window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
  18733. var _this9 = this;
  18734. this._shimmedLocalStreams = this._shimmedLocalStreams || {};
  18735. stream.getTracks().forEach(function (track) {
  18736. var alreadyExists = _this9.getSenders().find(function (s) {
  18737. return s.track === track;
  18738. });
  18739. if (alreadyExists) {
  18740. throw new DOMException('Track already exists.', 'InvalidAccessError');
  18741. }
  18742. });
  18743. var existingSenders = this.getSenders();
  18744. origAddStream.apply(this, arguments);
  18745. var newSenders = this.getSenders().filter(function (newSender) {
  18746. return existingSenders.indexOf(newSender) === -1;
  18747. });
  18748. this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);
  18749. };
  18750. var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
  18751. window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
  18752. this._shimmedLocalStreams = this._shimmedLocalStreams || {};
  18753. delete this._shimmedLocalStreams[stream.id];
  18754. return origRemoveStream.apply(this, arguments);
  18755. };
  18756. var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
  18757. window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
  18758. var _this10 = this;
  18759. this._shimmedLocalStreams = this._shimmedLocalStreams || {};
  18760. if (sender) {
  18761. Object.keys(this._shimmedLocalStreams).forEach(function (streamId) {
  18762. var idx = _this10._shimmedLocalStreams[streamId].indexOf(sender);
  18763. if (idx !== -1) {
  18764. _this10._shimmedLocalStreams[streamId].splice(idx, 1);
  18765. }
  18766. if (_this10._shimmedLocalStreams[streamId].length === 1) {
  18767. delete _this10._shimmedLocalStreams[streamId];
  18768. }
  18769. });
  18770. }
  18771. return origRemoveTrack.apply(this, arguments);
  18772. };
  18773. }
  18774. function shimAddTrackRemoveTrack(window) {
  18775. if (!window.RTCPeerConnection) {
  18776. return;
  18777. }
  18778. var browserDetails = utils.detectBrowser(window);
  18779. // shim addTrack and removeTrack.
  18780. if (window.RTCPeerConnection.prototype.addTrack && browserDetails.version >= 65) {
  18781. return shimAddTrackRemoveTrackWithNative(window);
  18782. }
  18783. // also shim pc.getLocalStreams when addTrack is shimmed
  18784. // to return the original streams.
  18785. var origGetLocalStreams = window.RTCPeerConnection.prototype.getLocalStreams;
  18786. window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
  18787. var _this11 = this;
  18788. var nativeStreams = origGetLocalStreams.apply(this);
  18789. this._reverseStreams = this._reverseStreams || {};
  18790. return nativeStreams.map(function (stream) {
  18791. return _this11._reverseStreams[stream.id];
  18792. });
  18793. };
  18794. var origAddStream = window.RTCPeerConnection.prototype.addStream;
  18795. window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
  18796. var _this12 = this;
  18797. this._streams = this._streams || {};
  18798. this._reverseStreams = this._reverseStreams || {};
  18799. stream.getTracks().forEach(function (track) {
  18800. var alreadyExists = _this12.getSenders().find(function (s) {
  18801. return s.track === track;
  18802. });
  18803. if (alreadyExists) {
  18804. throw new DOMException('Track already exists.', 'InvalidAccessError');
  18805. }
  18806. });
  18807. // Add identity mapping for consistency with addTrack.
  18808. // Unless this is being used with a stream from addTrack.
  18809. if (!this._reverseStreams[stream.id]) {
  18810. var newStream = new window.MediaStream(stream.getTracks());
  18811. this._streams[stream.id] = newStream;
  18812. this._reverseStreams[newStream.id] = stream;
  18813. stream = newStream;
  18814. }
  18815. origAddStream.apply(this, [stream]);
  18816. };
  18817. var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
  18818. window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
  18819. this._streams = this._streams || {};
  18820. this._reverseStreams = this._reverseStreams || {};
  18821. origRemoveStream.apply(this, [this._streams[stream.id] || stream]);
  18822. delete this._reverseStreams[this._streams[stream.id] ? this._streams[stream.id].id : stream.id];
  18823. delete this._streams[stream.id];
  18824. };
  18825. window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
  18826. var _this13 = this;
  18827. if (this.signalingState === 'closed') {
  18828. throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError');
  18829. }
  18830. var streams = [].slice.call(arguments, 1);
  18831. if (streams.length !== 1 || !streams[0].getTracks().find(function (t) {
  18832. return t === track;
  18833. })) {
  18834. // this is not fully correct but all we can manage without
  18835. // [[associated MediaStreams]] internal slot.
  18836. throw new DOMException('The adapter.js addTrack polyfill only supports a single ' + ' stream which is associated with the specified track.', 'NotSupportedError');
  18837. }
  18838. var alreadyExists = this.getSenders().find(function (s) {
  18839. return s.track === track;
  18840. });
  18841. if (alreadyExists) {
  18842. throw new DOMException('Track already exists.', 'InvalidAccessError');
  18843. }
  18844. this._streams = this._streams || {};
  18845. this._reverseStreams = this._reverseStreams || {};
  18846. var oldStream = this._streams[stream.id];
  18847. if (oldStream) {
  18848. // this is using odd Chrome behaviour, use with caution:
  18849. // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815
  18850. // Note: we rely on the high-level addTrack/dtmf shim to
  18851. // create the sender with a dtmf sender.
  18852. oldStream.addTrack(track);
  18853. // Trigger ONN async.
  18854. Promise.resolve().then(function () {
  18855. _this13.dispatchEvent(new Event('negotiationneeded'));
  18856. });
  18857. } else {
  18858. var newStream = new window.MediaStream([track]);
  18859. this._streams[stream.id] = newStream;
  18860. this._reverseStreams[newStream.id] = stream;
  18861. this.addStream(newStream);
  18862. }
  18863. return this.getSenders().find(function (s) {
  18864. return s.track === track;
  18865. });
  18866. };
  18867. // replace the internal stream id with the external one and
  18868. // vice versa.
  18869. function replaceInternalStreamId(pc, description) {
  18870. var sdp = description.sdp;
  18871. Object.keys(pc._reverseStreams || []).forEach(function (internalId) {
  18872. var externalStream = pc._reverseStreams[internalId];
  18873. var internalStream = pc._streams[externalStream.id];
  18874. sdp = sdp.replace(new RegExp(internalStream.id, 'g'), externalStream.id);
  18875. });
  18876. return new RTCSessionDescription({
  18877. type: description.type,
  18878. sdp: sdp
  18879. });
  18880. }
  18881. function replaceExternalStreamId(pc, description) {
  18882. var sdp = description.sdp;
  18883. Object.keys(pc._reverseStreams || []).forEach(function (internalId) {
  18884. var externalStream = pc._reverseStreams[internalId];
  18885. var internalStream = pc._streams[externalStream.id];
  18886. sdp = sdp.replace(new RegExp(externalStream.id, 'g'), internalStream.id);
  18887. });
  18888. return new RTCSessionDescription({
  18889. type: description.type,
  18890. sdp: sdp
  18891. });
  18892. }
  18893. ['createOffer', 'createAnswer'].forEach(function (method) {
  18894. var nativeMethod = window.RTCPeerConnection.prototype[method];
  18895. var methodObj = _defineProperty({}, method, function () {
  18896. var _this14 = this;
  18897. var args = arguments;
  18898. var isLegacyCall = arguments.length && typeof arguments[0] === 'function';
  18899. if (isLegacyCall) {
  18900. return nativeMethod.apply(this, [function (description) {
  18901. var desc = replaceInternalStreamId(_this14, description);
  18902. args[0].apply(null, [desc]);
  18903. }, function (err) {
  18904. if (args[1]) {
  18905. args[1].apply(null, err);
  18906. }
  18907. }, arguments[2]]);
  18908. }
  18909. return nativeMethod.apply(this, arguments).then(function (description) {
  18910. return replaceInternalStreamId(_this14, description);
  18911. });
  18912. });
  18913. window.RTCPeerConnection.prototype[method] = methodObj[method];
  18914. });
  18915. var origSetLocalDescription = window.RTCPeerConnection.prototype.setLocalDescription;
  18916. window.RTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {
  18917. if (!arguments.length || !arguments[0].type) {
  18918. return origSetLocalDescription.apply(this, arguments);
  18919. }
  18920. arguments[0] = replaceExternalStreamId(this, arguments[0]);
  18921. return origSetLocalDescription.apply(this, arguments);
  18922. };
  18923. // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier
  18924. var origLocalDescription = Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype, 'localDescription');
  18925. Object.defineProperty(window.RTCPeerConnection.prototype, 'localDescription', {
  18926. get: function get() {
  18927. var description = origLocalDescription.get.apply(this);
  18928. if (description.type === '') {
  18929. return description;
  18930. }
  18931. return replaceInternalStreamId(this, description);
  18932. }
  18933. });
  18934. window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
  18935. var _this15 = this;
  18936. if (this.signalingState === 'closed') {
  18937. throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError');
  18938. }
  18939. // We can not yet check for sender instanceof RTCRtpSender
  18940. // since we shim RTPSender. So we check if sender._pc is set.
  18941. if (!sender._pc) {
  18942. throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.', 'TypeError');
  18943. }
  18944. var isLocal = sender._pc === this;
  18945. if (!isLocal) {
  18946. throw new DOMException('Sender was not created by this connection.', 'InvalidAccessError');
  18947. }
  18948. // Search for the native stream the senders track belongs to.
  18949. this._streams = this._streams || {};
  18950. var stream = void 0;
  18951. Object.keys(this._streams).forEach(function (streamid) {
  18952. var hasTrack = _this15._streams[streamid].getTracks().find(function (track) {
  18953. return sender.track === track;
  18954. });
  18955. if (hasTrack) {
  18956. stream = _this15._streams[streamid];
  18957. }
  18958. });
  18959. if (stream) {
  18960. if (stream.getTracks().length === 1) {
  18961. // if this is the last track of the stream, remove the stream. This
  18962. // takes care of any shimmed _senders.
  18963. this.removeStream(this._reverseStreams[stream.id]);
  18964. } else {
  18965. // relying on the same odd chrome behaviour as above.
  18966. stream.removeTrack(sender.track);
  18967. }
  18968. this.dispatchEvent(new Event('negotiationneeded'));
  18969. }
  18970. };
  18971. }
  18972. function shimPeerConnection(window) {
  18973. var browserDetails = utils.detectBrowser(window);
  18974. if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {
  18975. // very basic support for old versions.
  18976. window.RTCPeerConnection = window.webkitRTCPeerConnection;
  18977. }
  18978. if (!window.RTCPeerConnection) {
  18979. return;
  18980. }
  18981. // shim implicit creation of RTCSessionDescription/RTCIceCandidate
  18982. if (browserDetails.version < 53) {
  18983. ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
  18984. var nativeMethod = window.RTCPeerConnection.prototype[method];
  18985. var methodObj = _defineProperty({}, method, function () {
  18986. arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);
  18987. return nativeMethod.apply(this, arguments);
  18988. });
  18989. window.RTCPeerConnection.prototype[method] = methodObj[method];
  18990. });
  18991. }
  18992. // support for addIceCandidate(null or undefined)
  18993. var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate;
  18994. window.RTCPeerConnection.prototype.addIceCandidate = function addIceCandidate() {
  18995. if (!arguments[0]) {
  18996. if (arguments[1]) {
  18997. arguments[1].apply(null);
  18998. }
  18999. return Promise.resolve();
  19000. }
  19001. // Firefox 68+ emits and processes {candidate: "", ...}, ignore
  19002. // in older versions. Native support planned for Chrome M77.
  19003. if (browserDetails.version < 78 && arguments[0] && arguments[0].candidate === '') {
  19004. return Promise.resolve();
  19005. }
  19006. return nativeAddIceCandidate.apply(this, arguments);
  19007. };
  19008. }
  19009. function fixNegotiationNeeded(window) {
  19010. utils.wrapPeerConnectionEvent(window, 'negotiationneeded', function (e) {
  19011. var pc = e.target;
  19012. if (pc.signalingState !== 'stable') {
  19013. return;
  19014. }
  19015. return e;
  19016. });
  19017. }
  19018. }, {
  19019. "../utils.js": 15,
  19020. "./getdisplaymedia": 4,
  19021. "./getusermedia": 5
  19022. }],
  19023. 4: [function (require, module, exports) {
  19024. Object.defineProperty(exports, "__esModule", {
  19025. value: true
  19026. });
  19027. exports.shimGetDisplayMedia = shimGetDisplayMedia;
  19028. function shimGetDisplayMedia(window, getSourceId) {
  19029. if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
  19030. return;
  19031. }
  19032. if (!window.navigator.mediaDevices) {
  19033. return;
  19034. }
  19035. // getSourceId is a function that returns a promise resolving with
  19036. // the sourceId of the screen/window/tab to be shared.
  19037. if (typeof getSourceId !== 'function') {
  19038. console.error('shimGetDisplayMedia: getSourceId argument is not ' + 'a function');
  19039. return;
  19040. }
  19041. window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
  19042. return getSourceId(constraints).then(function (sourceId) {
  19043. var widthSpecified = constraints.video && constraints.video.width;
  19044. var heightSpecified = constraints.video && constraints.video.height;
  19045. var frameRateSpecified = constraints.video && constraints.video.frameRate;
  19046. constraints.video = {
  19047. mandatory: {
  19048. chromeMediaSource: 'desktop',
  19049. chromeMediaSourceId: sourceId,
  19050. maxFrameRate: frameRateSpecified || 3
  19051. }
  19052. };
  19053. if (widthSpecified) {
  19054. constraints.video.mandatory.maxWidth = widthSpecified;
  19055. }
  19056. if (heightSpecified) {
  19057. constraints.video.mandatory.maxHeight = heightSpecified;
  19058. }
  19059. return window.navigator.mediaDevices.getUserMedia(constraints);
  19060. });
  19061. };
  19062. }
  19063. }, {}],
  19064. 5: [function (require, module, exports) {
  19065. Object.defineProperty(exports, "__esModule", {
  19066. value: true
  19067. });
  19068. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  19069. return _typeof(obj);
  19070. } : function (obj) {
  19071. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  19072. };
  19073. exports.shimGetUserMedia = shimGetUserMedia;
  19074. var _utils = require('../utils.js');
  19075. var utils = _interopRequireWildcard(_utils);
  19076. function _interopRequireWildcard(obj) {
  19077. if (obj && obj.__esModule) {
  19078. return obj;
  19079. } else {
  19080. var newObj = {};
  19081. if (obj != null) {
  19082. for (var key in obj) {
  19083. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19084. }
  19085. }
  19086. newObj["default"] = obj;
  19087. return newObj;
  19088. }
  19089. }
  19090. var logging = utils.log;
  19091. function shimGetUserMedia(window) {
  19092. var navigator = window && window.navigator;
  19093. if (!navigator.mediaDevices) {
  19094. return;
  19095. }
  19096. var browserDetails = utils.detectBrowser(window);
  19097. var constraintsToChrome_ = function constraintsToChrome_(c) {
  19098. if ((typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) !== 'object' || c.mandatory || c.optional) {
  19099. return c;
  19100. }
  19101. var cc = {};
  19102. Object.keys(c).forEach(function (key) {
  19103. if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
  19104. return;
  19105. }
  19106. var r = _typeof$1(c[key]) === 'object' ? c[key] : {
  19107. ideal: c[key]
  19108. };
  19109. if (r.exact !== undefined && typeof r.exact === 'number') {
  19110. r.min = r.max = r.exact;
  19111. }
  19112. var oldname_ = function oldname_(prefix, name) {
  19113. if (prefix) {
  19114. return prefix + name.charAt(0).toUpperCase() + name.slice(1);
  19115. }
  19116. return name === 'deviceId' ? 'sourceId' : name;
  19117. };
  19118. if (r.ideal !== undefined) {
  19119. cc.optional = cc.optional || [];
  19120. var oc = {};
  19121. if (typeof r.ideal === 'number') {
  19122. oc[oldname_('min', key)] = r.ideal;
  19123. cc.optional.push(oc);
  19124. oc = {};
  19125. oc[oldname_('max', key)] = r.ideal;
  19126. cc.optional.push(oc);
  19127. } else {
  19128. oc[oldname_('', key)] = r.ideal;
  19129. cc.optional.push(oc);
  19130. }
  19131. }
  19132. if (r.exact !== undefined && typeof r.exact !== 'number') {
  19133. cc.mandatory = cc.mandatory || {};
  19134. cc.mandatory[oldname_('', key)] = r.exact;
  19135. } else {
  19136. ['min', 'max'].forEach(function (mix) {
  19137. if (r[mix] !== undefined) {
  19138. cc.mandatory = cc.mandatory || {};
  19139. cc.mandatory[oldname_(mix, key)] = r[mix];
  19140. }
  19141. });
  19142. }
  19143. });
  19144. if (c.advanced) {
  19145. cc.optional = (cc.optional || []).concat(c.advanced);
  19146. }
  19147. return cc;
  19148. };
  19149. var shimConstraints_ = function shimConstraints_(constraints, func) {
  19150. if (browserDetails.version >= 61) {
  19151. return func(constraints);
  19152. }
  19153. constraints = JSON.parse(JSON.stringify(constraints));
  19154. if (constraints && _typeof$1(constraints.audio) === 'object') {
  19155. var remap = function remap(obj, a, b) {
  19156. if (a in obj && !(b in obj)) {
  19157. obj[b] = obj[a];
  19158. delete obj[a];
  19159. }
  19160. };
  19161. constraints = JSON.parse(JSON.stringify(constraints));
  19162. remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');
  19163. remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');
  19164. constraints.audio = constraintsToChrome_(constraints.audio);
  19165. }
  19166. if (constraints && _typeof$1(constraints.video) === 'object') {
  19167. // Shim facingMode for mobile & surface pro.
  19168. var face = constraints.video.facingMode;
  19169. face = face && ((typeof face === 'undefined' ? 'undefined' : _typeof$1(face)) === 'object' ? face : {
  19170. ideal: face
  19171. });
  19172. var getSupportedFacingModeLies = browserDetails.version < 66;
  19173. if (face && (face.exact === 'user' || face.exact === 'environment' || face.ideal === 'user' || face.ideal === 'environment') && !(navigator.mediaDevices.getSupportedConstraints && navigator.mediaDevices.getSupportedConstraints().facingMode && !getSupportedFacingModeLies)) {
  19174. delete constraints.video.facingMode;
  19175. var matches = void 0;
  19176. if (face.exact === 'environment' || face.ideal === 'environment') {
  19177. matches = ['back', 'rear'];
  19178. } else if (face.exact === 'user' || face.ideal === 'user') {
  19179. matches = ['front'];
  19180. }
  19181. if (matches) {
  19182. // Look for matches in label, or use last cam for back (typical).
  19183. return navigator.mediaDevices.enumerateDevices().then(function (devices) {
  19184. devices = devices.filter(function (d) {
  19185. return d.kind === 'videoinput';
  19186. });
  19187. var dev = devices.find(function (d) {
  19188. return matches.some(function (match) {
  19189. return d.label.toLowerCase().includes(match);
  19190. });
  19191. });
  19192. if (!dev && devices.length && matches.includes('back')) {
  19193. dev = devices[devices.length - 1]; // more likely the back cam
  19194. }
  19195. if (dev) {
  19196. constraints.video.deviceId = face.exact ? {
  19197. exact: dev.deviceId
  19198. } : {
  19199. ideal: dev.deviceId
  19200. };
  19201. }
  19202. constraints.video = constraintsToChrome_(constraints.video);
  19203. logging('chrome: ' + JSON.stringify(constraints));
  19204. return func(constraints);
  19205. });
  19206. }
  19207. }
  19208. constraints.video = constraintsToChrome_(constraints.video);
  19209. }
  19210. logging('chrome: ' + JSON.stringify(constraints));
  19211. return func(constraints);
  19212. };
  19213. var shimError_ = function shimError_(e) {
  19214. if (browserDetails.version >= 64) {
  19215. return e;
  19216. }
  19217. return {
  19218. name: {
  19219. PermissionDeniedError: 'NotAllowedError',
  19220. PermissionDismissedError: 'NotAllowedError',
  19221. InvalidStateError: 'NotAllowedError',
  19222. DevicesNotFoundError: 'NotFoundError',
  19223. ConstraintNotSatisfiedError: 'OverconstrainedError',
  19224. TrackStartError: 'NotReadableError',
  19225. MediaDeviceFailedDueToShutdown: 'NotAllowedError',
  19226. MediaDeviceKillSwitchOn: 'NotAllowedError',
  19227. TabCaptureError: 'AbortError',
  19228. ScreenCaptureError: 'AbortError',
  19229. DeviceCaptureError: 'AbortError'
  19230. }[e.name] || e.name,
  19231. message: e.message,
  19232. constraint: e.constraint || e.constraintName,
  19233. toString: function toString() {
  19234. return this.name + (this.message && ': ') + this.message;
  19235. }
  19236. };
  19237. };
  19238. var getUserMedia_ = function getUserMedia_(constraints, onSuccess, onError) {
  19239. shimConstraints_(constraints, function (c) {
  19240. navigator.webkitGetUserMedia(c, onSuccess, function (e) {
  19241. if (onError) {
  19242. onError(shimError_(e));
  19243. }
  19244. });
  19245. });
  19246. };
  19247. navigator.getUserMedia = getUserMedia_.bind(navigator);
  19248. // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia
  19249. // function which returns a Promise, it does not accept spec-style
  19250. // constraints.
  19251. if (navigator.mediaDevices.getUserMedia) {
  19252. var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
  19253. navigator.mediaDevices.getUserMedia = function (cs) {
  19254. return shimConstraints_(cs, function (c) {
  19255. return origGetUserMedia(c).then(function (stream) {
  19256. if (c.audio && !stream.getAudioTracks().length || c.video && !stream.getVideoTracks().length) {
  19257. stream.getTracks().forEach(function (track) {
  19258. track.stop();
  19259. });
  19260. throw new DOMException('', 'NotFoundError');
  19261. }
  19262. return stream;
  19263. }, function (e) {
  19264. return Promise.reject(shimError_(e));
  19265. });
  19266. });
  19267. };
  19268. }
  19269. }
  19270. }, {
  19271. "../utils.js": 15
  19272. }],
  19273. 6: [function (require, module, exports) {
  19274. Object.defineProperty(exports, "__esModule", {
  19275. value: true
  19276. });
  19277. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  19278. return _typeof(obj);
  19279. } : function (obj) {
  19280. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  19281. };
  19282. exports.shimRTCIceCandidate = shimRTCIceCandidate;
  19283. exports.shimMaxMessageSize = shimMaxMessageSize;
  19284. exports.shimSendThrowTypeError = shimSendThrowTypeError;
  19285. exports.shimConnectionState = shimConnectionState;
  19286. exports.removeAllowExtmapMixed = removeAllowExtmapMixed;
  19287. var _sdp = require('sdp');
  19288. var _sdp2 = _interopRequireDefault(_sdp);
  19289. var _utils = require('./utils');
  19290. var utils = _interopRequireWildcard(_utils);
  19291. function _interopRequireWildcard(obj) {
  19292. if (obj && obj.__esModule) {
  19293. return obj;
  19294. } else {
  19295. var newObj = {};
  19296. if (obj != null) {
  19297. for (var key in obj) {
  19298. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19299. }
  19300. }
  19301. newObj["default"] = obj;
  19302. return newObj;
  19303. }
  19304. }
  19305. function _interopRequireDefault(obj) {
  19306. return obj && obj.__esModule ? obj : {
  19307. "default": obj
  19308. };
  19309. }
  19310. function shimRTCIceCandidate(window) {
  19311. // foundation is arbitrarily chosen as an indicator for full support for
  19312. // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
  19313. if (!window.RTCIceCandidate || window.RTCIceCandidate && 'foundation' in window.RTCIceCandidate.prototype) {
  19314. return;
  19315. }
  19316. var NativeRTCIceCandidate = window.RTCIceCandidate;
  19317. window.RTCIceCandidate = function RTCIceCandidate(args) {
  19318. // Remove the a= which shouldn't be part of the candidate string.
  19319. if ((typeof args === 'undefined' ? 'undefined' : _typeof$1(args)) === 'object' && args.candidate && args.candidate.indexOf('a=') === 0) {
  19320. args = JSON.parse(JSON.stringify(args));
  19321. args.candidate = args.candidate.substr(2);
  19322. }
  19323. if (args.candidate && args.candidate.length) {
  19324. // Augment the native candidate with the parsed fields.
  19325. var nativeCandidate = new NativeRTCIceCandidate(args);
  19326. var parsedCandidate = _sdp2["default"].parseCandidate(args.candidate);
  19327. var augmentedCandidate = Object.assign(nativeCandidate, parsedCandidate);
  19328. // Add a serializer that does not serialize the extra attributes.
  19329. augmentedCandidate.toJSON = function toJSON() {
  19330. return {
  19331. candidate: augmentedCandidate.candidate,
  19332. sdpMid: augmentedCandidate.sdpMid,
  19333. sdpMLineIndex: augmentedCandidate.sdpMLineIndex,
  19334. usernameFragment: augmentedCandidate.usernameFragment
  19335. };
  19336. };
  19337. return augmentedCandidate;
  19338. }
  19339. return new NativeRTCIceCandidate(args);
  19340. };
  19341. window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;
  19342. // Hook up the augmented candidate in onicecandidate and
  19343. // addEventListener('icecandidate', ...)
  19344. utils.wrapPeerConnectionEvent(window, 'icecandidate', function (e) {
  19345. if (e.candidate) {
  19346. Object.defineProperty(e, 'candidate', {
  19347. value: new window.RTCIceCandidate(e.candidate),
  19348. writable: 'false'
  19349. });
  19350. }
  19351. return e;
  19352. });
  19353. }
  19354. function shimMaxMessageSize(window) {
  19355. if (!window.RTCPeerConnection) {
  19356. return;
  19357. }
  19358. var browserDetails = utils.detectBrowser(window);
  19359. if (!('sctp' in window.RTCPeerConnection.prototype)) {
  19360. Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {
  19361. get: function get() {
  19362. return typeof this._sctp === 'undefined' ? null : this._sctp;
  19363. }
  19364. });
  19365. }
  19366. var sctpInDescription = function sctpInDescription(description) {
  19367. if (!description || !description.sdp) {
  19368. return false;
  19369. }
  19370. var sections = _sdp2["default"].splitSections(description.sdp);
  19371. sections.shift();
  19372. return sections.some(function (mediaSection) {
  19373. var mLine = _sdp2["default"].parseMLine(mediaSection);
  19374. return mLine && mLine.kind === 'application' && mLine.protocol.indexOf('SCTP') !== -1;
  19375. });
  19376. };
  19377. var getRemoteFirefoxVersion = function getRemoteFirefoxVersion(description) {
  19378. // TODO: Is there a better solution for detecting Firefox?
  19379. var match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
  19380. if (match === null || match.length < 2) {
  19381. return -1;
  19382. }
  19383. var version = parseInt(match[1], 10);
  19384. // Test for NaN (yes, this is ugly)
  19385. return version !== version ? -1 : version;
  19386. };
  19387. var getCanSendMaxMessageSize = function getCanSendMaxMessageSize(remoteIsFirefox) {
  19388. // Every implementation we know can send at least 64 KiB.
  19389. // Note: Although Chrome is technically able to send up to 256 KiB, the
  19390. // data does not reach the other peer reliably.
  19391. // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419
  19392. var canSendMaxMessageSize = 65536;
  19393. if (browserDetails.browser === 'firefox') {
  19394. if (browserDetails.version < 57) {
  19395. if (remoteIsFirefox === -1) {
  19396. // FF < 57 will send in 16 KiB chunks using the deprecated PPID
  19397. // fragmentation.
  19398. canSendMaxMessageSize = 16384;
  19399. } else {
  19400. // However, other FF (and RAWRTC) can reassemble PPID-fragmented
  19401. // messages. Thus, supporting ~2 GiB when sending.
  19402. canSendMaxMessageSize = 2147483637;
  19403. }
  19404. } else if (browserDetails.version < 60) {
  19405. // Currently, all FF >= 57 will reset the remote maximum message size
  19406. // to the default value when a data channel is created at a later
  19407. // stage. :(
  19408. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831
  19409. canSendMaxMessageSize = browserDetails.version === 57 ? 65535 : 65536;
  19410. } else {
  19411. // FF >= 60 supports sending ~2 GiB
  19412. canSendMaxMessageSize = 2147483637;
  19413. }
  19414. }
  19415. return canSendMaxMessageSize;
  19416. };
  19417. var getMaxMessageSize = function getMaxMessageSize(description, remoteIsFirefox) {
  19418. // Note: 65536 bytes is the default value from the SDP spec. Also,
  19419. // every implementation we know supports receiving 65536 bytes.
  19420. var maxMessageSize = 65536;
  19421. // FF 57 has a slightly incorrect default remote max message size, so
  19422. // we need to adjust it here to avoid a failure when sending.
  19423. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697
  19424. if (browserDetails.browser === 'firefox' && browserDetails.version === 57) {
  19425. maxMessageSize = 65535;
  19426. }
  19427. var match = _sdp2["default"].matchPrefix(description.sdp, 'a=max-message-size:');
  19428. if (match.length > 0) {
  19429. maxMessageSize = parseInt(match[0].substr(19), 10);
  19430. } else if (browserDetails.browser === 'firefox' && remoteIsFirefox !== -1) {
  19431. // If the maximum message size is not present in the remote SDP and
  19432. // both local and remote are Firefox, the remote peer can receive
  19433. // ~2 GiB.
  19434. maxMessageSize = 2147483637;
  19435. }
  19436. return maxMessageSize;
  19437. };
  19438. var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
  19439. window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
  19440. this._sctp = null;
  19441. // Chrome decided to not expose .sctp in plan-b mode.
  19442. // As usual, adapter.js has to do an 'ugly worakaround'
  19443. // to cover up the mess.
  19444. if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {
  19445. var _getConfiguration = this.getConfiguration(),
  19446. sdpSemantics = _getConfiguration.sdpSemantics;
  19447. if (sdpSemantics === 'plan-b') {
  19448. Object.defineProperty(this, 'sctp', {
  19449. get: function get() {
  19450. return typeof this._sctp === 'undefined' ? null : this._sctp;
  19451. },
  19452. enumerable: true,
  19453. configurable: true
  19454. });
  19455. }
  19456. }
  19457. if (sctpInDescription(arguments[0])) {
  19458. // Check if the remote is FF.
  19459. var isFirefox = getRemoteFirefoxVersion(arguments[0]);
  19460. // Get the maximum message size the local peer is capable of sending
  19461. var canSendMMS = getCanSendMaxMessageSize(isFirefox);
  19462. // Get the maximum message size of the remote peer.
  19463. var remoteMMS = getMaxMessageSize(arguments[0], isFirefox);
  19464. // Determine final maximum message size
  19465. var maxMessageSize = void 0;
  19466. if (canSendMMS === 0 && remoteMMS === 0) {
  19467. maxMessageSize = Number.POSITIVE_INFINITY;
  19468. } else if (canSendMMS === 0 || remoteMMS === 0) {
  19469. maxMessageSize = Math.max(canSendMMS, remoteMMS);
  19470. } else {
  19471. maxMessageSize = Math.min(canSendMMS, remoteMMS);
  19472. }
  19473. // Create a dummy RTCSctpTransport object and the 'maxMessageSize'
  19474. // attribute.
  19475. var sctp = {};
  19476. Object.defineProperty(sctp, 'maxMessageSize', {
  19477. get: function get() {
  19478. return maxMessageSize;
  19479. }
  19480. });
  19481. this._sctp = sctp;
  19482. }
  19483. return origSetRemoteDescription.apply(this, arguments);
  19484. };
  19485. }
  19486. function shimSendThrowTypeError(window) {
  19487. if (!(window.RTCPeerConnection && 'createDataChannel' in window.RTCPeerConnection.prototype)) {
  19488. return;
  19489. }
  19490. // Note: Although Firefox >= 57 has a native implementation, the maximum
  19491. // message size can be reset for all data channels at a later stage.
  19492. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831
  19493. function wrapDcSend(dc, pc) {
  19494. var origDataChannelSend = dc.send;
  19495. dc.send = function send() {
  19496. var data = arguments[0];
  19497. var length = data.length || data.size || data.byteLength;
  19498. if (dc.readyState === 'open' && pc.sctp && length > pc.sctp.maxMessageSize) {
  19499. throw new TypeError('Message too large (can send a maximum of ' + pc.sctp.maxMessageSize + ' bytes)');
  19500. }
  19501. return origDataChannelSend.apply(dc, arguments);
  19502. };
  19503. }
  19504. var origCreateDataChannel = window.RTCPeerConnection.prototype.createDataChannel;
  19505. window.RTCPeerConnection.prototype.createDataChannel = function createDataChannel() {
  19506. var dataChannel = origCreateDataChannel.apply(this, arguments);
  19507. wrapDcSend(dataChannel, this);
  19508. return dataChannel;
  19509. };
  19510. utils.wrapPeerConnectionEvent(window, 'datachannel', function (e) {
  19511. wrapDcSend(e.channel, e.target);
  19512. return e;
  19513. });
  19514. }
  19515. /* shims RTCConnectionState by pretending it is the same as iceConnectionState.
  19516. * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12
  19517. * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect
  19518. * since DTLS failures would be hidden. See
  19519. * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827
  19520. * for the Firefox tracking bug.
  19521. */
  19522. function shimConnectionState(window) {
  19523. if (!window.RTCPeerConnection || 'connectionState' in window.RTCPeerConnection.prototype) {
  19524. return;
  19525. }
  19526. var proto = window.RTCPeerConnection.prototype;
  19527. Object.defineProperty(proto, 'connectionState', {
  19528. get: function get() {
  19529. return {
  19530. completed: 'connected',
  19531. checking: 'connecting'
  19532. }[this.iceConnectionState] || this.iceConnectionState;
  19533. },
  19534. enumerable: true,
  19535. configurable: true
  19536. });
  19537. Object.defineProperty(proto, 'onconnectionstatechange', {
  19538. get: function get() {
  19539. return this._onconnectionstatechange || null;
  19540. },
  19541. set: function set(cb) {
  19542. if (this._onconnectionstatechange) {
  19543. this.removeEventListener('connectionstatechange', this._onconnectionstatechange);
  19544. delete this._onconnectionstatechange;
  19545. }
  19546. if (cb) {
  19547. this.addEventListener('connectionstatechange', this._onconnectionstatechange = cb);
  19548. }
  19549. },
  19550. enumerable: true,
  19551. configurable: true
  19552. });
  19553. ['setLocalDescription', 'setRemoteDescription'].forEach(function (method) {
  19554. var origMethod = proto[method];
  19555. proto[method] = function () {
  19556. if (!this._connectionstatechangepoly) {
  19557. this._connectionstatechangepoly = function (e) {
  19558. var pc = e.target;
  19559. if (pc._lastConnectionState !== pc.connectionState) {
  19560. pc._lastConnectionState = pc.connectionState;
  19561. var newEvent = new Event('connectionstatechange', e);
  19562. pc.dispatchEvent(newEvent);
  19563. }
  19564. return e;
  19565. };
  19566. this.addEventListener('iceconnectionstatechange', this._connectionstatechangepoly);
  19567. }
  19568. return origMethod.apply(this, arguments);
  19569. };
  19570. });
  19571. }
  19572. function removeAllowExtmapMixed(window) {
  19573. /* remove a=extmap-allow-mixed for Chrome < M71 */
  19574. if (!window.RTCPeerConnection) {
  19575. return;
  19576. }
  19577. var browserDetails = utils.detectBrowser(window);
  19578. if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {
  19579. return;
  19580. }
  19581. var nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;
  19582. window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription(desc) {
  19583. if (desc && desc.sdp && desc.sdp.indexOf('\na=extmap-allow-mixed') !== -1) {
  19584. desc.sdp = desc.sdp.split('\n').filter(function (line) {
  19585. return line.trim() !== 'a=extmap-allow-mixed';
  19586. }).join('\n');
  19587. }
  19588. return nativeSRD.apply(this, arguments);
  19589. };
  19590. }
  19591. }, {
  19592. "./utils": 15,
  19593. "sdp": 17
  19594. }],
  19595. 7: [function (require, module, exports) {
  19596. Object.defineProperty(exports, "__esModule", {
  19597. value: true
  19598. });
  19599. exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
  19600. var _getusermedia = require('./getusermedia');
  19601. Object.defineProperty(exports, 'shimGetUserMedia', {
  19602. enumerable: true,
  19603. get: function get() {
  19604. return _getusermedia.shimGetUserMedia;
  19605. }
  19606. });
  19607. var _getdisplaymedia = require('./getdisplaymedia');
  19608. Object.defineProperty(exports, 'shimGetDisplayMedia', {
  19609. enumerable: true,
  19610. get: function get() {
  19611. return _getdisplaymedia.shimGetDisplayMedia;
  19612. }
  19613. });
  19614. exports.shimPeerConnection = shimPeerConnection;
  19615. exports.shimReplaceTrack = shimReplaceTrack;
  19616. var _utils = require('../utils');
  19617. var utils = _interopRequireWildcard(_utils);
  19618. var _filtericeservers = require('./filtericeservers');
  19619. var _rtcpeerconnectionShim = require('rtcpeerconnection-shim');
  19620. var _rtcpeerconnectionShim2 = _interopRequireDefault(_rtcpeerconnectionShim);
  19621. function _interopRequireDefault(obj) {
  19622. return obj && obj.__esModule ? obj : {
  19623. "default": obj
  19624. };
  19625. }
  19626. function _interopRequireWildcard(obj) {
  19627. if (obj && obj.__esModule) {
  19628. return obj;
  19629. } else {
  19630. var newObj = {};
  19631. if (obj != null) {
  19632. for (var key in obj) {
  19633. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19634. }
  19635. }
  19636. newObj["default"] = obj;
  19637. return newObj;
  19638. }
  19639. }
  19640. function shimPeerConnection(window) {
  19641. var browserDetails = utils.detectBrowser(window);
  19642. if (window.RTCIceGatherer) {
  19643. if (!window.RTCIceCandidate) {
  19644. window.RTCIceCandidate = function RTCIceCandidate(args) {
  19645. return args;
  19646. };
  19647. }
  19648. if (!window.RTCSessionDescription) {
  19649. window.RTCSessionDescription = function RTCSessionDescription(args) {
  19650. return args;
  19651. };
  19652. }
  19653. // this adds an additional event listener to MediaStrackTrack that signals
  19654. // when a tracks enabled property was changed. Workaround for a bug in
  19655. // addStream, see below. No longer required in 15025+
  19656. if (browserDetails.version < 15025) {
  19657. var origMSTEnabled = Object.getOwnPropertyDescriptor(window.MediaStreamTrack.prototype, 'enabled');
  19658. Object.defineProperty(window.MediaStreamTrack.prototype, 'enabled', {
  19659. set: function set(value) {
  19660. origMSTEnabled.set.call(this, value);
  19661. var ev = new Event('enabled');
  19662. ev.enabled = value;
  19663. this.dispatchEvent(ev);
  19664. }
  19665. });
  19666. }
  19667. }
  19668. // ORTC defines the DTMF sender a bit different.
  19669. // https://github.com/w3c/ortc/issues/714
  19670. if (window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) {
  19671. Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
  19672. get: function get() {
  19673. if (this._dtmf === undefined) {
  19674. if (this.track.kind === 'audio') {
  19675. this._dtmf = new window.RTCDtmfSender(this);
  19676. } else if (this.track.kind === 'video') {
  19677. this._dtmf = null;
  19678. }
  19679. }
  19680. return this._dtmf;
  19681. }
  19682. });
  19683. }
  19684. // Edge currently only implements the RTCDtmfSender, not the
  19685. // RTCDTMFSender alias. See http://draft.ortc.org/#rtcdtmfsender2*
  19686. if (window.RTCDtmfSender && !window.RTCDTMFSender) {
  19687. window.RTCDTMFSender = window.RTCDtmfSender;
  19688. }
  19689. var RTCPeerConnectionShim = (0, _rtcpeerconnectionShim2["default"])(window, browserDetails.version);
  19690. window.RTCPeerConnection = function RTCPeerConnection(config) {
  19691. if (config && config.iceServers) {
  19692. config.iceServers = (0, _filtericeservers.filterIceServers)(config.iceServers, browserDetails.version);
  19693. utils.log('ICE servers after filtering:', config.iceServers);
  19694. }
  19695. return new RTCPeerConnectionShim(config);
  19696. };
  19697. window.RTCPeerConnection.prototype = RTCPeerConnectionShim.prototype;
  19698. }
  19699. function shimReplaceTrack(window) {
  19700. // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614
  19701. if (window.RTCRtpSender && !('replaceTrack' in window.RTCRtpSender.prototype)) {
  19702. window.RTCRtpSender.prototype.replaceTrack = window.RTCRtpSender.prototype.setTrack;
  19703. }
  19704. }
  19705. }, {
  19706. "../utils": 15,
  19707. "./filtericeservers": 8,
  19708. "./getdisplaymedia": 9,
  19709. "./getusermedia": 10,
  19710. "rtcpeerconnection-shim": 16
  19711. }],
  19712. 8: [function (require, module, exports) {
  19713. Object.defineProperty(exports, "__esModule", {
  19714. value: true
  19715. });
  19716. exports.filterIceServers = filterIceServers;
  19717. var _utils = require('../utils');
  19718. var utils = _interopRequireWildcard(_utils);
  19719. function _interopRequireWildcard(obj) {
  19720. if (obj && obj.__esModule) {
  19721. return obj;
  19722. } else {
  19723. var newObj = {};
  19724. if (obj != null) {
  19725. for (var key in obj) {
  19726. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19727. }
  19728. }
  19729. newObj["default"] = obj;
  19730. return newObj;
  19731. }
  19732. }
  19733. // Edge does not like
  19734. // 1) stun: filtered after 14393 unless ?transport=udp is present
  19735. // 2) turn: that does not have all of turn:host:port?transport=udp
  19736. // 3) turn: with ipv6 addresses
  19737. // 4) turn: occurring muliple times
  19738. function filterIceServers(iceServers, edgeVersion) {
  19739. var hasTurn = false;
  19740. iceServers = JSON.parse(JSON.stringify(iceServers));
  19741. return iceServers.filter(function (server) {
  19742. if (server && (server.urls || server.url)) {
  19743. var urls = server.urls || server.url;
  19744. if (server.url && !server.urls) {
  19745. utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');
  19746. }
  19747. var isString = typeof urls === 'string';
  19748. if (isString) {
  19749. urls = [urls];
  19750. }
  19751. urls = urls.filter(function (url) {
  19752. // filter STUN unconditionally.
  19753. if (url.indexOf('stun:') === 0) {
  19754. return false;
  19755. }
  19756. var validTurn = url.startsWith('turn') && !url.startsWith('turn:[') && url.includes('transport=udp');
  19757. if (validTurn && !hasTurn) {
  19758. hasTurn = true;
  19759. return true;
  19760. }
  19761. return validTurn && !hasTurn;
  19762. });
  19763. delete server.url;
  19764. server.urls = isString ? urls[0] : urls;
  19765. return !!urls.length;
  19766. }
  19767. });
  19768. }
  19769. }, {
  19770. "../utils": 15
  19771. }],
  19772. 9: [function (require, module, exports) {
  19773. Object.defineProperty(exports, "__esModule", {
  19774. value: true
  19775. });
  19776. exports.shimGetDisplayMedia = shimGetDisplayMedia;
  19777. function shimGetDisplayMedia(window) {
  19778. if (!('getDisplayMedia' in window.navigator)) {
  19779. return;
  19780. }
  19781. if (!window.navigator.mediaDevices) {
  19782. return;
  19783. }
  19784. if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
  19785. return;
  19786. }
  19787. window.navigator.mediaDevices.getDisplayMedia = window.navigator.getDisplayMedia.bind(window.navigator);
  19788. }
  19789. }, {}],
  19790. 10: [function (require, module, exports) {
  19791. Object.defineProperty(exports, "__esModule", {
  19792. value: true
  19793. });
  19794. exports.shimGetUserMedia = shimGetUserMedia;
  19795. function shimGetUserMedia(window) {
  19796. var navigator = window && window.navigator;
  19797. var shimError_ = function shimError_(e) {
  19798. return {
  19799. name: {
  19800. PermissionDeniedError: 'NotAllowedError'
  19801. }[e.name] || e.name,
  19802. message: e.message,
  19803. constraint: e.constraint,
  19804. toString: function toString() {
  19805. return this.name;
  19806. }
  19807. };
  19808. };
  19809. // getUserMedia error shim.
  19810. var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
  19811. navigator.mediaDevices.getUserMedia = function (c) {
  19812. return origGetUserMedia(c)["catch"](function (e) {
  19813. return Promise.reject(shimError_(e));
  19814. });
  19815. };
  19816. }
  19817. }, {}],
  19818. 11: [function (require, module, exports) {
  19819. Object.defineProperty(exports, "__esModule", {
  19820. value: true
  19821. });
  19822. exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
  19823. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  19824. return _typeof(obj);
  19825. } : function (obj) {
  19826. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  19827. };
  19828. var _getusermedia = require('./getusermedia');
  19829. Object.defineProperty(exports, 'shimGetUserMedia', {
  19830. enumerable: true,
  19831. get: function get() {
  19832. return _getusermedia.shimGetUserMedia;
  19833. }
  19834. });
  19835. var _getdisplaymedia = require('./getdisplaymedia');
  19836. Object.defineProperty(exports, 'shimGetDisplayMedia', {
  19837. enumerable: true,
  19838. get: function get() {
  19839. return _getdisplaymedia.shimGetDisplayMedia;
  19840. }
  19841. });
  19842. exports.shimOnTrack = shimOnTrack;
  19843. exports.shimPeerConnection = shimPeerConnection;
  19844. exports.shimSenderGetStats = shimSenderGetStats;
  19845. exports.shimReceiverGetStats = shimReceiverGetStats;
  19846. exports.shimRemoveStream = shimRemoveStream;
  19847. exports.shimRTCDataChannel = shimRTCDataChannel;
  19848. exports.shimAddTransceiver = shimAddTransceiver;
  19849. exports.shimCreateOffer = shimCreateOffer;
  19850. exports.shimCreateAnswer = shimCreateAnswer;
  19851. var _utils = require('../utils');
  19852. var utils = _interopRequireWildcard(_utils);
  19853. function _interopRequireWildcard(obj) {
  19854. if (obj && obj.__esModule) {
  19855. return obj;
  19856. } else {
  19857. var newObj = {};
  19858. if (obj != null) {
  19859. for (var key in obj) {
  19860. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19861. }
  19862. }
  19863. newObj["default"] = obj;
  19864. return newObj;
  19865. }
  19866. }
  19867. function _defineProperty(obj, key, value) {
  19868. if (key in obj) {
  19869. Object.defineProperty(obj, key, {
  19870. value: value,
  19871. enumerable: true,
  19872. configurable: true,
  19873. writable: true
  19874. });
  19875. } else {
  19876. obj[key] = value;
  19877. }
  19878. return obj;
  19879. }
  19880. function shimOnTrack(window) {
  19881. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {
  19882. Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
  19883. get: function get() {
  19884. return {
  19885. receiver: this.receiver
  19886. };
  19887. }
  19888. });
  19889. }
  19890. }
  19891. function shimPeerConnection(window) {
  19892. var browserDetails = utils.detectBrowser(window);
  19893. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {
  19894. return; // probably media.peerconnection.enabled=false in about:config
  19895. }
  19896. if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {
  19897. // very basic support for old versions.
  19898. window.RTCPeerConnection = window.mozRTCPeerConnection;
  19899. }
  19900. if (browserDetails.version < 53) {
  19901. // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.
  19902. ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
  19903. var nativeMethod = window.RTCPeerConnection.prototype[method];
  19904. var methodObj = _defineProperty({}, method, function () {
  19905. arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);
  19906. return nativeMethod.apply(this, arguments);
  19907. });
  19908. window.RTCPeerConnection.prototype[method] = methodObj[method];
  19909. });
  19910. }
  19911. // support for addIceCandidate(null or undefined)
  19912. // as well as ignoring {sdpMid, candidate: ""}
  19913. if (browserDetails.version < 68) {
  19914. var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate;
  19915. window.RTCPeerConnection.prototype.addIceCandidate = function addIceCandidate() {
  19916. if (!arguments[0]) {
  19917. if (arguments[1]) {
  19918. arguments[1].apply(null);
  19919. }
  19920. return Promise.resolve();
  19921. }
  19922. // Firefox 68+ emits and processes {candidate: "", ...}, ignore
  19923. // in older versions.
  19924. if (arguments[0] && arguments[0].candidate === '') {
  19925. return Promise.resolve();
  19926. }
  19927. return nativeAddIceCandidate.apply(this, arguments);
  19928. };
  19929. }
  19930. var modernStatsTypes = {
  19931. inboundrtp: 'inbound-rtp',
  19932. outboundrtp: 'outbound-rtp',
  19933. candidatepair: 'candidate-pair',
  19934. localcandidate: 'local-candidate',
  19935. remotecandidate: 'remote-candidate'
  19936. };
  19937. var nativeGetStats = window.RTCPeerConnection.prototype.getStats;
  19938. window.RTCPeerConnection.prototype.getStats = function getStats() {
  19939. var _arguments = Array.prototype.slice.call(arguments),
  19940. selector = _arguments[0],
  19941. onSucc = _arguments[1],
  19942. onErr = _arguments[2];
  19943. return nativeGetStats.apply(this, [selector || null]).then(function (stats) {
  19944. if (browserDetails.version < 53 && !onSucc) {
  19945. // Shim only promise getStats with spec-hyphens in type names
  19946. // Leave callback version alone; misc old uses of forEach before Map
  19947. try {
  19948. stats.forEach(function (stat) {
  19949. stat.type = modernStatsTypes[stat.type] || stat.type;
  19950. });
  19951. } catch (e) {
  19952. if (e.name !== 'TypeError') {
  19953. throw e;
  19954. }
  19955. // Avoid TypeError: "type" is read-only, in old versions. 34-43ish
  19956. stats.forEach(function (stat, i) {
  19957. stats.set(i, Object.assign({}, stat, {
  19958. type: modernStatsTypes[stat.type] || stat.type
  19959. }));
  19960. });
  19961. }
  19962. }
  19963. return stats;
  19964. }).then(onSucc, onErr);
  19965. };
  19966. }
  19967. function shimSenderGetStats(window) {
  19968. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {
  19969. return;
  19970. }
  19971. if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {
  19972. return;
  19973. }
  19974. var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
  19975. if (origGetSenders) {
  19976. window.RTCPeerConnection.prototype.getSenders = function getSenders() {
  19977. var _this = this;
  19978. var senders = origGetSenders.apply(this, []);
  19979. senders.forEach(function (sender) {
  19980. return sender._pc = _this;
  19981. });
  19982. return senders;
  19983. };
  19984. }
  19985. var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  19986. if (origAddTrack) {
  19987. window.RTCPeerConnection.prototype.addTrack = function addTrack() {
  19988. var sender = origAddTrack.apply(this, arguments);
  19989. sender._pc = this;
  19990. return sender;
  19991. };
  19992. }
  19993. window.RTCRtpSender.prototype.getStats = function getStats() {
  19994. return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map());
  19995. };
  19996. }
  19997. function shimReceiverGetStats(window) {
  19998. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {
  19999. return;
  20000. }
  20001. if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {
  20002. return;
  20003. }
  20004. var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
  20005. if (origGetReceivers) {
  20006. window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {
  20007. var _this2 = this;
  20008. var receivers = origGetReceivers.apply(this, []);
  20009. receivers.forEach(function (receiver) {
  20010. return receiver._pc = _this2;
  20011. });
  20012. return receivers;
  20013. };
  20014. }
  20015. utils.wrapPeerConnectionEvent(window, 'track', function (e) {
  20016. e.receiver._pc = e.srcElement;
  20017. return e;
  20018. });
  20019. window.RTCRtpReceiver.prototype.getStats = function getStats() {
  20020. return this._pc.getStats(this.track);
  20021. };
  20022. }
  20023. function shimRemoveStream(window) {
  20024. if (!window.RTCPeerConnection || 'removeStream' in window.RTCPeerConnection.prototype) {
  20025. return;
  20026. }
  20027. window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
  20028. var _this3 = this;
  20029. utils.deprecated('removeStream', 'removeTrack');
  20030. this.getSenders().forEach(function (sender) {
  20031. if (sender.track && stream.getTracks().includes(sender.track)) {
  20032. _this3.removeTrack(sender);
  20033. }
  20034. });
  20035. };
  20036. }
  20037. function shimRTCDataChannel(window) {
  20038. // rename DataChannel to RTCDataChannel (native fix in FF60):
  20039. // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851
  20040. if (window.DataChannel && !window.RTCDataChannel) {
  20041. window.RTCDataChannel = window.DataChannel;
  20042. }
  20043. }
  20044. function shimAddTransceiver(window) {
  20045. // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  20046. // Firefox ignores the init sendEncodings options passed to addTransceiver
  20047. // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  20048. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
  20049. return;
  20050. }
  20051. var origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;
  20052. if (origAddTransceiver) {
  20053. window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {
  20054. this.setParametersPromises = [];
  20055. var initParameters = arguments[1];
  20056. var shouldPerformCheck = initParameters && 'sendEncodings' in initParameters;
  20057. if (shouldPerformCheck) {
  20058. // If sendEncodings params are provided, validate grammar
  20059. initParameters.sendEncodings.forEach(function (encodingParam) {
  20060. if ('rid' in encodingParam) {
  20061. var ridRegex = /^[a-z0-9]{0,16}$/i;
  20062. if (!ridRegex.test(encodingParam.rid)) {
  20063. throw new TypeError('Invalid RID value provided.');
  20064. }
  20065. }
  20066. if ('scaleResolutionDownBy' in encodingParam) {
  20067. if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {
  20068. throw new RangeError('scale_resolution_down_by must be >= 1.0');
  20069. }
  20070. }
  20071. if ('maxFramerate' in encodingParam) {
  20072. if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {
  20073. throw new RangeError('max_framerate must be >= 0.0');
  20074. }
  20075. }
  20076. });
  20077. }
  20078. var transceiver = origAddTransceiver.apply(this, arguments);
  20079. if (shouldPerformCheck) {
  20080. // Check if the init options were applied. If not we do this in an
  20081. // asynchronous way and save the promise reference in a global object.
  20082. // This is an ugly hack, but at the same time is way more robust than
  20083. // checking the sender parameters before and after the createOffer
  20084. // Also note that after the createoffer we are not 100% sure that
  20085. // the params were asynchronously applied so we might miss the
  20086. // opportunity to recreate offer.
  20087. var sender = transceiver.sender;
  20088. var params = sender.getParameters();
  20089. if (!('encodings' in params)) {
  20090. params.encodings = initParameters.sendEncodings;
  20091. this.setParametersPromises.push(sender.setParameters(params)["catch"](function () {}));
  20092. }
  20093. }
  20094. return transceiver;
  20095. };
  20096. }
  20097. }
  20098. function shimCreateOffer(window) {
  20099. // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  20100. // Firefox ignores the init sendEncodings options passed to addTransceiver
  20101. // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  20102. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
  20103. return;
  20104. }
  20105. var origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
  20106. window.RTCPeerConnection.prototype.createOffer = function createOffer() {
  20107. var _this4 = this,
  20108. _arguments2 = arguments;
  20109. if (this.setParametersPromises && this.setParametersPromises.length) {
  20110. return Promise.all(this.setParametersPromises).then(function () {
  20111. return origCreateOffer.apply(_this4, _arguments2);
  20112. })["finally"](function () {
  20113. _this4.setParametersPromises = [];
  20114. });
  20115. }
  20116. return origCreateOffer.apply(this, arguments);
  20117. };
  20118. }
  20119. function shimCreateAnswer(window) {
  20120. // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  20121. // Firefox ignores the init sendEncodings options passed to addTransceiver
  20122. // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  20123. if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
  20124. return;
  20125. }
  20126. var origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;
  20127. window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {
  20128. var _this5 = this,
  20129. _arguments3 = arguments;
  20130. if (this.setParametersPromises && this.setParametersPromises.length) {
  20131. return Promise.all(this.setParametersPromises).then(function () {
  20132. return origCreateAnswer.apply(_this5, _arguments3);
  20133. })["finally"](function () {
  20134. _this5.setParametersPromises = [];
  20135. });
  20136. }
  20137. return origCreateAnswer.apply(this, arguments);
  20138. };
  20139. }
  20140. }, {
  20141. "../utils": 15,
  20142. "./getdisplaymedia": 12,
  20143. "./getusermedia": 13
  20144. }],
  20145. 12: [function (require, module, exports) {
  20146. Object.defineProperty(exports, "__esModule", {
  20147. value: true
  20148. });
  20149. exports.shimGetDisplayMedia = shimGetDisplayMedia;
  20150. function shimGetDisplayMedia(window, preferredMediaSource) {
  20151. if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
  20152. return;
  20153. }
  20154. if (!window.navigator.mediaDevices) {
  20155. return;
  20156. }
  20157. window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
  20158. if (!(constraints && constraints.video)) {
  20159. var err = new DOMException('getDisplayMedia without video ' + 'constraints is undefined');
  20160. err.name = 'NotFoundError';
  20161. // from https://heycam.github.io/webidl/#idl-DOMException-error-names
  20162. err.code = 8;
  20163. return Promise.reject(err);
  20164. }
  20165. if (constraints.video === true) {
  20166. constraints.video = {
  20167. mediaSource: preferredMediaSource
  20168. };
  20169. } else {
  20170. constraints.video.mediaSource = preferredMediaSource;
  20171. }
  20172. return window.navigator.mediaDevices.getUserMedia(constraints);
  20173. };
  20174. }
  20175. }, {}],
  20176. 13: [function (require, module, exports) {
  20177. Object.defineProperty(exports, "__esModule", {
  20178. value: true
  20179. });
  20180. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  20181. return _typeof(obj);
  20182. } : function (obj) {
  20183. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  20184. };
  20185. exports.shimGetUserMedia = shimGetUserMedia;
  20186. var _utils = require('../utils');
  20187. var utils = _interopRequireWildcard(_utils);
  20188. function _interopRequireWildcard(obj) {
  20189. if (obj && obj.__esModule) {
  20190. return obj;
  20191. } else {
  20192. var newObj = {};
  20193. if (obj != null) {
  20194. for (var key in obj) {
  20195. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  20196. }
  20197. }
  20198. newObj["default"] = obj;
  20199. return newObj;
  20200. }
  20201. }
  20202. function shimGetUserMedia(window) {
  20203. var browserDetails = utils.detectBrowser(window);
  20204. var navigator = window && window.navigator;
  20205. var MediaStreamTrack = window && window.MediaStreamTrack;
  20206. navigator.getUserMedia = function (constraints, onSuccess, onError) {
  20207. // Replace Firefox 44+'s deprecation warning with unprefixed version.
  20208. utils.deprecated('navigator.getUserMedia', 'navigator.mediaDevices.getUserMedia');
  20209. navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);
  20210. };
  20211. if (!(browserDetails.version > 55 && 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {
  20212. var remap = function remap(obj, a, b) {
  20213. if (a in obj && !(b in obj)) {
  20214. obj[b] = obj[a];
  20215. delete obj[a];
  20216. }
  20217. };
  20218. var nativeGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
  20219. navigator.mediaDevices.getUserMedia = function (c) {
  20220. if ((typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) === 'object' && _typeof$1(c.audio) === 'object') {
  20221. c = JSON.parse(JSON.stringify(c));
  20222. remap(c.audio, 'autoGainControl', 'mozAutoGainControl');
  20223. remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');
  20224. }
  20225. return nativeGetUserMedia(c);
  20226. };
  20227. if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {
  20228. var nativeGetSettings = MediaStreamTrack.prototype.getSettings;
  20229. MediaStreamTrack.prototype.getSettings = function () {
  20230. var obj = nativeGetSettings.apply(this, arguments);
  20231. remap(obj, 'mozAutoGainControl', 'autoGainControl');
  20232. remap(obj, 'mozNoiseSuppression', 'noiseSuppression');
  20233. return obj;
  20234. };
  20235. }
  20236. if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {
  20237. var nativeApplyConstraints = MediaStreamTrack.prototype.applyConstraints;
  20238. MediaStreamTrack.prototype.applyConstraints = function (c) {
  20239. if (this.kind === 'audio' && (typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) === 'object') {
  20240. c = JSON.parse(JSON.stringify(c));
  20241. remap(c, 'autoGainControl', 'mozAutoGainControl');
  20242. remap(c, 'noiseSuppression', 'mozNoiseSuppression');
  20243. }
  20244. return nativeApplyConstraints.apply(this, [c]);
  20245. };
  20246. }
  20247. }
  20248. }
  20249. }, {
  20250. "../utils": 15
  20251. }],
  20252. 14: [function (require, module, exports) {
  20253. Object.defineProperty(exports, "__esModule", {
  20254. value: true
  20255. });
  20256. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  20257. return _typeof(obj);
  20258. } : function (obj) {
  20259. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  20260. };
  20261. exports.shimLocalStreamsAPI = shimLocalStreamsAPI;
  20262. exports.shimRemoteStreamsAPI = shimRemoteStreamsAPI;
  20263. exports.shimCallbacksAPI = shimCallbacksAPI;
  20264. exports.shimGetUserMedia = shimGetUserMedia;
  20265. exports.shimConstraints = shimConstraints;
  20266. exports.shimRTCIceServerUrls = shimRTCIceServerUrls;
  20267. exports.shimTrackEventTransceiver = shimTrackEventTransceiver;
  20268. exports.shimCreateOfferLegacy = shimCreateOfferLegacy;
  20269. var _utils = require('../utils');
  20270. var utils = _interopRequireWildcard(_utils);
  20271. function _interopRequireWildcard(obj) {
  20272. if (obj && obj.__esModule) {
  20273. return obj;
  20274. } else {
  20275. var newObj = {};
  20276. if (obj != null) {
  20277. for (var key in obj) {
  20278. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  20279. }
  20280. }
  20281. newObj["default"] = obj;
  20282. return newObj;
  20283. }
  20284. }
  20285. function shimLocalStreamsAPI(window) {
  20286. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
  20287. return;
  20288. }
  20289. if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {
  20290. window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
  20291. if (!this._localStreams) {
  20292. this._localStreams = [];
  20293. }
  20294. return this._localStreams;
  20295. };
  20296. }
  20297. if (!('addStream' in window.RTCPeerConnection.prototype)) {
  20298. var _addTrack = window.RTCPeerConnection.prototype.addTrack;
  20299. window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
  20300. var _this = this;
  20301. if (!this._localStreams) {
  20302. this._localStreams = [];
  20303. }
  20304. if (!this._localStreams.includes(stream)) {
  20305. this._localStreams.push(stream);
  20306. }
  20307. // Try to emulate Chrome's behaviour of adding in audio-video order.
  20308. // Safari orders by track id.
  20309. stream.getAudioTracks().forEach(function (track) {
  20310. return _addTrack.call(_this, track, stream);
  20311. });
  20312. stream.getVideoTracks().forEach(function (track) {
  20313. return _addTrack.call(_this, track, stream);
  20314. });
  20315. };
  20316. window.RTCPeerConnection.prototype.addTrack = function addTrack(track) {
  20317. var stream = arguments[1];
  20318. if (stream) {
  20319. if (!this._localStreams) {
  20320. this._localStreams = [stream];
  20321. } else if (!this._localStreams.includes(stream)) {
  20322. this._localStreams.push(stream);
  20323. }
  20324. }
  20325. return _addTrack.apply(this, arguments);
  20326. };
  20327. }
  20328. if (!('removeStream' in window.RTCPeerConnection.prototype)) {
  20329. window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
  20330. var _this2 = this;
  20331. if (!this._localStreams) {
  20332. this._localStreams = [];
  20333. }
  20334. var index = this._localStreams.indexOf(stream);
  20335. if (index === -1) {
  20336. return;
  20337. }
  20338. this._localStreams.splice(index, 1);
  20339. var tracks = stream.getTracks();
  20340. this.getSenders().forEach(function (sender) {
  20341. if (tracks.includes(sender.track)) {
  20342. _this2.removeTrack(sender);
  20343. }
  20344. });
  20345. };
  20346. }
  20347. }
  20348. function shimRemoteStreamsAPI(window) {
  20349. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
  20350. return;
  20351. }
  20352. if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {
  20353. window.RTCPeerConnection.prototype.getRemoteStreams = function getRemoteStreams() {
  20354. return this._remoteStreams ? this._remoteStreams : [];
  20355. };
  20356. }
  20357. if (!('onaddstream' in window.RTCPeerConnection.prototype)) {
  20358. Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {
  20359. get: function get() {
  20360. return this._onaddstream;
  20361. },
  20362. set: function set(f) {
  20363. var _this3 = this;
  20364. if (this._onaddstream) {
  20365. this.removeEventListener('addstream', this._onaddstream);
  20366. this.removeEventListener('track', this._onaddstreampoly);
  20367. }
  20368. this.addEventListener('addstream', this._onaddstream = f);
  20369. this.addEventListener('track', this._onaddstreampoly = function (e) {
  20370. e.streams.forEach(function (stream) {
  20371. if (!_this3._remoteStreams) {
  20372. _this3._remoteStreams = [];
  20373. }
  20374. if (_this3._remoteStreams.includes(stream)) {
  20375. return;
  20376. }
  20377. _this3._remoteStreams.push(stream);
  20378. var event = new Event('addstream');
  20379. event.stream = stream;
  20380. _this3.dispatchEvent(event);
  20381. });
  20382. });
  20383. }
  20384. });
  20385. var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
  20386. window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
  20387. var pc = this;
  20388. if (!this._onaddstreampoly) {
  20389. this.addEventListener('track', this._onaddstreampoly = function (e) {
  20390. e.streams.forEach(function (stream) {
  20391. if (!pc._remoteStreams) {
  20392. pc._remoteStreams = [];
  20393. }
  20394. if (pc._remoteStreams.indexOf(stream) >= 0) {
  20395. return;
  20396. }
  20397. pc._remoteStreams.push(stream);
  20398. var event = new Event('addstream');
  20399. event.stream = stream;
  20400. pc.dispatchEvent(event);
  20401. });
  20402. });
  20403. }
  20404. return origSetRemoteDescription.apply(pc, arguments);
  20405. };
  20406. }
  20407. }
  20408. function shimCallbacksAPI(window) {
  20409. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
  20410. return;
  20411. }
  20412. var prototype = window.RTCPeerConnection.prototype;
  20413. var origCreateOffer = prototype.createOffer;
  20414. var origCreateAnswer = prototype.createAnswer;
  20415. var setLocalDescription = prototype.setLocalDescription;
  20416. var setRemoteDescription = prototype.setRemoteDescription;
  20417. var addIceCandidate = prototype.addIceCandidate;
  20418. prototype.createOffer = function createOffer(successCallback, failureCallback) {
  20419. var options = arguments.length >= 2 ? arguments[2] : arguments[0];
  20420. var promise = origCreateOffer.apply(this, [options]);
  20421. if (!failureCallback) {
  20422. return promise;
  20423. }
  20424. promise.then(successCallback, failureCallback);
  20425. return Promise.resolve();
  20426. };
  20427. prototype.createAnswer = function createAnswer(successCallback, failureCallback) {
  20428. var options = arguments.length >= 2 ? arguments[2] : arguments[0];
  20429. var promise = origCreateAnswer.apply(this, [options]);
  20430. if (!failureCallback) {
  20431. return promise;
  20432. }
  20433. promise.then(successCallback, failureCallback);
  20434. return Promise.resolve();
  20435. };
  20436. var withCallback = function withCallback(description, successCallback, failureCallback) {
  20437. var promise = setLocalDescription.apply(this, [description]);
  20438. if (!failureCallback) {
  20439. return promise;
  20440. }
  20441. promise.then(successCallback, failureCallback);
  20442. return Promise.resolve();
  20443. };
  20444. prototype.setLocalDescription = withCallback;
  20445. withCallback = function withCallback(description, successCallback, failureCallback) {
  20446. var promise = setRemoteDescription.apply(this, [description]);
  20447. if (!failureCallback) {
  20448. return promise;
  20449. }
  20450. promise.then(successCallback, failureCallback);
  20451. return Promise.resolve();
  20452. };
  20453. prototype.setRemoteDescription = withCallback;
  20454. withCallback = function withCallback(candidate, successCallback, failureCallback) {
  20455. var promise = addIceCandidate.apply(this, [candidate]);
  20456. if (!failureCallback) {
  20457. return promise;
  20458. }
  20459. promise.then(successCallback, failureCallback);
  20460. return Promise.resolve();
  20461. };
  20462. prototype.addIceCandidate = withCallback;
  20463. }
  20464. function shimGetUserMedia(window) {
  20465. var navigator = window && window.navigator;
  20466. if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
  20467. // shim not needed in Safari 12.1
  20468. var mediaDevices = navigator.mediaDevices;
  20469. var _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);
  20470. navigator.mediaDevices.getUserMedia = function (constraints) {
  20471. return _getUserMedia(shimConstraints(constraints));
  20472. };
  20473. }
  20474. if (!navigator.getUserMedia && navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
  20475. navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {
  20476. navigator.mediaDevices.getUserMedia(constraints).then(cb, errcb);
  20477. }.bind(navigator);
  20478. }
  20479. }
  20480. function shimConstraints(constraints) {
  20481. if (constraints && constraints.video !== undefined) {
  20482. return Object.assign({}, constraints, {
  20483. video: utils.compactObject(constraints.video)
  20484. });
  20485. }
  20486. return constraints;
  20487. }
  20488. function shimRTCIceServerUrls(window) {
  20489. // migrate from non-spec RTCIceServer.url to RTCIceServer.urls
  20490. var OrigPeerConnection = window.RTCPeerConnection;
  20491. window.RTCPeerConnection = function RTCPeerConnection(pcConfig, pcConstraints) {
  20492. if (pcConfig && pcConfig.iceServers) {
  20493. var newIceServers = [];
  20494. for (var i = 0; i < pcConfig.iceServers.length; i++) {
  20495. var server = pcConfig.iceServers[i];
  20496. if (!server.hasOwnProperty('urls') && server.hasOwnProperty('url')) {
  20497. utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');
  20498. server = JSON.parse(JSON.stringify(server));
  20499. server.urls = server.url;
  20500. delete server.url;
  20501. newIceServers.push(server);
  20502. } else {
  20503. newIceServers.push(pcConfig.iceServers[i]);
  20504. }
  20505. }
  20506. pcConfig.iceServers = newIceServers;
  20507. }
  20508. return new OrigPeerConnection(pcConfig, pcConstraints);
  20509. };
  20510. window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;
  20511. // wrap static methods. Currently just generateCertificate.
  20512. if ('generateCertificate' in window.RTCPeerConnection) {
  20513. Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {
  20514. get: function get() {
  20515. return OrigPeerConnection.generateCertificate;
  20516. }
  20517. });
  20518. }
  20519. }
  20520. function shimTrackEventTransceiver(window) {
  20521. // Add event.transceiver member over deprecated event.receiver
  20522. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {
  20523. Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
  20524. get: function get() {
  20525. return {
  20526. receiver: this.receiver
  20527. };
  20528. }
  20529. });
  20530. }
  20531. }
  20532. function shimCreateOfferLegacy(window) {
  20533. var origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
  20534. window.RTCPeerConnection.prototype.createOffer = function createOffer(offerOptions) {
  20535. if (offerOptions) {
  20536. if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {
  20537. // support bit values
  20538. offerOptions.offerToReceiveAudio = !!offerOptions.offerToReceiveAudio;
  20539. }
  20540. var audioTransceiver = this.getTransceivers().find(function (transceiver) {
  20541. return transceiver.receiver.track.kind === 'audio';
  20542. });
  20543. if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {
  20544. if (audioTransceiver.direction === 'sendrecv') {
  20545. if (audioTransceiver.setDirection) {
  20546. audioTransceiver.setDirection('sendonly');
  20547. } else {
  20548. audioTransceiver.direction = 'sendonly';
  20549. }
  20550. } else if (audioTransceiver.direction === 'recvonly') {
  20551. if (audioTransceiver.setDirection) {
  20552. audioTransceiver.setDirection('inactive');
  20553. } else {
  20554. audioTransceiver.direction = 'inactive';
  20555. }
  20556. }
  20557. } else if (offerOptions.offerToReceiveAudio === true && !audioTransceiver) {
  20558. this.addTransceiver('audio');
  20559. }
  20560. if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {
  20561. // support bit values
  20562. offerOptions.offerToReceiveVideo = !!offerOptions.offerToReceiveVideo;
  20563. }
  20564. var videoTransceiver = this.getTransceivers().find(function (transceiver) {
  20565. return transceiver.receiver.track.kind === 'video';
  20566. });
  20567. if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {
  20568. if (videoTransceiver.direction === 'sendrecv') {
  20569. if (videoTransceiver.setDirection) {
  20570. videoTransceiver.setDirection('sendonly');
  20571. } else {
  20572. videoTransceiver.direction = 'sendonly';
  20573. }
  20574. } else if (videoTransceiver.direction === 'recvonly') {
  20575. if (videoTransceiver.setDirection) {
  20576. videoTransceiver.setDirection('inactive');
  20577. } else {
  20578. videoTransceiver.direction = 'inactive';
  20579. }
  20580. }
  20581. } else if (offerOptions.offerToReceiveVideo === true && !videoTransceiver) {
  20582. this.addTransceiver('video');
  20583. }
  20584. }
  20585. return origCreateOffer.apply(this, arguments);
  20586. };
  20587. }
  20588. }, {
  20589. "../utils": 15
  20590. }],
  20591. 15: [function (require, module, exports) {
  20592. Object.defineProperty(exports, "__esModule", {
  20593. value: true
  20594. });
  20595. var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
  20596. return _typeof(obj);
  20597. } : function (obj) {
  20598. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
  20599. };
  20600. exports.extractVersion = extractVersion;
  20601. exports.wrapPeerConnectionEvent = wrapPeerConnectionEvent;
  20602. exports.disableLog = disableLog;
  20603. exports.disableWarnings = disableWarnings;
  20604. exports.log = log;
  20605. exports.deprecated = deprecated;
  20606. exports.detectBrowser = detectBrowser;
  20607. exports.compactObject = compactObject;
  20608. exports.walkStats = walkStats;
  20609. exports.filterStats = filterStats;
  20610. function _defineProperty(obj, key, value) {
  20611. if (key in obj) {
  20612. Object.defineProperty(obj, key, {
  20613. value: value,
  20614. enumerable: true,
  20615. configurable: true,
  20616. writable: true
  20617. });
  20618. } else {
  20619. obj[key] = value;
  20620. }
  20621. return obj;
  20622. }
  20623. var logDisabled_ = true;
  20624. var deprecationWarnings_ = true;
  20625. /**
  20626. * Extract browser version out of the provided user agent string.
  20627. *
  20628. * @param {!string} uastring userAgent string.
  20629. * @param {!string} expr Regular expression used as match criteria.
  20630. * @param {!number} pos position in the version string to be returned.
  20631. * @return {!number} browser version.
  20632. */
  20633. function extractVersion(uastring, expr, pos) {
  20634. var match = uastring.match(expr);
  20635. return match && match.length >= pos && parseInt(match[pos], 10);
  20636. }
  20637. // Wraps the peerconnection event eventNameToWrap in a function
  20638. // which returns the modified event object (or false to prevent
  20639. // the event).
  20640. function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {
  20641. if (!window.RTCPeerConnection) {
  20642. return;
  20643. }
  20644. var proto = window.RTCPeerConnection.prototype;
  20645. var nativeAddEventListener = proto.addEventListener;
  20646. proto.addEventListener = function (nativeEventName, cb) {
  20647. if (nativeEventName !== eventNameToWrap) {
  20648. return nativeAddEventListener.apply(this, arguments);
  20649. }
  20650. var wrappedCallback = function wrappedCallback(e) {
  20651. var modifiedEvent = wrapper(e);
  20652. if (modifiedEvent) {
  20653. cb(modifiedEvent);
  20654. }
  20655. };
  20656. this._eventMap = this._eventMap || {};
  20657. this._eventMap[cb] = wrappedCallback;
  20658. return nativeAddEventListener.apply(this, [nativeEventName, wrappedCallback]);
  20659. };
  20660. var nativeRemoveEventListener = proto.removeEventListener;
  20661. proto.removeEventListener = function (nativeEventName, cb) {
  20662. if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[cb]) {
  20663. return nativeRemoveEventListener.apply(this, arguments);
  20664. }
  20665. var unwrappedCb = this._eventMap[cb];
  20666. delete this._eventMap[cb];
  20667. return nativeRemoveEventListener.apply(this, [nativeEventName, unwrappedCb]);
  20668. };
  20669. Object.defineProperty(proto, 'on' + eventNameToWrap, {
  20670. get: function get() {
  20671. return this['_on' + eventNameToWrap];
  20672. },
  20673. set: function set(cb) {
  20674. if (this['_on' + eventNameToWrap]) {
  20675. this.removeEventListener(eventNameToWrap, this['_on' + eventNameToWrap]);
  20676. delete this['_on' + eventNameToWrap];
  20677. }
  20678. if (cb) {
  20679. this.addEventListener(eventNameToWrap, this['_on' + eventNameToWrap] = cb);
  20680. }
  20681. },
  20682. enumerable: true,
  20683. configurable: true
  20684. });
  20685. }
  20686. function disableLog(bool) {
  20687. if (typeof bool !== 'boolean') {
  20688. return new Error('Argument type: ' + (typeof bool === 'undefined' ? 'undefined' : _typeof$1(bool)) + '. Please use a boolean.');
  20689. }
  20690. logDisabled_ = bool;
  20691. return bool ? 'adapter.js logging disabled' : 'adapter.js logging enabled';
  20692. }
  20693. /**
  20694. * Disable or enable deprecation warnings
  20695. * @param {!boolean} bool set to true to disable warnings.
  20696. */
  20697. function disableWarnings(bool) {
  20698. if (typeof bool !== 'boolean') {
  20699. return new Error('Argument type: ' + (typeof bool === 'undefined' ? 'undefined' : _typeof$1(bool)) + '. Please use a boolean.');
  20700. }
  20701. deprecationWarnings_ = !bool;
  20702. return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');
  20703. }
  20704. function log() {
  20705. if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object') {
  20706. if (logDisabled_) {
  20707. return;
  20708. }
  20709. if (typeof console !== 'undefined' && typeof console.log === 'function') {
  20710. console.log.apply(console, arguments);
  20711. }
  20712. }
  20713. }
  20714. /**
  20715. * Shows a deprecation warning suggesting the modern and spec-compatible API.
  20716. */
  20717. function deprecated(oldMethod, newMethod) {
  20718. if (!deprecationWarnings_) {
  20719. return;
  20720. }
  20721. console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.');
  20722. }
  20723. /**
  20724. * Browser detector.
  20725. *
  20726. * @return {object} result containing browser and version
  20727. * properties.
  20728. */
  20729. function detectBrowser(window) {
  20730. var navigator = window.navigator;
  20731. // Returned result object.
  20732. var result = {
  20733. browser: null,
  20734. version: null
  20735. };
  20736. // Fail early if it's not a browser
  20737. if (typeof window === 'undefined' || !window.navigator) {
  20738. result.browser = 'Not a browser.';
  20739. return result;
  20740. }
  20741. if (navigator.mozGetUserMedia) {
  20742. // Firefox.
  20743. result.browser = 'firefox';
  20744. result.version = extractVersion(navigator.userAgent, /Firefox\/(\d+)\./, 1);
  20745. } else if (navigator.webkitGetUserMedia || window.isSecureContext === false && window.webkitRTCPeerConnection && !window.RTCIceGatherer) {
  20746. // Chrome, Chromium, Webview, Opera.
  20747. // Version matches Chrome/WebRTC version.
  20748. // Chrome 74 removed webkitGetUserMedia on http as well so we need the
  20749. // more complicated fallback to webkitRTCPeerConnection.
  20750. result.browser = 'chrome';
  20751. result.version = extractVersion(navigator.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
  20752. } else if (navigator.mediaDevices && navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) {
  20753. // Edge.
  20754. result.browser = 'edge';
  20755. result.version = extractVersion(navigator.userAgent, /Edge\/(\d+).(\d+)$/, 2);
  20756. } else if (window.RTCPeerConnection && navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) {
  20757. // Safari.
  20758. result.browser = 'safari';
  20759. result.version = extractVersion(navigator.userAgent, /AppleWebKit\/(\d+)\./, 1);
  20760. result.supportsUnifiedPlan = window.RTCRtpTransceiver && 'currentDirection' in window.RTCRtpTransceiver.prototype;
  20761. } else {
  20762. // Default fallthrough: not supported.
  20763. result.browser = 'Not a supported browser.';
  20764. return result;
  20765. }
  20766. return result;
  20767. }
  20768. /**
  20769. * Checks if something is an object.
  20770. *
  20771. * @param {*} val The something you want to check.
  20772. * @return true if val is an object, false otherwise.
  20773. */
  20774. function isObject(val) {
  20775. return Object.prototype.toString.call(val) === '[object Object]';
  20776. }
  20777. /**
  20778. * Remove all empty objects and undefined values
  20779. * from a nested object -- an enhanced and vanilla version
  20780. * of Lodash's `compact`.
  20781. */
  20782. function compactObject(data) {
  20783. if (!isObject(data)) {
  20784. return data;
  20785. }
  20786. return Object.keys(data).reduce(function (accumulator, key) {
  20787. var isObj = isObject(data[key]);
  20788. var value = isObj ? compactObject(data[key]) : data[key];
  20789. var isEmptyObject = isObj && !Object.keys(value).length;
  20790. if (value === undefined || isEmptyObject) {
  20791. return accumulator;
  20792. }
  20793. return Object.assign(accumulator, _defineProperty({}, key, value));
  20794. }, {});
  20795. }
  20796. /* iterates the stats graph recursively. */
  20797. function walkStats(stats, base, resultSet) {
  20798. if (!base || resultSet.has(base.id)) {
  20799. return;
  20800. }
  20801. resultSet.set(base.id, base);
  20802. Object.keys(base).forEach(function (name) {
  20803. if (name.endsWith('Id')) {
  20804. walkStats(stats, stats.get(base[name]), resultSet);
  20805. } else if (name.endsWith('Ids')) {
  20806. base[name].forEach(function (id) {
  20807. walkStats(stats, stats.get(id), resultSet);
  20808. });
  20809. }
  20810. });
  20811. }
  20812. /* filter getStats for a sender/receiver track. */
  20813. function filterStats(result, track, outbound) {
  20814. var streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';
  20815. var filteredResult = new Map();
  20816. if (track === null) {
  20817. return filteredResult;
  20818. }
  20819. var trackStats = [];
  20820. result.forEach(function (value) {
  20821. if (value.type === 'track' && value.trackIdentifier === track.id) {
  20822. trackStats.push(value);
  20823. }
  20824. });
  20825. trackStats.forEach(function (trackStat) {
  20826. result.forEach(function (stats) {
  20827. if (stats.type === streamStatsType && stats.trackId === trackStat.id) {
  20828. walkStats(result, stats, filteredResult);
  20829. }
  20830. });
  20831. });
  20832. return filteredResult;
  20833. }
  20834. }, {}],
  20835. 16: [function (require, module, exports) {
  20836. var SDPUtils = require('sdp');
  20837. function fixStatsType(stat) {
  20838. return {
  20839. inboundrtp: 'inbound-rtp',
  20840. outboundrtp: 'outbound-rtp',
  20841. candidatepair: 'candidate-pair',
  20842. localcandidate: 'local-candidate',
  20843. remotecandidate: 'remote-candidate'
  20844. }[stat.type] || stat.type;
  20845. }
  20846. function writeMediaSection(transceiver, caps, type, stream, dtlsRole) {
  20847. var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);
  20848. // Map ICE parameters (ufrag, pwd) to SDP.
  20849. sdp += SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());
  20850. // Map DTLS parameters to SDP.
  20851. sdp += SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : dtlsRole || 'active');
  20852. sdp += 'a=mid:' + transceiver.mid + '\r\n';
  20853. if (transceiver.rtpSender && transceiver.rtpReceiver) {
  20854. sdp += 'a=sendrecv\r\n';
  20855. } else if (transceiver.rtpSender) {
  20856. sdp += 'a=sendonly\r\n';
  20857. } else if (transceiver.rtpReceiver) {
  20858. sdp += 'a=recvonly\r\n';
  20859. } else {
  20860. sdp += 'a=inactive\r\n';
  20861. }
  20862. if (transceiver.rtpSender) {
  20863. var trackId = transceiver.rtpSender._initialTrackId || transceiver.rtpSender.track.id;
  20864. transceiver.rtpSender._initialTrackId = trackId;
  20865. // spec.
  20866. var msid = 'msid:' + (stream ? stream.id : '-') + ' ' + trackId + '\r\n';
  20867. sdp += 'a=' + msid;
  20868. // for Chrome. Legacy should no longer be required.
  20869. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid;
  20870. // RTX
  20871. if (transceiver.sendEncodingParameters[0].rtx) {
  20872. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid;
  20873. sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n';
  20874. }
  20875. }
  20876. // FIXME: this should be written by writeRtpDescription.
  20877. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
  20878. if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
  20879. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
  20880. }
  20881. return sdp;
  20882. }
  20883. // Edge does not like
  20884. // 1) stun: filtered after 14393 unless ?transport=udp is present
  20885. // 2) turn: that does not have all of turn:host:port?transport=udp
  20886. // 3) turn: with ipv6 addresses
  20887. // 4) turn: occurring muliple times
  20888. function filterIceServers(iceServers, edgeVersion) {
  20889. var hasTurn = false;
  20890. iceServers = JSON.parse(JSON.stringify(iceServers));
  20891. return iceServers.filter(function (server) {
  20892. if (server && (server.urls || server.url)) {
  20893. var urls = server.urls || server.url;
  20894. if (server.url && !server.urls) {
  20895. console.warn('RTCIceServer.url is deprecated! Use urls instead.');
  20896. }
  20897. var isString = typeof urls === 'string';
  20898. if (isString) {
  20899. urls = [urls];
  20900. }
  20901. urls = urls.filter(function (url) {
  20902. var validTurn = url.indexOf('turn:') === 0 && url.indexOf('transport=udp') !== -1 && url.indexOf('turn:[') === -1 && !hasTurn;
  20903. if (validTurn) {
  20904. hasTurn = true;
  20905. return true;
  20906. }
  20907. return url.indexOf('stun:') === 0 && edgeVersion >= 14393 && url.indexOf('?transport=udp') === -1;
  20908. });
  20909. delete server.url;
  20910. server.urls = isString ? urls[0] : urls;
  20911. return !!urls.length;
  20912. }
  20913. });
  20914. }
  20915. // Determines the intersection of local and remote capabilities.
  20916. function getCommonCapabilities(localCapabilities, remoteCapabilities) {
  20917. var commonCapabilities = {
  20918. codecs: [],
  20919. headerExtensions: [],
  20920. fecMechanisms: []
  20921. };
  20922. var findCodecByPayloadType = function findCodecByPayloadType(pt, codecs) {
  20923. pt = parseInt(pt, 10);
  20924. for (var i = 0; i < codecs.length; i++) {
  20925. if (codecs[i].payloadType === pt || codecs[i].preferredPayloadType === pt) {
  20926. return codecs[i];
  20927. }
  20928. }
  20929. };
  20930. var rtxCapabilityMatches = function rtxCapabilityMatches(lRtx, rRtx, lCodecs, rCodecs) {
  20931. var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs);
  20932. var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs);
  20933. return lCodec && rCodec && lCodec.name.toLowerCase() === rCodec.name.toLowerCase();
  20934. };
  20935. localCapabilities.codecs.forEach(function (lCodec) {
  20936. for (var i = 0; i < remoteCapabilities.codecs.length; i++) {
  20937. var rCodec = remoteCapabilities.codecs[i];
  20938. if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() && lCodec.clockRate === rCodec.clockRate) {
  20939. if (lCodec.name.toLowerCase() === 'rtx' && lCodec.parameters && rCodec.parameters.apt) {
  20940. // for RTX we need to find the local rtx that has a apt
  20941. // which points to the same local codec as the remote one.
  20942. if (!rtxCapabilityMatches(lCodec, rCodec, localCapabilities.codecs, remoteCapabilities.codecs)) {
  20943. continue;
  20944. }
  20945. }
  20946. rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy
  20947. // number of channels is the highest common number of channels
  20948. rCodec.numChannels = Math.min(lCodec.numChannels, rCodec.numChannels);
  20949. // push rCodec so we reply with offerer payload type
  20950. commonCapabilities.codecs.push(rCodec);
  20951. // determine common feedback mechanisms
  20952. rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function (fb) {
  20953. for (var j = 0; j < lCodec.rtcpFeedback.length; j++) {
  20954. if (lCodec.rtcpFeedback[j].type === fb.type && lCodec.rtcpFeedback[j].parameter === fb.parameter) {
  20955. return true;
  20956. }
  20957. }
  20958. return false;
  20959. });
  20960. // FIXME: also need to determine .parameters
  20961. // see https://github.com/openpeer/ortc/issues/569
  20962. break;
  20963. }
  20964. }
  20965. });
  20966. localCapabilities.headerExtensions.forEach(function (lHeaderExtension) {
  20967. for (var i = 0; i < remoteCapabilities.headerExtensions.length; i++) {
  20968. var rHeaderExtension = remoteCapabilities.headerExtensions[i];
  20969. if (lHeaderExtension.uri === rHeaderExtension.uri) {
  20970. commonCapabilities.headerExtensions.push(rHeaderExtension);
  20971. break;
  20972. }
  20973. }
  20974. });
  20975. // FIXME: fecMechanisms
  20976. return commonCapabilities;
  20977. }
  20978. // is action=setLocalDescription with type allowed in signalingState
  20979. function isActionAllowedInSignalingState(action, type, signalingState) {
  20980. return {
  20981. offer: {
  20982. setLocalDescription: ['stable', 'have-local-offer'],
  20983. setRemoteDescription: ['stable', 'have-remote-offer']
  20984. },
  20985. answer: {
  20986. setLocalDescription: ['have-remote-offer', 'have-local-pranswer'],
  20987. setRemoteDescription: ['have-local-offer', 'have-remote-pranswer']
  20988. }
  20989. }[type][action].indexOf(signalingState) !== -1;
  20990. }
  20991. function maybeAddCandidate(iceTransport, candidate) {
  20992. // Edge's internal representation adds some fields therefore
  20993. // not all fieldѕ are taken into account.
  20994. var alreadyAdded = iceTransport.getRemoteCandidates().find(function (remoteCandidate) {
  20995. return candidate.foundation === remoteCandidate.foundation && candidate.ip === remoteCandidate.ip && candidate.port === remoteCandidate.port && candidate.priority === remoteCandidate.priority && candidate.protocol === remoteCandidate.protocol && candidate.type === remoteCandidate.type;
  20996. });
  20997. if (!alreadyAdded) {
  20998. iceTransport.addRemoteCandidate(candidate);
  20999. }
  21000. return !alreadyAdded;
  21001. }
  21002. function makeError(name, description) {
  21003. var e = new Error(description);
  21004. e.name = name;
  21005. // legacy error codes from https://heycam.github.io/webidl/#idl-DOMException-error-names
  21006. e.code = {
  21007. NotSupportedError: 9,
  21008. InvalidStateError: 11,
  21009. InvalidAccessError: 15,
  21010. TypeError: undefined,
  21011. OperationError: undefined
  21012. }[name];
  21013. return e;
  21014. }
  21015. module.exports = function (window, edgeVersion) {
  21016. // https://w3c.github.io/mediacapture-main/#mediastream
  21017. // Helper function to add the track to the stream and
  21018. // dispatch the event ourselves.
  21019. function addTrackToStreamAndFireEvent(track, stream) {
  21020. stream.addTrack(track);
  21021. stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack', {
  21022. track: track
  21023. }));
  21024. }
  21025. function removeTrackFromStreamAndFireEvent(track, stream) {
  21026. stream.removeTrack(track);
  21027. stream.dispatchEvent(new window.MediaStreamTrackEvent('removetrack', {
  21028. track: track
  21029. }));
  21030. }
  21031. function fireAddTrack(pc, track, receiver, streams) {
  21032. var trackEvent = new Event('track');
  21033. trackEvent.track = track;
  21034. trackEvent.receiver = receiver;
  21035. trackEvent.transceiver = {
  21036. receiver: receiver
  21037. };
  21038. trackEvent.streams = streams;
  21039. window.setTimeout(function () {
  21040. pc._dispatchEvent('track', trackEvent);
  21041. });
  21042. }
  21043. var RTCPeerConnection = function RTCPeerConnection(config) {
  21044. var pc = this;
  21045. var _eventTarget = document.createDocumentFragment();
  21046. ['addEventListener', 'removeEventListener', 'dispatchEvent'].forEach(function (method) {
  21047. pc[method] = _eventTarget[method].bind(_eventTarget);
  21048. });
  21049. this.canTrickleIceCandidates = null;
  21050. this.needNegotiation = false;
  21051. this.localStreams = [];
  21052. this.remoteStreams = [];
  21053. this._localDescription = null;
  21054. this._remoteDescription = null;
  21055. this.signalingState = 'stable';
  21056. this.iceConnectionState = 'new';
  21057. this.connectionState = 'new';
  21058. this.iceGatheringState = 'new';
  21059. config = JSON.parse(JSON.stringify(config || {}));
  21060. this.usingBundle = config.bundlePolicy === 'max-bundle';
  21061. if (config.rtcpMuxPolicy === 'negotiate') {
  21062. throw makeError('NotSupportedError', 'rtcpMuxPolicy \'negotiate\' is not supported');
  21063. } else if (!config.rtcpMuxPolicy) {
  21064. config.rtcpMuxPolicy = 'require';
  21065. }
  21066. switch (config.iceTransportPolicy) {
  21067. case 'all':
  21068. case 'relay':
  21069. break;
  21070. default:
  21071. config.iceTransportPolicy = 'all';
  21072. break;
  21073. }
  21074. switch (config.bundlePolicy) {
  21075. case 'balanced':
  21076. case 'max-compat':
  21077. case 'max-bundle':
  21078. break;
  21079. default:
  21080. config.bundlePolicy = 'balanced';
  21081. break;
  21082. }
  21083. config.iceServers = filterIceServers(config.iceServers || [], edgeVersion);
  21084. this._iceGatherers = [];
  21085. if (config.iceCandidatePoolSize) {
  21086. for (var i = config.iceCandidatePoolSize; i > 0; i--) {
  21087. this._iceGatherers.push(new window.RTCIceGatherer({
  21088. iceServers: config.iceServers,
  21089. gatherPolicy: config.iceTransportPolicy
  21090. }));
  21091. }
  21092. } else {
  21093. config.iceCandidatePoolSize = 0;
  21094. }
  21095. this._config = config;
  21096. // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ...
  21097. // everything that is needed to describe a SDP m-line.
  21098. this.transceivers = [];
  21099. this._sdpSessionId = SDPUtils.generateSessionId();
  21100. this._sdpSessionVersion = 0;
  21101. this._dtlsRole = undefined; // role for a=setup to use in answers.
  21102. this._isClosed = false;
  21103. };
  21104. Object.defineProperty(RTCPeerConnection.prototype, 'localDescription', {
  21105. configurable: true,
  21106. get: function get() {
  21107. return this._localDescription;
  21108. }
  21109. });
  21110. Object.defineProperty(RTCPeerConnection.prototype, 'remoteDescription', {
  21111. configurable: true,
  21112. get: function get() {
  21113. return this._remoteDescription;
  21114. }
  21115. });
  21116. // set up event handlers on prototype
  21117. RTCPeerConnection.prototype.onicecandidate = null;
  21118. RTCPeerConnection.prototype.onaddstream = null;
  21119. RTCPeerConnection.prototype.ontrack = null;
  21120. RTCPeerConnection.prototype.onremovestream = null;
  21121. RTCPeerConnection.prototype.onsignalingstatechange = null;
  21122. RTCPeerConnection.prototype.oniceconnectionstatechange = null;
  21123. RTCPeerConnection.prototype.onconnectionstatechange = null;
  21124. RTCPeerConnection.prototype.onicegatheringstatechange = null;
  21125. RTCPeerConnection.prototype.onnegotiationneeded = null;
  21126. RTCPeerConnection.prototype.ondatachannel = null;
  21127. RTCPeerConnection.prototype._dispatchEvent = function (name, event) {
  21128. if (this._isClosed) {
  21129. return;
  21130. }
  21131. this.dispatchEvent(event);
  21132. if (typeof this['on' + name] === 'function') {
  21133. this['on' + name](event);
  21134. }
  21135. };
  21136. RTCPeerConnection.prototype._emitGatheringStateChange = function () {
  21137. var event = new Event('icegatheringstatechange');
  21138. this._dispatchEvent('icegatheringstatechange', event);
  21139. };
  21140. RTCPeerConnection.prototype.getConfiguration = function () {
  21141. return this._config;
  21142. };
  21143. RTCPeerConnection.prototype.getLocalStreams = function () {
  21144. return this.localStreams;
  21145. };
  21146. RTCPeerConnection.prototype.getRemoteStreams = function () {
  21147. return this.remoteStreams;
  21148. };
  21149. // internal helper to create a transceiver object.
  21150. // (which is not yet the same as the WebRTC 1.0 transceiver)
  21151. RTCPeerConnection.prototype._createTransceiver = function (kind, doNotAdd) {
  21152. var hasBundleTransport = this.transceivers.length > 0;
  21153. var transceiver = {
  21154. track: null,
  21155. iceGatherer: null,
  21156. iceTransport: null,
  21157. dtlsTransport: null,
  21158. localCapabilities: null,
  21159. remoteCapabilities: null,
  21160. rtpSender: null,
  21161. rtpReceiver: null,
  21162. kind: kind,
  21163. mid: null,
  21164. sendEncodingParameters: null,
  21165. recvEncodingParameters: null,
  21166. stream: null,
  21167. associatedRemoteMediaStreams: [],
  21168. wantReceive: true
  21169. };
  21170. if (this.usingBundle && hasBundleTransport) {
  21171. transceiver.iceTransport = this.transceivers[0].iceTransport;
  21172. transceiver.dtlsTransport = this.transceivers[0].dtlsTransport;
  21173. } else {
  21174. var transports = this._createIceAndDtlsTransports();
  21175. transceiver.iceTransport = transports.iceTransport;
  21176. transceiver.dtlsTransport = transports.dtlsTransport;
  21177. }
  21178. if (!doNotAdd) {
  21179. this.transceivers.push(transceiver);
  21180. }
  21181. return transceiver;
  21182. };
  21183. RTCPeerConnection.prototype.addTrack = function (track, stream) {
  21184. if (this._isClosed) {
  21185. throw makeError('InvalidStateError', 'Attempted to call addTrack on a closed peerconnection.');
  21186. }
  21187. var alreadyExists = this.transceivers.find(function (s) {
  21188. return s.track === track;
  21189. });
  21190. if (alreadyExists) {
  21191. throw makeError('InvalidAccessError', 'Track already exists.');
  21192. }
  21193. var transceiver;
  21194. for (var i = 0; i < this.transceivers.length; i++) {
  21195. if (!this.transceivers[i].track && this.transceivers[i].kind === track.kind) {
  21196. transceiver = this.transceivers[i];
  21197. }
  21198. }
  21199. if (!transceiver) {
  21200. transceiver = this._createTransceiver(track.kind);
  21201. }
  21202. this._maybeFireNegotiationNeeded();
  21203. if (this.localStreams.indexOf(stream) === -1) {
  21204. this.localStreams.push(stream);
  21205. }
  21206. transceiver.track = track;
  21207. transceiver.stream = stream;
  21208. transceiver.rtpSender = new window.RTCRtpSender(track, transceiver.dtlsTransport);
  21209. return transceiver.rtpSender;
  21210. };
  21211. RTCPeerConnection.prototype.addStream = function (stream) {
  21212. var pc = this;
  21213. if (edgeVersion >= 15025) {
  21214. stream.getTracks().forEach(function (track) {
  21215. pc.addTrack(track, stream);
  21216. });
  21217. } else {
  21218. // Clone is necessary for local demos mostly, attaching directly
  21219. // to two different senders does not work (build 10547).
  21220. // Fixed in 15025 (or earlier)
  21221. var clonedStream = stream.clone();
  21222. stream.getTracks().forEach(function (track, idx) {
  21223. var clonedTrack = clonedStream.getTracks()[idx];
  21224. track.addEventListener('enabled', function (event) {
  21225. clonedTrack.enabled = event.enabled;
  21226. });
  21227. });
  21228. clonedStream.getTracks().forEach(function (track) {
  21229. pc.addTrack(track, clonedStream);
  21230. });
  21231. }
  21232. };
  21233. RTCPeerConnection.prototype.removeTrack = function (sender) {
  21234. if (this._isClosed) {
  21235. throw makeError('InvalidStateError', 'Attempted to call removeTrack on a closed peerconnection.');
  21236. }
  21237. if (!(sender instanceof window.RTCRtpSender)) {
  21238. throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.');
  21239. }
  21240. var transceiver = this.transceivers.find(function (t) {
  21241. return t.rtpSender === sender;
  21242. });
  21243. if (!transceiver) {
  21244. throw makeError('InvalidAccessError', 'Sender was not created by this connection.');
  21245. }
  21246. var stream = transceiver.stream;
  21247. transceiver.rtpSender.stop();
  21248. transceiver.rtpSender = null;
  21249. transceiver.track = null;
  21250. transceiver.stream = null;
  21251. // remove the stream from the set of local streams
  21252. var localStreams = this.transceivers.map(function (t) {
  21253. return t.stream;
  21254. });
  21255. if (localStreams.indexOf(stream) === -1 && this.localStreams.indexOf(stream) > -1) {
  21256. this.localStreams.splice(this.localStreams.indexOf(stream), 1);
  21257. }
  21258. this._maybeFireNegotiationNeeded();
  21259. };
  21260. RTCPeerConnection.prototype.removeStream = function (stream) {
  21261. var pc = this;
  21262. stream.getTracks().forEach(function (track) {
  21263. var sender = pc.getSenders().find(function (s) {
  21264. return s.track === track;
  21265. });
  21266. if (sender) {
  21267. pc.removeTrack(sender);
  21268. }
  21269. });
  21270. };
  21271. RTCPeerConnection.prototype.getSenders = function () {
  21272. return this.transceivers.filter(function (transceiver) {
  21273. return !!transceiver.rtpSender;
  21274. }).map(function (transceiver) {
  21275. return transceiver.rtpSender;
  21276. });
  21277. };
  21278. RTCPeerConnection.prototype.getReceivers = function () {
  21279. return this.transceivers.filter(function (transceiver) {
  21280. return !!transceiver.rtpReceiver;
  21281. }).map(function (transceiver) {
  21282. return transceiver.rtpReceiver;
  21283. });
  21284. };
  21285. RTCPeerConnection.prototype._createIceGatherer = function (sdpMLineIndex, usingBundle) {
  21286. var pc = this;
  21287. if (usingBundle && sdpMLineIndex > 0) {
  21288. return this.transceivers[0].iceGatherer;
  21289. } else if (this._iceGatherers.length) {
  21290. return this._iceGatherers.shift();
  21291. }
  21292. var iceGatherer = new window.RTCIceGatherer({
  21293. iceServers: this._config.iceServers,
  21294. gatherPolicy: this._config.iceTransportPolicy
  21295. });
  21296. Object.defineProperty(iceGatherer, 'state', {
  21297. value: 'new',
  21298. writable: true
  21299. });
  21300. this.transceivers[sdpMLineIndex].bufferedCandidateEvents = [];
  21301. this.transceivers[sdpMLineIndex].bufferCandidates = function (event) {
  21302. var end = !event.candidate || Object.keys(event.candidate).length === 0;
  21303. // polyfill since RTCIceGatherer.state is not implemented in
  21304. // Edge 10547 yet.
  21305. iceGatherer.state = end ? 'completed' : 'gathering';
  21306. if (pc.transceivers[sdpMLineIndex].bufferedCandidateEvents !== null) {
  21307. pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event);
  21308. }
  21309. };
  21310. iceGatherer.addEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates);
  21311. return iceGatherer;
  21312. };
  21313. // start gathering from an RTCIceGatherer.
  21314. RTCPeerConnection.prototype._gather = function (mid, sdpMLineIndex) {
  21315. var pc = this;
  21316. var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
  21317. if (iceGatherer.onlocalcandidate) {
  21318. return;
  21319. }
  21320. var bufferedCandidateEvents = this.transceivers[sdpMLineIndex].bufferedCandidateEvents;
  21321. this.transceivers[sdpMLineIndex].bufferedCandidateEvents = null;
  21322. iceGatherer.removeEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates);
  21323. iceGatherer.onlocalcandidate = function (evt) {
  21324. if (pc.usingBundle && sdpMLineIndex > 0) {
  21325. // if we know that we use bundle we can drop candidates with
  21326. // ѕdpMLineIndex > 0. If we don't do this then our state gets
  21327. // confused since we dispose the extra ice gatherer.
  21328. return;
  21329. }
  21330. var event = new Event('icecandidate');
  21331. event.candidate = {
  21332. sdpMid: mid,
  21333. sdpMLineIndex: sdpMLineIndex
  21334. };
  21335. var cand = evt.candidate;
  21336. // Edge emits an empty object for RTCIceCandidateComplete‥
  21337. var end = !cand || Object.keys(cand).length === 0;
  21338. if (end) {
  21339. // polyfill since RTCIceGatherer.state is not implemented in
  21340. // Edge 10547 yet.
  21341. if (iceGatherer.state === 'new' || iceGatherer.state === 'gathering') {
  21342. iceGatherer.state = 'completed';
  21343. }
  21344. } else {
  21345. if (iceGatherer.state === 'new') {
  21346. iceGatherer.state = 'gathering';
  21347. }
  21348. // RTCIceCandidate doesn't have a component, needs to be added
  21349. cand.component = 1;
  21350. // also the usernameFragment. TODO: update SDP to take both variants.
  21351. cand.ufrag = iceGatherer.getLocalParameters().usernameFragment;
  21352. var serializedCandidate = SDPUtils.writeCandidate(cand);
  21353. event.candidate = Object.assign(event.candidate, SDPUtils.parseCandidate(serializedCandidate));
  21354. event.candidate.candidate = serializedCandidate;
  21355. event.candidate.toJSON = function () {
  21356. return {
  21357. candidate: event.candidate.candidate,
  21358. sdpMid: event.candidate.sdpMid,
  21359. sdpMLineIndex: event.candidate.sdpMLineIndex,
  21360. usernameFragment: event.candidate.usernameFragment
  21361. };
  21362. };
  21363. }
  21364. // update local description.
  21365. var sections = SDPUtils.getMediaSections(pc._localDescription.sdp);
  21366. if (!end) {
  21367. sections[event.candidate.sdpMLineIndex] += 'a=' + event.candidate.candidate + '\r\n';
  21368. } else {
  21369. sections[event.candidate.sdpMLineIndex] += 'a=end-of-candidates\r\n';
  21370. }
  21371. pc._localDescription.sdp = SDPUtils.getDescription(pc._localDescription.sdp) + sections.join('');
  21372. var complete = pc.transceivers.every(function (transceiver) {
  21373. return transceiver.iceGatherer && transceiver.iceGatherer.state === 'completed';
  21374. });
  21375. if (pc.iceGatheringState !== 'gathering') {
  21376. pc.iceGatheringState = 'gathering';
  21377. pc._emitGatheringStateChange();
  21378. }
  21379. // Emit candidate. Also emit null candidate when all gatherers are
  21380. // complete.
  21381. if (!end) {
  21382. pc._dispatchEvent('icecandidate', event);
  21383. }
  21384. if (complete) {
  21385. pc._dispatchEvent('icecandidate', new Event('icecandidate'));
  21386. pc.iceGatheringState = 'complete';
  21387. pc._emitGatheringStateChange();
  21388. }
  21389. };
  21390. // emit already gathered candidates.
  21391. window.setTimeout(function () {
  21392. bufferedCandidateEvents.forEach(function (e) {
  21393. iceGatherer.onlocalcandidate(e);
  21394. });
  21395. }, 0);
  21396. };
  21397. // Create ICE transport and DTLS transport.
  21398. RTCPeerConnection.prototype._createIceAndDtlsTransports = function () {
  21399. var pc = this;
  21400. var iceTransport = new window.RTCIceTransport(null);
  21401. iceTransport.onicestatechange = function () {
  21402. pc._updateIceConnectionState();
  21403. pc._updateConnectionState();
  21404. };
  21405. var dtlsTransport = new window.RTCDtlsTransport(iceTransport);
  21406. dtlsTransport.ondtlsstatechange = function () {
  21407. pc._updateConnectionState();
  21408. };
  21409. dtlsTransport.onerror = function () {
  21410. // onerror does not set state to failed by itself.
  21411. Object.defineProperty(dtlsTransport, 'state', {
  21412. value: 'failed',
  21413. writable: true
  21414. });
  21415. pc._updateConnectionState();
  21416. };
  21417. return {
  21418. iceTransport: iceTransport,
  21419. dtlsTransport: dtlsTransport
  21420. };
  21421. };
  21422. // Destroy ICE gatherer, ICE transport and DTLS transport.
  21423. // Without triggering the callbacks.
  21424. RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function (sdpMLineIndex) {
  21425. var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
  21426. if (iceGatherer) {
  21427. delete iceGatherer.onlocalcandidate;
  21428. delete this.transceivers[sdpMLineIndex].iceGatherer;
  21429. }
  21430. var iceTransport = this.transceivers[sdpMLineIndex].iceTransport;
  21431. if (iceTransport) {
  21432. delete iceTransport.onicestatechange;
  21433. delete this.transceivers[sdpMLineIndex].iceTransport;
  21434. }
  21435. var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport;
  21436. if (dtlsTransport) {
  21437. delete dtlsTransport.ondtlsstatechange;
  21438. delete dtlsTransport.onerror;
  21439. delete this.transceivers[sdpMLineIndex].dtlsTransport;
  21440. }
  21441. };
  21442. // Start the RTP Sender and Receiver for a transceiver.
  21443. RTCPeerConnection.prototype._transceive = function (transceiver, send, recv) {
  21444. var params = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
  21445. if (send && transceiver.rtpSender) {
  21446. params.encodings = transceiver.sendEncodingParameters;
  21447. params.rtcp = {
  21448. cname: SDPUtils.localCName,
  21449. compound: transceiver.rtcpParameters.compound
  21450. };
  21451. if (transceiver.recvEncodingParameters.length) {
  21452. params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc;
  21453. }
  21454. transceiver.rtpSender.send(params);
  21455. }
  21456. if (recv && transceiver.rtpReceiver && params.codecs.length > 0) {
  21457. // remove RTX field in Edge 14942
  21458. if (transceiver.kind === 'video' && transceiver.recvEncodingParameters && edgeVersion < 15019) {
  21459. transceiver.recvEncodingParameters.forEach(function (p) {
  21460. delete p.rtx;
  21461. });
  21462. }
  21463. if (transceiver.recvEncodingParameters.length) {
  21464. params.encodings = transceiver.recvEncodingParameters;
  21465. } else {
  21466. params.encodings = [{}];
  21467. }
  21468. params.rtcp = {
  21469. compound: transceiver.rtcpParameters.compound
  21470. };
  21471. if (transceiver.rtcpParameters.cname) {
  21472. params.rtcp.cname = transceiver.rtcpParameters.cname;
  21473. }
  21474. if (transceiver.sendEncodingParameters.length) {
  21475. params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc;
  21476. }
  21477. transceiver.rtpReceiver.receive(params);
  21478. }
  21479. };
  21480. RTCPeerConnection.prototype.setLocalDescription = function (description) {
  21481. var pc = this;
  21482. // Note: pranswer is not supported.
  21483. if (['offer', 'answer'].indexOf(description.type) === -1) {
  21484. return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"'));
  21485. }
  21486. if (!isActionAllowedInSignalingState('setLocalDescription', description.type, pc.signalingState) || pc._isClosed) {
  21487. return Promise.reject(makeError('InvalidStateError', 'Can not set local ' + description.type + ' in state ' + pc.signalingState));
  21488. }
  21489. var sections;
  21490. var sessionpart;
  21491. if (description.type === 'offer') {
  21492. // VERY limited support for SDP munging. Limited to:
  21493. // * changing the order of codecs
  21494. sections = SDPUtils.splitSections(description.sdp);
  21495. sessionpart = sections.shift();
  21496. sections.forEach(function (mediaSection, sdpMLineIndex) {
  21497. var caps = SDPUtils.parseRtpParameters(mediaSection);
  21498. pc.transceivers[sdpMLineIndex].localCapabilities = caps;
  21499. });
  21500. pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
  21501. pc._gather(transceiver.mid, sdpMLineIndex);
  21502. });
  21503. } else if (description.type === 'answer') {
  21504. sections = SDPUtils.splitSections(pc._remoteDescription.sdp);
  21505. sessionpart = sections.shift();
  21506. var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0;
  21507. sections.forEach(function (mediaSection, sdpMLineIndex) {
  21508. var transceiver = pc.transceivers[sdpMLineIndex];
  21509. var iceGatherer = transceiver.iceGatherer;
  21510. var iceTransport = transceiver.iceTransport;
  21511. var dtlsTransport = transceiver.dtlsTransport;
  21512. var localCapabilities = transceiver.localCapabilities;
  21513. var remoteCapabilities = transceiver.remoteCapabilities;
  21514. // treat bundle-only as not-rejected.
  21515. var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;
  21516. if (!rejected && !transceiver.rejected) {
  21517. var remoteIceParameters = SDPUtils.getIceParameters(mediaSection, sessionpart);
  21518. var remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection, sessionpart);
  21519. if (isIceLite) {
  21520. remoteDtlsParameters.role = 'server';
  21521. }
  21522. if (!pc.usingBundle || sdpMLineIndex === 0) {
  21523. pc._gather(transceiver.mid, sdpMLineIndex);
  21524. if (iceTransport.state === 'new') {
  21525. iceTransport.start(iceGatherer, remoteIceParameters, isIceLite ? 'controlling' : 'controlled');
  21526. }
  21527. if (dtlsTransport.state === 'new') {
  21528. dtlsTransport.start(remoteDtlsParameters);
  21529. }
  21530. }
  21531. // Calculate intersection of capabilities.
  21532. var params = getCommonCapabilities(localCapabilities, remoteCapabilities);
  21533. // Start the RTCRtpSender. The RTCRtpReceiver for this
  21534. // transceiver has already been started in setRemoteDescription.
  21535. pc._transceive(transceiver, params.codecs.length > 0, false);
  21536. }
  21537. });
  21538. }
  21539. pc._localDescription = {
  21540. type: description.type,
  21541. sdp: description.sdp
  21542. };
  21543. if (description.type === 'offer') {
  21544. pc._updateSignalingState('have-local-offer');
  21545. } else {
  21546. pc._updateSignalingState('stable');
  21547. }
  21548. return Promise.resolve();
  21549. };
  21550. RTCPeerConnection.prototype.setRemoteDescription = function (description) {
  21551. var pc = this;
  21552. // Note: pranswer is not supported.
  21553. if (['offer', 'answer'].indexOf(description.type) === -1) {
  21554. return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"'));
  21555. }
  21556. if (!isActionAllowedInSignalingState('setRemoteDescription', description.type, pc.signalingState) || pc._isClosed) {
  21557. return Promise.reject(makeError('InvalidStateError', 'Can not set remote ' + description.type + ' in state ' + pc.signalingState));
  21558. }
  21559. var streams = {};
  21560. pc.remoteStreams.forEach(function (stream) {
  21561. streams[stream.id] = stream;
  21562. });
  21563. var receiverList = [];
  21564. var sections = SDPUtils.splitSections(description.sdp);
  21565. var sessionpart = sections.shift();
  21566. var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0;
  21567. var usingBundle = SDPUtils.matchPrefix(sessionpart, 'a=group:BUNDLE ').length > 0;
  21568. pc.usingBundle = usingBundle;
  21569. var iceOptions = SDPUtils.matchPrefix(sessionpart, 'a=ice-options:')[0];
  21570. if (iceOptions) {
  21571. pc.canTrickleIceCandidates = iceOptions.substr(14).split(' ').indexOf('trickle') >= 0;
  21572. } else {
  21573. pc.canTrickleIceCandidates = false;
  21574. }
  21575. sections.forEach(function (mediaSection, sdpMLineIndex) {
  21576. var lines = SDPUtils.splitLines(mediaSection);
  21577. var kind = SDPUtils.getKind(mediaSection);
  21578. // treat bundle-only as not-rejected.
  21579. var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;
  21580. var protocol = lines[0].substr(2).split(' ')[2];
  21581. var direction = SDPUtils.getDirection(mediaSection, sessionpart);
  21582. var remoteMsid = SDPUtils.parseMsid(mediaSection);
  21583. var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier();
  21584. // Reject datachannels which are not implemented yet.
  21585. if (rejected || kind === 'application' && (protocol === 'DTLS/SCTP' || protocol === 'UDP/DTLS/SCTP')) {
  21586. // TODO: this is dangerous in the case where a non-rejected m-line
  21587. // becomes rejected.
  21588. pc.transceivers[sdpMLineIndex] = {
  21589. mid: mid,
  21590. kind: kind,
  21591. protocol: protocol,
  21592. rejected: true
  21593. };
  21594. return;
  21595. }
  21596. if (!rejected && pc.transceivers[sdpMLineIndex] && pc.transceivers[sdpMLineIndex].rejected) {
  21597. // recycle a rejected transceiver.
  21598. pc.transceivers[sdpMLineIndex] = pc._createTransceiver(kind, true);
  21599. }
  21600. var transceiver;
  21601. var iceGatherer;
  21602. var iceTransport;
  21603. var dtlsTransport;
  21604. var rtpReceiver;
  21605. var sendEncodingParameters;
  21606. var recvEncodingParameters;
  21607. var localCapabilities;
  21608. var track;
  21609. // FIXME: ensure the mediaSection has rtcp-mux set.
  21610. var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);
  21611. var remoteIceParameters;
  21612. var remoteDtlsParameters;
  21613. if (!rejected) {
  21614. remoteIceParameters = SDPUtils.getIceParameters(mediaSection, sessionpart);
  21615. remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection, sessionpart);
  21616. remoteDtlsParameters.role = 'client';
  21617. }
  21618. recvEncodingParameters = SDPUtils.parseRtpEncodingParameters(mediaSection);
  21619. var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection);
  21620. var isComplete = SDPUtils.matchPrefix(mediaSection, 'a=end-of-candidates', sessionpart).length > 0;
  21621. var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:').map(function (cand) {
  21622. return SDPUtils.parseCandidate(cand);
  21623. }).filter(function (cand) {
  21624. return cand.component === 1;
  21625. });
  21626. // Check if we can use BUNDLE and dispose transports.
  21627. if ((description.type === 'offer' || description.type === 'answer') && !rejected && usingBundle && sdpMLineIndex > 0 && pc.transceivers[sdpMLineIndex]) {
  21628. pc._disposeIceAndDtlsTransports(sdpMLineIndex);
  21629. pc.transceivers[sdpMLineIndex].iceGatherer = pc.transceivers[0].iceGatherer;
  21630. pc.transceivers[sdpMLineIndex].iceTransport = pc.transceivers[0].iceTransport;
  21631. pc.transceivers[sdpMLineIndex].dtlsTransport = pc.transceivers[0].dtlsTransport;
  21632. if (pc.transceivers[sdpMLineIndex].rtpSender) {
  21633. pc.transceivers[sdpMLineIndex].rtpSender.setTransport(pc.transceivers[0].dtlsTransport);
  21634. }
  21635. if (pc.transceivers[sdpMLineIndex].rtpReceiver) {
  21636. pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(pc.transceivers[0].dtlsTransport);
  21637. }
  21638. }
  21639. if (description.type === 'offer' && !rejected) {
  21640. transceiver = pc.transceivers[sdpMLineIndex] || pc._createTransceiver(kind);
  21641. transceiver.mid = mid;
  21642. if (!transceiver.iceGatherer) {
  21643. transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, usingBundle);
  21644. }
  21645. if (cands.length && transceiver.iceTransport.state === 'new') {
  21646. if (isComplete && (!usingBundle || sdpMLineIndex === 0)) {
  21647. transceiver.iceTransport.setRemoteCandidates(cands);
  21648. } else {
  21649. cands.forEach(function (candidate) {
  21650. maybeAddCandidate(transceiver.iceTransport, candidate);
  21651. });
  21652. }
  21653. }
  21654. localCapabilities = window.RTCRtpReceiver.getCapabilities(kind);
  21655. // filter RTX until additional stuff needed for RTX is implemented
  21656. // in adapter.js
  21657. if (edgeVersion < 15019) {
  21658. localCapabilities.codecs = localCapabilities.codecs.filter(function (codec) {
  21659. return codec.name !== 'rtx';
  21660. });
  21661. }
  21662. sendEncodingParameters = transceiver.sendEncodingParameters || [{
  21663. ssrc: (2 * sdpMLineIndex + 2) * 1001
  21664. }];
  21665. // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
  21666. var isNewTrack = false;
  21667. if (direction === 'sendrecv' || direction === 'sendonly') {
  21668. isNewTrack = !transceiver.rtpReceiver;
  21669. rtpReceiver = transceiver.rtpReceiver || new window.RTCRtpReceiver(transceiver.dtlsTransport, kind);
  21670. if (isNewTrack) {
  21671. var stream;
  21672. track = rtpReceiver.track;
  21673. // FIXME: does not work with Plan B.
  21674. if (remoteMsid && remoteMsid.stream === '-') ; else if (remoteMsid) {
  21675. if (!streams[remoteMsid.stream]) {
  21676. streams[remoteMsid.stream] = new window.MediaStream();
  21677. Object.defineProperty(streams[remoteMsid.stream], 'id', {
  21678. get: function get() {
  21679. return remoteMsid.stream;
  21680. }
  21681. });
  21682. }
  21683. Object.defineProperty(track, 'id', {
  21684. get: function get() {
  21685. return remoteMsid.track;
  21686. }
  21687. });
  21688. stream = streams[remoteMsid.stream];
  21689. } else {
  21690. if (!streams["default"]) {
  21691. streams["default"] = new window.MediaStream();
  21692. }
  21693. stream = streams["default"];
  21694. }
  21695. if (stream) {
  21696. addTrackToStreamAndFireEvent(track, stream);
  21697. transceiver.associatedRemoteMediaStreams.push(stream);
  21698. }
  21699. receiverList.push([track, rtpReceiver, stream]);
  21700. }
  21701. } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track) {
  21702. transceiver.associatedRemoteMediaStreams.forEach(function (s) {
  21703. var nativeTrack = s.getTracks().find(function (t) {
  21704. return t.id === transceiver.rtpReceiver.track.id;
  21705. });
  21706. if (nativeTrack) {
  21707. removeTrackFromStreamAndFireEvent(nativeTrack, s);
  21708. }
  21709. });
  21710. transceiver.associatedRemoteMediaStreams = [];
  21711. }
  21712. transceiver.localCapabilities = localCapabilities;
  21713. transceiver.remoteCapabilities = remoteCapabilities;
  21714. transceiver.rtpReceiver = rtpReceiver;
  21715. transceiver.rtcpParameters = rtcpParameters;
  21716. transceiver.sendEncodingParameters = sendEncodingParameters;
  21717. transceiver.recvEncodingParameters = recvEncodingParameters;
  21718. // Start the RTCRtpReceiver now. The RTPSender is started in
  21719. // setLocalDescription.
  21720. pc._transceive(pc.transceivers[sdpMLineIndex], false, isNewTrack);
  21721. } else if (description.type === 'answer' && !rejected) {
  21722. transceiver = pc.transceivers[sdpMLineIndex];
  21723. iceGatherer = transceiver.iceGatherer;
  21724. iceTransport = transceiver.iceTransport;
  21725. dtlsTransport = transceiver.dtlsTransport;
  21726. rtpReceiver = transceiver.rtpReceiver;
  21727. sendEncodingParameters = transceiver.sendEncodingParameters;
  21728. localCapabilities = transceiver.localCapabilities;
  21729. pc.transceivers[sdpMLineIndex].recvEncodingParameters = recvEncodingParameters;
  21730. pc.transceivers[sdpMLineIndex].remoteCapabilities = remoteCapabilities;
  21731. pc.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters;
  21732. if (cands.length && iceTransport.state === 'new') {
  21733. if ((isIceLite || isComplete) && (!usingBundle || sdpMLineIndex === 0)) {
  21734. iceTransport.setRemoteCandidates(cands);
  21735. } else {
  21736. cands.forEach(function (candidate) {
  21737. maybeAddCandidate(transceiver.iceTransport, candidate);
  21738. });
  21739. }
  21740. }
  21741. if (!usingBundle || sdpMLineIndex === 0) {
  21742. if (iceTransport.state === 'new') {
  21743. iceTransport.start(iceGatherer, remoteIceParameters, 'controlling');
  21744. }
  21745. if (dtlsTransport.state === 'new') {
  21746. dtlsTransport.start(remoteDtlsParameters);
  21747. }
  21748. }
  21749. // If the offer contained RTX but the answer did not,
  21750. // remove RTX from sendEncodingParameters.
  21751. var commonCapabilities = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
  21752. var hasRtx = commonCapabilities.codecs.filter(function (c) {
  21753. return c.name.toLowerCase() === 'rtx';
  21754. }).length;
  21755. if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
  21756. delete transceiver.sendEncodingParameters[0].rtx;
  21757. }
  21758. pc._transceive(transceiver, direction === 'sendrecv' || direction === 'recvonly', direction === 'sendrecv' || direction === 'sendonly');
  21759. // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
  21760. if (rtpReceiver && (direction === 'sendrecv' || direction === 'sendonly')) {
  21761. track = rtpReceiver.track;
  21762. if (remoteMsid) {
  21763. if (!streams[remoteMsid.stream]) {
  21764. streams[remoteMsid.stream] = new window.MediaStream();
  21765. }
  21766. addTrackToStreamAndFireEvent(track, streams[remoteMsid.stream]);
  21767. receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]);
  21768. } else {
  21769. if (!streams["default"]) {
  21770. streams["default"] = new window.MediaStream();
  21771. }
  21772. addTrackToStreamAndFireEvent(track, streams["default"]);
  21773. receiverList.push([track, rtpReceiver, streams["default"]]);
  21774. }
  21775. } else {
  21776. // FIXME: actually the receiver should be created later.
  21777. delete transceiver.rtpReceiver;
  21778. }
  21779. }
  21780. });
  21781. if (pc._dtlsRole === undefined) {
  21782. pc._dtlsRole = description.type === 'offer' ? 'active' : 'passive';
  21783. }
  21784. pc._remoteDescription = {
  21785. type: description.type,
  21786. sdp: description.sdp
  21787. };
  21788. if (description.type === 'offer') {
  21789. pc._updateSignalingState('have-remote-offer');
  21790. } else {
  21791. pc._updateSignalingState('stable');
  21792. }
  21793. Object.keys(streams).forEach(function (sid) {
  21794. var stream = streams[sid];
  21795. if (stream.getTracks().length) {
  21796. if (pc.remoteStreams.indexOf(stream) === -1) {
  21797. pc.remoteStreams.push(stream);
  21798. var event = new Event('addstream');
  21799. event.stream = stream;
  21800. window.setTimeout(function () {
  21801. pc._dispatchEvent('addstream', event);
  21802. });
  21803. }
  21804. receiverList.forEach(function (item) {
  21805. var track = item[0];
  21806. var receiver = item[1];
  21807. if (stream.id !== item[2].id) {
  21808. return;
  21809. }
  21810. fireAddTrack(pc, track, receiver, [stream]);
  21811. });
  21812. }
  21813. });
  21814. receiverList.forEach(function (item) {
  21815. if (item[2]) {
  21816. return;
  21817. }
  21818. fireAddTrack(pc, item[0], item[1], []);
  21819. });
  21820. // check whether addIceCandidate({}) was called within four seconds after
  21821. // setRemoteDescription.
  21822. window.setTimeout(function () {
  21823. if (!(pc && pc.transceivers)) {
  21824. return;
  21825. }
  21826. pc.transceivers.forEach(function (transceiver) {
  21827. if (transceiver.iceTransport && transceiver.iceTransport.state === 'new' && transceiver.iceTransport.getRemoteCandidates().length > 0) {
  21828. console.warn('Timeout for addRemoteCandidate. Consider sending ' + 'an end-of-candidates notification');
  21829. transceiver.iceTransport.addRemoteCandidate({});
  21830. }
  21831. });
  21832. }, 4000);
  21833. return Promise.resolve();
  21834. };
  21835. RTCPeerConnection.prototype.close = function () {
  21836. this.transceivers.forEach(function (transceiver) {
  21837. /* not yet
  21838. if (transceiver.iceGatherer) {
  21839. transceiver.iceGatherer.close();
  21840. }
  21841. */
  21842. if (transceiver.iceTransport) {
  21843. transceiver.iceTransport.stop();
  21844. }
  21845. if (transceiver.dtlsTransport) {
  21846. transceiver.dtlsTransport.stop();
  21847. }
  21848. if (transceiver.rtpSender) {
  21849. transceiver.rtpSender.stop();
  21850. }
  21851. if (transceiver.rtpReceiver) {
  21852. transceiver.rtpReceiver.stop();
  21853. }
  21854. });
  21855. // FIXME: clean up tracks, local streams, remote streams, etc
  21856. this._isClosed = true;
  21857. this._updateSignalingState('closed');
  21858. };
  21859. // Update the signaling state.
  21860. RTCPeerConnection.prototype._updateSignalingState = function (newState) {
  21861. this.signalingState = newState;
  21862. var event = new Event('signalingstatechange');
  21863. this._dispatchEvent('signalingstatechange', event);
  21864. };
  21865. // Determine whether to fire the negotiationneeded event.
  21866. RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function () {
  21867. var pc = this;
  21868. if (this.signalingState !== 'stable' || this.needNegotiation === true) {
  21869. return;
  21870. }
  21871. this.needNegotiation = true;
  21872. window.setTimeout(function () {
  21873. if (pc.needNegotiation) {
  21874. pc.needNegotiation = false;
  21875. var event = new Event('negotiationneeded');
  21876. pc._dispatchEvent('negotiationneeded', event);
  21877. }
  21878. }, 0);
  21879. };
  21880. // Update the ice connection state.
  21881. RTCPeerConnection.prototype._updateIceConnectionState = function () {
  21882. var newState;
  21883. var states = {
  21884. 'new': 0,
  21885. closed: 0,
  21886. checking: 0,
  21887. connected: 0,
  21888. completed: 0,
  21889. disconnected: 0,
  21890. failed: 0
  21891. };
  21892. this.transceivers.forEach(function (transceiver) {
  21893. if (transceiver.iceTransport && !transceiver.rejected) {
  21894. states[transceiver.iceTransport.state]++;
  21895. }
  21896. });
  21897. newState = 'new';
  21898. if (states.failed > 0) {
  21899. newState = 'failed';
  21900. } else if (states.checking > 0) {
  21901. newState = 'checking';
  21902. } else if (states.disconnected > 0) {
  21903. newState = 'disconnected';
  21904. } else if (states["new"] > 0) {
  21905. newState = 'new';
  21906. } else if (states.connected > 0) {
  21907. newState = 'connected';
  21908. } else if (states.completed > 0) {
  21909. newState = 'completed';
  21910. }
  21911. if (newState !== this.iceConnectionState) {
  21912. this.iceConnectionState = newState;
  21913. var event = new Event('iceconnectionstatechange');
  21914. this._dispatchEvent('iceconnectionstatechange', event);
  21915. }
  21916. };
  21917. // Update the connection state.
  21918. RTCPeerConnection.prototype._updateConnectionState = function () {
  21919. var newState;
  21920. var states = {
  21921. 'new': 0,
  21922. closed: 0,
  21923. connecting: 0,
  21924. connected: 0,
  21925. completed: 0,
  21926. disconnected: 0,
  21927. failed: 0
  21928. };
  21929. this.transceivers.forEach(function (transceiver) {
  21930. if (transceiver.iceTransport && transceiver.dtlsTransport && !transceiver.rejected) {
  21931. states[transceiver.iceTransport.state]++;
  21932. states[transceiver.dtlsTransport.state]++;
  21933. }
  21934. });
  21935. // ICETransport.completed and connected are the same for this purpose.
  21936. states.connected += states.completed;
  21937. newState = 'new';
  21938. if (states.failed > 0) {
  21939. newState = 'failed';
  21940. } else if (states.connecting > 0) {
  21941. newState = 'connecting';
  21942. } else if (states.disconnected > 0) {
  21943. newState = 'disconnected';
  21944. } else if (states["new"] > 0) {
  21945. newState = 'new';
  21946. } else if (states.connected > 0) {
  21947. newState = 'connected';
  21948. }
  21949. if (newState !== this.connectionState) {
  21950. this.connectionState = newState;
  21951. var event = new Event('connectionstatechange');
  21952. this._dispatchEvent('connectionstatechange', event);
  21953. }
  21954. };
  21955. RTCPeerConnection.prototype.createOffer = function () {
  21956. var pc = this;
  21957. if (pc._isClosed) {
  21958. return Promise.reject(makeError('InvalidStateError', 'Can not call createOffer after close'));
  21959. }
  21960. var numAudioTracks = pc.transceivers.filter(function (t) {
  21961. return t.kind === 'audio';
  21962. }).length;
  21963. var numVideoTracks = pc.transceivers.filter(function (t) {
  21964. return t.kind === 'video';
  21965. }).length;
  21966. // Determine number of audio and video tracks we need to send/recv.
  21967. var offerOptions = arguments[0];
  21968. if (offerOptions) {
  21969. // Reject Chrome legacy constraints.
  21970. if (offerOptions.mandatory || offerOptions.optional) {
  21971. throw new TypeError('Legacy mandatory/optional constraints not supported.');
  21972. }
  21973. if (offerOptions.offerToReceiveAudio !== undefined) {
  21974. if (offerOptions.offerToReceiveAudio === true) {
  21975. numAudioTracks = 1;
  21976. } else if (offerOptions.offerToReceiveAudio === false) {
  21977. numAudioTracks = 0;
  21978. } else {
  21979. numAudioTracks = offerOptions.offerToReceiveAudio;
  21980. }
  21981. }
  21982. if (offerOptions.offerToReceiveVideo !== undefined) {
  21983. if (offerOptions.offerToReceiveVideo === true) {
  21984. numVideoTracks = 1;
  21985. } else if (offerOptions.offerToReceiveVideo === false) {
  21986. numVideoTracks = 0;
  21987. } else {
  21988. numVideoTracks = offerOptions.offerToReceiveVideo;
  21989. }
  21990. }
  21991. }
  21992. pc.transceivers.forEach(function (transceiver) {
  21993. if (transceiver.kind === 'audio') {
  21994. numAudioTracks--;
  21995. if (numAudioTracks < 0) {
  21996. transceiver.wantReceive = false;
  21997. }
  21998. } else if (transceiver.kind === 'video') {
  21999. numVideoTracks--;
  22000. if (numVideoTracks < 0) {
  22001. transceiver.wantReceive = false;
  22002. }
  22003. }
  22004. });
  22005. // Create M-lines for recvonly streams.
  22006. while (numAudioTracks > 0 || numVideoTracks > 0) {
  22007. if (numAudioTracks > 0) {
  22008. pc._createTransceiver('audio');
  22009. numAudioTracks--;
  22010. }
  22011. if (numVideoTracks > 0) {
  22012. pc._createTransceiver('video');
  22013. numVideoTracks--;
  22014. }
  22015. }
  22016. var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++);
  22017. pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
  22018. // For each track, create an ice gatherer, ice transport,
  22019. // dtls transport, potentially rtpsender and rtpreceiver.
  22020. var track = transceiver.track;
  22021. var kind = transceiver.kind;
  22022. var mid = transceiver.mid || SDPUtils.generateIdentifier();
  22023. transceiver.mid = mid;
  22024. if (!transceiver.iceGatherer) {
  22025. transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, pc.usingBundle);
  22026. }
  22027. var localCapabilities = window.RTCRtpSender.getCapabilities(kind);
  22028. // filter RTX until additional stuff needed for RTX is implemented
  22029. // in adapter.js
  22030. if (edgeVersion < 15019) {
  22031. localCapabilities.codecs = localCapabilities.codecs.filter(function (codec) {
  22032. return codec.name !== 'rtx';
  22033. });
  22034. }
  22035. localCapabilities.codecs.forEach(function (codec) {
  22036. // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552
  22037. // by adding level-asymmetry-allowed=1
  22038. if (codec.name === 'H264' && codec.parameters['level-asymmetry-allowed'] === undefined) {
  22039. codec.parameters['level-asymmetry-allowed'] = '1';
  22040. }
  22041. // for subsequent offers, we might have to re-use the payload
  22042. // type of the last offer.
  22043. if (transceiver.remoteCapabilities && transceiver.remoteCapabilities.codecs) {
  22044. transceiver.remoteCapabilities.codecs.forEach(function (remoteCodec) {
  22045. if (codec.name.toLowerCase() === remoteCodec.name.toLowerCase() && codec.clockRate === remoteCodec.clockRate) {
  22046. codec.preferredPayloadType = remoteCodec.payloadType;
  22047. }
  22048. });
  22049. }
  22050. });
  22051. localCapabilities.headerExtensions.forEach(function (hdrExt) {
  22052. var remoteExtensions = transceiver.remoteCapabilities && transceiver.remoteCapabilities.headerExtensions || [];
  22053. remoteExtensions.forEach(function (rHdrExt) {
  22054. if (hdrExt.uri === rHdrExt.uri) {
  22055. hdrExt.id = rHdrExt.id;
  22056. }
  22057. });
  22058. });
  22059. // generate an ssrc now, to be used later in rtpSender.send
  22060. var sendEncodingParameters = transceiver.sendEncodingParameters || [{
  22061. ssrc: (2 * sdpMLineIndex + 1) * 1001
  22062. }];
  22063. if (track) {
  22064. // add RTX
  22065. if (edgeVersion >= 15019 && kind === 'video' && !sendEncodingParameters[0].rtx) {
  22066. sendEncodingParameters[0].rtx = {
  22067. ssrc: sendEncodingParameters[0].ssrc + 1
  22068. };
  22069. }
  22070. }
  22071. if (transceiver.wantReceive) {
  22072. transceiver.rtpReceiver = new window.RTCRtpReceiver(transceiver.dtlsTransport, kind);
  22073. }
  22074. transceiver.localCapabilities = localCapabilities;
  22075. transceiver.sendEncodingParameters = sendEncodingParameters;
  22076. });
  22077. // always offer BUNDLE and dispose on return if not supported.
  22078. if (pc._config.bundlePolicy !== 'max-compat') {
  22079. sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function (t) {
  22080. return t.mid;
  22081. }).join(' ') + '\r\n';
  22082. }
  22083. sdp += 'a=ice-options:trickle\r\n';
  22084. pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
  22085. sdp += writeMediaSection(transceiver, transceiver.localCapabilities, 'offer', transceiver.stream, pc._dtlsRole);
  22086. sdp += 'a=rtcp-rsize\r\n';
  22087. if (transceiver.iceGatherer && pc.iceGatheringState !== 'new' && (sdpMLineIndex === 0 || !pc.usingBundle)) {
  22088. transceiver.iceGatherer.getLocalCandidates().forEach(function (cand) {
  22089. cand.component = 1;
  22090. sdp += 'a=' + SDPUtils.writeCandidate(cand) + '\r\n';
  22091. });
  22092. if (transceiver.iceGatherer.state === 'completed') {
  22093. sdp += 'a=end-of-candidates\r\n';
  22094. }
  22095. }
  22096. });
  22097. var desc = new window.RTCSessionDescription({
  22098. type: 'offer',
  22099. sdp: sdp
  22100. });
  22101. return Promise.resolve(desc);
  22102. };
  22103. RTCPeerConnection.prototype.createAnswer = function () {
  22104. var pc = this;
  22105. if (pc._isClosed) {
  22106. return Promise.reject(makeError('InvalidStateError', 'Can not call createAnswer after close'));
  22107. }
  22108. if (!(pc.signalingState === 'have-remote-offer' || pc.signalingState === 'have-local-pranswer')) {
  22109. return Promise.reject(makeError('InvalidStateError', 'Can not call createAnswer in signalingState ' + pc.signalingState));
  22110. }
  22111. var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++);
  22112. if (pc.usingBundle) {
  22113. sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function (t) {
  22114. return t.mid;
  22115. }).join(' ') + '\r\n';
  22116. }
  22117. sdp += 'a=ice-options:trickle\r\n';
  22118. var mediaSectionsInOffer = SDPUtils.getMediaSections(pc._remoteDescription.sdp).length;
  22119. pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
  22120. if (sdpMLineIndex + 1 > mediaSectionsInOffer) {
  22121. return;
  22122. }
  22123. if (transceiver.rejected) {
  22124. if (transceiver.kind === 'application') {
  22125. if (transceiver.protocol === 'DTLS/SCTP') {
  22126. // legacy fmt
  22127. sdp += 'm=application 0 DTLS/SCTP 5000\r\n';
  22128. } else {
  22129. sdp += 'm=application 0 ' + transceiver.protocol + ' webrtc-datachannel\r\n';
  22130. }
  22131. } else if (transceiver.kind === 'audio') {
  22132. sdp += 'm=audio 0 UDP/TLS/RTP/SAVPF 0\r\n' + 'a=rtpmap:0 PCMU/8000\r\n';
  22133. } else if (transceiver.kind === 'video') {
  22134. sdp += 'm=video 0 UDP/TLS/RTP/SAVPF 120\r\n' + 'a=rtpmap:120 VP8/90000\r\n';
  22135. }
  22136. sdp += 'c=IN IP4 0.0.0.0\r\n' + 'a=inactive\r\n' + 'a=mid:' + transceiver.mid + '\r\n';
  22137. return;
  22138. }
  22139. // FIXME: look at direction.
  22140. if (transceiver.stream) {
  22141. var localTrack;
  22142. if (transceiver.kind === 'audio') {
  22143. localTrack = transceiver.stream.getAudioTracks()[0];
  22144. } else if (transceiver.kind === 'video') {
  22145. localTrack = transceiver.stream.getVideoTracks()[0];
  22146. }
  22147. if (localTrack) {
  22148. // add RTX
  22149. if (edgeVersion >= 15019 && transceiver.kind === 'video' && !transceiver.sendEncodingParameters[0].rtx) {
  22150. transceiver.sendEncodingParameters[0].rtx = {
  22151. ssrc: transceiver.sendEncodingParameters[0].ssrc + 1
  22152. };
  22153. }
  22154. }
  22155. }
  22156. // Calculate intersection of capabilities.
  22157. var commonCapabilities = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
  22158. var hasRtx = commonCapabilities.codecs.filter(function (c) {
  22159. return c.name.toLowerCase() === 'rtx';
  22160. }).length;
  22161. if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
  22162. delete transceiver.sendEncodingParameters[0].rtx;
  22163. }
  22164. sdp += writeMediaSection(transceiver, commonCapabilities, 'answer', transceiver.stream, pc._dtlsRole);
  22165. if (transceiver.rtcpParameters && transceiver.rtcpParameters.reducedSize) {
  22166. sdp += 'a=rtcp-rsize\r\n';
  22167. }
  22168. });
  22169. var desc = new window.RTCSessionDescription({
  22170. type: 'answer',
  22171. sdp: sdp
  22172. });
  22173. return Promise.resolve(desc);
  22174. };
  22175. RTCPeerConnection.prototype.addIceCandidate = function (candidate) {
  22176. var pc = this;
  22177. var sections;
  22178. if (candidate && !(candidate.sdpMLineIndex !== undefined || candidate.sdpMid)) {
  22179. return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required'));
  22180. }
  22181. // TODO: needs to go into ops queue.
  22182. return new Promise(function (resolve, reject) {
  22183. if (!pc._remoteDescription) {
  22184. return reject(makeError('InvalidStateError', 'Can not add ICE candidate without a remote description'));
  22185. } else if (!candidate || candidate.candidate === '') {
  22186. for (var j = 0; j < pc.transceivers.length; j++) {
  22187. if (pc.transceivers[j].rejected) {
  22188. continue;
  22189. }
  22190. pc.transceivers[j].iceTransport.addRemoteCandidate({});
  22191. sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
  22192. sections[j] += 'a=end-of-candidates\r\n';
  22193. pc._remoteDescription.sdp = SDPUtils.getDescription(pc._remoteDescription.sdp) + sections.join('');
  22194. if (pc.usingBundle) {
  22195. break;
  22196. }
  22197. }
  22198. } else {
  22199. var sdpMLineIndex = candidate.sdpMLineIndex;
  22200. if (candidate.sdpMid) {
  22201. for (var i = 0; i < pc.transceivers.length; i++) {
  22202. if (pc.transceivers[i].mid === candidate.sdpMid) {
  22203. sdpMLineIndex = i;
  22204. break;
  22205. }
  22206. }
  22207. }
  22208. var transceiver = pc.transceivers[sdpMLineIndex];
  22209. if (transceiver) {
  22210. if (transceiver.rejected) {
  22211. return resolve();
  22212. }
  22213. var cand = Object.keys(candidate.candidate).length > 0 ? SDPUtils.parseCandidate(candidate.candidate) : {};
  22214. // Ignore Chrome's invalid candidates since Edge does not like them.
  22215. if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) {
  22216. return resolve();
  22217. }
  22218. // Ignore RTCP candidates, we assume RTCP-MUX.
  22219. if (cand.component && cand.component !== 1) {
  22220. return resolve();
  22221. }
  22222. // when using bundle, avoid adding candidates to the wrong
  22223. // ice transport. And avoid adding candidates added in the SDP.
  22224. if (sdpMLineIndex === 0 || sdpMLineIndex > 0 && transceiver.iceTransport !== pc.transceivers[0].iceTransport) {
  22225. if (!maybeAddCandidate(transceiver.iceTransport, cand)) {
  22226. return reject(makeError('OperationError', 'Can not add ICE candidate'));
  22227. }
  22228. }
  22229. // update the remoteDescription.
  22230. var candidateString = candidate.candidate.trim();
  22231. if (candidateString.indexOf('a=') === 0) {
  22232. candidateString = candidateString.substr(2);
  22233. }
  22234. sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
  22235. sections[sdpMLineIndex] += 'a=' + (cand.type ? candidateString : 'end-of-candidates') + '\r\n';
  22236. pc._remoteDescription.sdp = SDPUtils.getDescription(pc._remoteDescription.sdp) + sections.join('');
  22237. } else {
  22238. return reject(makeError('OperationError', 'Can not add ICE candidate'));
  22239. }
  22240. }
  22241. resolve();
  22242. });
  22243. };
  22244. RTCPeerConnection.prototype.getStats = function (selector) {
  22245. if (selector && selector instanceof window.MediaStreamTrack) {
  22246. var senderOrReceiver = null;
  22247. this.transceivers.forEach(function (transceiver) {
  22248. if (transceiver.rtpSender && transceiver.rtpSender.track === selector) {
  22249. senderOrReceiver = transceiver.rtpSender;
  22250. } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track === selector) {
  22251. senderOrReceiver = transceiver.rtpReceiver;
  22252. }
  22253. });
  22254. if (!senderOrReceiver) {
  22255. throw makeError('InvalidAccessError', 'Invalid selector.');
  22256. }
  22257. return senderOrReceiver.getStats();
  22258. }
  22259. var promises = [];
  22260. this.transceivers.forEach(function (transceiver) {
  22261. ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport', 'dtlsTransport'].forEach(function (method) {
  22262. if (transceiver[method]) {
  22263. promises.push(transceiver[method].getStats());
  22264. }
  22265. });
  22266. });
  22267. return Promise.all(promises).then(function (allStats) {
  22268. var results = new Map();
  22269. allStats.forEach(function (stats) {
  22270. stats.forEach(function (stat) {
  22271. results.set(stat.id, stat);
  22272. });
  22273. });
  22274. return results;
  22275. });
  22276. };
  22277. // fix low-level stat names and return Map instead of object.
  22278. var ortcObjects = ['RTCRtpSender', 'RTCRtpReceiver', 'RTCIceGatherer', 'RTCIceTransport', 'RTCDtlsTransport'];
  22279. ortcObjects.forEach(function (ortcObjectName) {
  22280. var obj = window[ortcObjectName];
  22281. if (obj && obj.prototype && obj.prototype.getStats) {
  22282. var nativeGetstats = obj.prototype.getStats;
  22283. obj.prototype.getStats = function () {
  22284. return nativeGetstats.apply(this).then(function (nativeStats) {
  22285. var mapStats = new Map();
  22286. Object.keys(nativeStats).forEach(function (id) {
  22287. nativeStats[id].type = fixStatsType(nativeStats[id]);
  22288. mapStats.set(id, nativeStats[id]);
  22289. });
  22290. return mapStats;
  22291. });
  22292. };
  22293. }
  22294. });
  22295. // legacy callback shims. Should be moved to adapter.js some days.
  22296. var methods = ['createOffer', 'createAnswer'];
  22297. methods.forEach(function (method) {
  22298. var nativeMethod = RTCPeerConnection.prototype[method];
  22299. RTCPeerConnection.prototype[method] = function () {
  22300. var args = arguments;
  22301. if (typeof args[0] === 'function' || typeof args[1] === 'function') {
  22302. // legacy
  22303. return nativeMethod.apply(this, [arguments[2]]).then(function (description) {
  22304. if (typeof args[0] === 'function') {
  22305. args[0].apply(null, [description]);
  22306. }
  22307. }, function (error) {
  22308. if (typeof args[1] === 'function') {
  22309. args[1].apply(null, [error]);
  22310. }
  22311. });
  22312. }
  22313. return nativeMethod.apply(this, arguments);
  22314. };
  22315. });
  22316. methods = ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'];
  22317. methods.forEach(function (method) {
  22318. var nativeMethod = RTCPeerConnection.prototype[method];
  22319. RTCPeerConnection.prototype[method] = function () {
  22320. var args = arguments;
  22321. if (typeof args[1] === 'function' || typeof args[2] === 'function') {
  22322. // legacy
  22323. return nativeMethod.apply(this, arguments).then(function () {
  22324. if (typeof args[1] === 'function') {
  22325. args[1].apply(null);
  22326. }
  22327. }, function (error) {
  22328. if (typeof args[2] === 'function') {
  22329. args[2].apply(null, [error]);
  22330. }
  22331. });
  22332. }
  22333. return nativeMethod.apply(this, arguments);
  22334. };
  22335. });
  22336. // getStats is special. It doesn't have a spec legacy method yet we support
  22337. // getStats(something, cb) without error callbacks.
  22338. ['getStats'].forEach(function (method) {
  22339. var nativeMethod = RTCPeerConnection.prototype[method];
  22340. RTCPeerConnection.prototype[method] = function () {
  22341. var args = arguments;
  22342. if (typeof args[1] === 'function') {
  22343. return nativeMethod.apply(this, arguments).then(function () {
  22344. if (typeof args[1] === 'function') {
  22345. args[1].apply(null);
  22346. }
  22347. });
  22348. }
  22349. return nativeMethod.apply(this, arguments);
  22350. };
  22351. });
  22352. return RTCPeerConnection;
  22353. };
  22354. }, {
  22355. "sdp": 17
  22356. }],
  22357. 17: [function (require, module, exports) {
  22358. // SDP helpers.
  22359. var SDPUtils = {};
  22360. // Generate an alphanumeric identifier for cname or mids.
  22361. // TODO: use UUIDs instead? https://gist.github.com/jed/982883
  22362. SDPUtils.generateIdentifier = function () {
  22363. return Math.random().toString(36).substr(2, 10);
  22364. };
  22365. // The RTCP CNAME used by all peerconnections from the same JS.
  22366. SDPUtils.localCName = SDPUtils.generateIdentifier();
  22367. // Splits SDP into lines, dealing with both CRLF and LF.
  22368. SDPUtils.splitLines = function (blob) {
  22369. return blob.trim().split('\n').map(function (line) {
  22370. return line.trim();
  22371. });
  22372. };
  22373. // Splits SDP into sessionpart and mediasections. Ensures CRLF.
  22374. SDPUtils.splitSections = function (blob) {
  22375. var parts = blob.split('\nm=');
  22376. return parts.map(function (part, index) {
  22377. return (index > 0 ? 'm=' + part : part).trim() + '\r\n';
  22378. });
  22379. };
  22380. // returns the session description.
  22381. SDPUtils.getDescription = function (blob) {
  22382. var sections = SDPUtils.splitSections(blob);
  22383. return sections && sections[0];
  22384. };
  22385. // returns the individual media sections.
  22386. SDPUtils.getMediaSections = function (blob) {
  22387. var sections = SDPUtils.splitSections(blob);
  22388. sections.shift();
  22389. return sections;
  22390. };
  22391. // Returns lines that start with a certain prefix.
  22392. SDPUtils.matchPrefix = function (blob, prefix) {
  22393. return SDPUtils.splitLines(blob).filter(function (line) {
  22394. return line.indexOf(prefix) === 0;
  22395. });
  22396. };
  22397. // Parses an ICE candidate line. Sample input:
  22398. // candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8
  22399. // rport 55996"
  22400. SDPUtils.parseCandidate = function (line) {
  22401. var parts;
  22402. // Parse both variants.
  22403. if (line.indexOf('a=candidate:') === 0) {
  22404. parts = line.substring(12).split(' ');
  22405. } else {
  22406. parts = line.substring(10).split(' ');
  22407. }
  22408. var candidate = {
  22409. foundation: parts[0],
  22410. component: parseInt(parts[1], 10),
  22411. protocol: parts[2].toLowerCase(),
  22412. priority: parseInt(parts[3], 10),
  22413. ip: parts[4],
  22414. address: parts[4],
  22415. // address is an alias for ip.
  22416. port: parseInt(parts[5], 10),
  22417. // skip parts[6] == 'typ'
  22418. type: parts[7]
  22419. };
  22420. for (var i = 8; i < parts.length; i += 2) {
  22421. switch (parts[i]) {
  22422. case 'raddr':
  22423. candidate.relatedAddress = parts[i + 1];
  22424. break;
  22425. case 'rport':
  22426. candidate.relatedPort = parseInt(parts[i + 1], 10);
  22427. break;
  22428. case 'tcptype':
  22429. candidate.tcpType = parts[i + 1];
  22430. break;
  22431. case 'ufrag':
  22432. candidate.ufrag = parts[i + 1]; // for backward compability.
  22433. candidate.usernameFragment = parts[i + 1];
  22434. break;
  22435. default:
  22436. // extension handling, in particular ufrag
  22437. candidate[parts[i]] = parts[i + 1];
  22438. break;
  22439. }
  22440. }
  22441. return candidate;
  22442. };
  22443. // Translates a candidate object into SDP candidate attribute.
  22444. SDPUtils.writeCandidate = function (candidate) {
  22445. var sdp = [];
  22446. sdp.push(candidate.foundation);
  22447. sdp.push(candidate.component);
  22448. sdp.push(candidate.protocol.toUpperCase());
  22449. sdp.push(candidate.priority);
  22450. sdp.push(candidate.address || candidate.ip);
  22451. sdp.push(candidate.port);
  22452. var type = candidate.type;
  22453. sdp.push('typ');
  22454. sdp.push(type);
  22455. if (type !== 'host' && candidate.relatedAddress && candidate.relatedPort) {
  22456. sdp.push('raddr');
  22457. sdp.push(candidate.relatedAddress);
  22458. sdp.push('rport');
  22459. sdp.push(candidate.relatedPort);
  22460. }
  22461. if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {
  22462. sdp.push('tcptype');
  22463. sdp.push(candidate.tcpType);
  22464. }
  22465. if (candidate.usernameFragment || candidate.ufrag) {
  22466. sdp.push('ufrag');
  22467. sdp.push(candidate.usernameFragment || candidate.ufrag);
  22468. }
  22469. return 'candidate:' + sdp.join(' ');
  22470. };
  22471. // Parses an ice-options line, returns an array of option tags.
  22472. // a=ice-options:foo bar
  22473. SDPUtils.parseIceOptions = function (line) {
  22474. return line.substr(14).split(' ');
  22475. };
  22476. // Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:
  22477. // a=rtpmap:111 opus/48000/2
  22478. SDPUtils.parseRtpMap = function (line) {
  22479. var parts = line.substr(9).split(' ');
  22480. var parsed = {
  22481. payloadType: parseInt(parts.shift(), 10) // was: id
  22482. };
  22483. parts = parts[0].split('/');
  22484. parsed.name = parts[0];
  22485. parsed.clockRate = parseInt(parts[1], 10); // was: clockrate
  22486. parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;
  22487. // legacy alias, got renamed back to channels in ORTC.
  22488. parsed.numChannels = parsed.channels;
  22489. return parsed;
  22490. };
  22491. // Generate an a=rtpmap line from RTCRtpCodecCapability or
  22492. // RTCRtpCodecParameters.
  22493. SDPUtils.writeRtpMap = function (codec) {
  22494. var pt = codec.payloadType;
  22495. if (codec.preferredPayloadType !== undefined) {
  22496. pt = codec.preferredPayloadType;
  22497. }
  22498. var channels = codec.channels || codec.numChannels || 1;
  22499. return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate + (channels !== 1 ? '/' + channels : '') + '\r\n';
  22500. };
  22501. // Parses an a=extmap line (headerextension from RFC 5285). Sample input:
  22502. // a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
  22503. // a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset
  22504. SDPUtils.parseExtmap = function (line) {
  22505. var parts = line.substr(9).split(' ');
  22506. return {
  22507. id: parseInt(parts[0], 10),
  22508. direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',
  22509. uri: parts[1]
  22510. };
  22511. };
  22512. // Generates a=extmap line from RTCRtpHeaderExtensionParameters or
  22513. // RTCRtpHeaderExtension.
  22514. SDPUtils.writeExtmap = function (headerExtension) {
  22515. return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) + (headerExtension.direction && headerExtension.direction !== 'sendrecv' ? '/' + headerExtension.direction : '') + ' ' + headerExtension.uri + '\r\n';
  22516. };
  22517. // Parses an ftmp line, returns dictionary. Sample input:
  22518. // a=fmtp:96 vbr=on;cng=on
  22519. // Also deals with vbr=on; cng=on
  22520. SDPUtils.parseFmtp = function (line) {
  22521. var parsed = {};
  22522. var kv;
  22523. var parts = line.substr(line.indexOf(' ') + 1).split(';');
  22524. for (var j = 0; j < parts.length; j++) {
  22525. kv = parts[j].trim().split('=');
  22526. parsed[kv[0].trim()] = kv[1];
  22527. }
  22528. return parsed;
  22529. };
  22530. // Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters.
  22531. SDPUtils.writeFmtp = function (codec) {
  22532. var line = '';
  22533. var pt = codec.payloadType;
  22534. if (codec.preferredPayloadType !== undefined) {
  22535. pt = codec.preferredPayloadType;
  22536. }
  22537. if (codec.parameters && Object.keys(codec.parameters).length) {
  22538. var params = [];
  22539. Object.keys(codec.parameters).forEach(function (param) {
  22540. if (codec.parameters[param]) {
  22541. params.push(param + '=' + codec.parameters[param]);
  22542. } else {
  22543. params.push(param);
  22544. }
  22545. });
  22546. line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\r\n';
  22547. }
  22548. return line;
  22549. };
  22550. // Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:
  22551. // a=rtcp-fb:98 nack rpsi
  22552. SDPUtils.parseRtcpFb = function (line) {
  22553. var parts = line.substr(line.indexOf(' ') + 1).split(' ');
  22554. return {
  22555. type: parts.shift(),
  22556. parameter: parts.join(' ')
  22557. };
  22558. };
  22559. // Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.
  22560. SDPUtils.writeRtcpFb = function (codec) {
  22561. var lines = '';
  22562. var pt = codec.payloadType;
  22563. if (codec.preferredPayloadType !== undefined) {
  22564. pt = codec.preferredPayloadType;
  22565. }
  22566. if (codec.rtcpFeedback && codec.rtcpFeedback.length) {
  22567. // FIXME: special handling for trr-int?
  22568. codec.rtcpFeedback.forEach(function (fb) {
  22569. lines += 'a=rtcp-fb:' + pt + ' ' + fb.type + (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') + '\r\n';
  22570. });
  22571. }
  22572. return lines;
  22573. };
  22574. // Parses an RFC 5576 ssrc media attribute. Sample input:
  22575. // a=ssrc:3735928559 cname:something
  22576. SDPUtils.parseSsrcMedia = function (line) {
  22577. var sp = line.indexOf(' ');
  22578. var parts = {
  22579. ssrc: parseInt(line.substr(7, sp - 7), 10)
  22580. };
  22581. var colon = line.indexOf(':', sp);
  22582. if (colon > -1) {
  22583. parts.attribute = line.substr(sp + 1, colon - sp - 1);
  22584. parts.value = line.substr(colon + 1);
  22585. } else {
  22586. parts.attribute = line.substr(sp + 1);
  22587. }
  22588. return parts;
  22589. };
  22590. SDPUtils.parseSsrcGroup = function (line) {
  22591. var parts = line.substr(13).split(' ');
  22592. return {
  22593. semantics: parts.shift(),
  22594. ssrcs: parts.map(function (ssrc) {
  22595. return parseInt(ssrc, 10);
  22596. })
  22597. };
  22598. };
  22599. // Extracts the MID (RFC 5888) from a media section.
  22600. // returns the MID or undefined if no mid line was found.
  22601. SDPUtils.getMid = function (mediaSection) {
  22602. var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];
  22603. if (mid) {
  22604. return mid.substr(6);
  22605. }
  22606. };
  22607. SDPUtils.parseFingerprint = function (line) {
  22608. var parts = line.substr(14).split(' ');
  22609. return {
  22610. algorithm: parts[0].toLowerCase(),
  22611. // algorithm is case-sensitive in Edge.
  22612. value: parts[1]
  22613. };
  22614. };
  22615. // Extracts DTLS parameters from SDP media section or sessionpart.
  22616. // FIXME: for consistency with other functions this should only
  22617. // get the fingerprint line as input. See also getIceParameters.
  22618. SDPUtils.getDtlsParameters = function (mediaSection, sessionpart) {
  22619. var lines = SDPUtils.matchPrefix(mediaSection + sessionpart, 'a=fingerprint:');
  22620. // Note: a=setup line is ignored since we use the 'auto' role.
  22621. // Note2: 'algorithm' is not case sensitive except in Edge.
  22622. return {
  22623. role: 'auto',
  22624. fingerprints: lines.map(SDPUtils.parseFingerprint)
  22625. };
  22626. };
  22627. // Serializes DTLS parameters to SDP.
  22628. SDPUtils.writeDtlsParameters = function (params, setupType) {
  22629. var sdp = 'a=setup:' + setupType + '\r\n';
  22630. params.fingerprints.forEach(function (fp) {
  22631. sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\r\n';
  22632. });
  22633. return sdp;
  22634. };
  22635. // Parses ICE information from SDP media section or sessionpart.
  22636. // FIXME: for consistency with other functions this should only
  22637. // get the ice-ufrag and ice-pwd lines as input.
  22638. SDPUtils.getIceParameters = function (mediaSection, sessionpart) {
  22639. var lines = SDPUtils.splitLines(mediaSection);
  22640. // Search in session part, too.
  22641. lines = lines.concat(SDPUtils.splitLines(sessionpart));
  22642. var iceParameters = {
  22643. usernameFragment: lines.filter(function (line) {
  22644. return line.indexOf('a=ice-ufrag:') === 0;
  22645. })[0].substr(12),
  22646. password: lines.filter(function (line) {
  22647. return line.indexOf('a=ice-pwd:') === 0;
  22648. })[0].substr(10)
  22649. };
  22650. return iceParameters;
  22651. };
  22652. // Serializes ICE parameters to SDP.
  22653. SDPUtils.writeIceParameters = function (params) {
  22654. return 'a=ice-ufrag:' + params.usernameFragment + '\r\n' + 'a=ice-pwd:' + params.password + '\r\n';
  22655. };
  22656. // Parses the SDP media section and returns RTCRtpParameters.
  22657. SDPUtils.parseRtpParameters = function (mediaSection) {
  22658. var description = {
  22659. codecs: [],
  22660. headerExtensions: [],
  22661. fecMechanisms: [],
  22662. rtcp: []
  22663. };
  22664. var lines = SDPUtils.splitLines(mediaSection);
  22665. var mline = lines[0].split(' ');
  22666. for (var i = 3; i < mline.length; i++) {
  22667. // find all codecs from mline[3..]
  22668. var pt = mline[i];
  22669. var rtpmapline = SDPUtils.matchPrefix(mediaSection, 'a=rtpmap:' + pt + ' ')[0];
  22670. if (rtpmapline) {
  22671. var codec = SDPUtils.parseRtpMap(rtpmapline);
  22672. var fmtps = SDPUtils.matchPrefix(mediaSection, 'a=fmtp:' + pt + ' ');
  22673. // Only the first a=fmtp:<pt> is considered.
  22674. codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};
  22675. codec.rtcpFeedback = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-fb:' + pt + ' ').map(SDPUtils.parseRtcpFb);
  22676. description.codecs.push(codec);
  22677. // parse FEC mechanisms from rtpmap lines.
  22678. switch (codec.name.toUpperCase()) {
  22679. case 'RED':
  22680. case 'ULPFEC':
  22681. description.fecMechanisms.push(codec.name.toUpperCase());
  22682. break;
  22683. }
  22684. }
  22685. }
  22686. SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function (line) {
  22687. description.headerExtensions.push(SDPUtils.parseExtmap(line));
  22688. });
  22689. // FIXME: parse rtcp.
  22690. return description;
  22691. };
  22692. // Generates parts of the SDP media section describing the capabilities /
  22693. // parameters.
  22694. SDPUtils.writeRtpDescription = function (kind, caps) {
  22695. var sdp = '';
  22696. // Build the mline.
  22697. sdp += 'm=' + kind + ' ';
  22698. sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.
  22699. sdp += ' UDP/TLS/RTP/SAVPF ';
  22700. sdp += caps.codecs.map(function (codec) {
  22701. if (codec.preferredPayloadType !== undefined) {
  22702. return codec.preferredPayloadType;
  22703. }
  22704. return codec.payloadType;
  22705. }).join(' ') + '\r\n';
  22706. sdp += 'c=IN IP4 0.0.0.0\r\n';
  22707. sdp += 'a=rtcp:9 IN IP4 0.0.0.0\r\n';
  22708. // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.
  22709. caps.codecs.forEach(function (codec) {
  22710. sdp += SDPUtils.writeRtpMap(codec);
  22711. sdp += SDPUtils.writeFmtp(codec);
  22712. sdp += SDPUtils.writeRtcpFb(codec);
  22713. });
  22714. var maxptime = 0;
  22715. caps.codecs.forEach(function (codec) {
  22716. if (codec.maxptime > maxptime) {
  22717. maxptime = codec.maxptime;
  22718. }
  22719. });
  22720. if (maxptime > 0) {
  22721. sdp += 'a=maxptime:' + maxptime + '\r\n';
  22722. }
  22723. sdp += 'a=rtcp-mux\r\n';
  22724. if (caps.headerExtensions) {
  22725. caps.headerExtensions.forEach(function (extension) {
  22726. sdp += SDPUtils.writeExtmap(extension);
  22727. });
  22728. }
  22729. // FIXME: write fecMechanisms.
  22730. return sdp;
  22731. };
  22732. // Parses the SDP media section and returns an array of
  22733. // RTCRtpEncodingParameters.
  22734. SDPUtils.parseRtpEncodingParameters = function (mediaSection) {
  22735. var encodingParameters = [];
  22736. var description = SDPUtils.parseRtpParameters(mediaSection);
  22737. var hasRed = description.fecMechanisms.indexOf('RED') !== -1;
  22738. var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;
  22739. // filter a=ssrc:... cname:, ignore PlanB-msid
  22740. var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
  22741. return SDPUtils.parseSsrcMedia(line);
  22742. }).filter(function (parts) {
  22743. return parts.attribute === 'cname';
  22744. });
  22745. var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;
  22746. var secondarySsrc;
  22747. var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID').map(function (line) {
  22748. var parts = line.substr(17).split(' ');
  22749. return parts.map(function (part) {
  22750. return parseInt(part, 10);
  22751. });
  22752. });
  22753. if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {
  22754. secondarySsrc = flows[0][1];
  22755. }
  22756. description.codecs.forEach(function (codec) {
  22757. if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {
  22758. var encParam = {
  22759. ssrc: primarySsrc,
  22760. codecPayloadType: parseInt(codec.parameters.apt, 10)
  22761. };
  22762. if (primarySsrc && secondarySsrc) {
  22763. encParam.rtx = {
  22764. ssrc: secondarySsrc
  22765. };
  22766. }
  22767. encodingParameters.push(encParam);
  22768. if (hasRed) {
  22769. encParam = JSON.parse(JSON.stringify(encParam));
  22770. encParam.fec = {
  22771. ssrc: primarySsrc,
  22772. mechanism: hasUlpfec ? 'red+ulpfec' : 'red'
  22773. };
  22774. encodingParameters.push(encParam);
  22775. }
  22776. }
  22777. });
  22778. if (encodingParameters.length === 0 && primarySsrc) {
  22779. encodingParameters.push({
  22780. ssrc: primarySsrc
  22781. });
  22782. }
  22783. // we support both b=AS and b=TIAS but interpret AS as TIAS.
  22784. var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');
  22785. if (bandwidth.length) {
  22786. if (bandwidth[0].indexOf('b=TIAS:') === 0) {
  22787. bandwidth = parseInt(bandwidth[0].substr(7), 10);
  22788. } else if (bandwidth[0].indexOf('b=AS:') === 0) {
  22789. // use formula from JSEP to convert b=AS to TIAS value.
  22790. bandwidth = parseInt(bandwidth[0].substr(5), 10) * 1000 * 0.95 - 50 * 40 * 8;
  22791. } else {
  22792. bandwidth = undefined;
  22793. }
  22794. encodingParameters.forEach(function (params) {
  22795. params.maxBitrate = bandwidth;
  22796. });
  22797. }
  22798. return encodingParameters;
  22799. };
  22800. // parses http://draft.ortc.org/#rtcrtcpparameters*
  22801. SDPUtils.parseRtcpParameters = function (mediaSection) {
  22802. var rtcpParameters = {};
  22803. // Gets the first SSRC. Note tha with RTX there might be multiple
  22804. // SSRCs.
  22805. var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
  22806. return SDPUtils.parseSsrcMedia(line);
  22807. }).filter(function (obj) {
  22808. return obj.attribute === 'cname';
  22809. })[0];
  22810. if (remoteSsrc) {
  22811. rtcpParameters.cname = remoteSsrc.value;
  22812. rtcpParameters.ssrc = remoteSsrc.ssrc;
  22813. }
  22814. // Edge uses the compound attribute instead of reducedSize
  22815. // compound is !reducedSize
  22816. var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');
  22817. rtcpParameters.reducedSize = rsize.length > 0;
  22818. rtcpParameters.compound = rsize.length === 0;
  22819. // parses the rtcp-mux attrіbute.
  22820. // Note that Edge does not support unmuxed RTCP.
  22821. var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');
  22822. rtcpParameters.mux = mux.length > 0;
  22823. return rtcpParameters;
  22824. };
  22825. // parses either a=msid: or a=ssrc:... msid lines and returns
  22826. // the id of the MediaStream and MediaStreamTrack.
  22827. SDPUtils.parseMsid = function (mediaSection) {
  22828. var parts;
  22829. var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');
  22830. if (spec.length === 1) {
  22831. parts = spec[0].substr(7).split(' ');
  22832. return {
  22833. stream: parts[0],
  22834. track: parts[1]
  22835. };
  22836. }
  22837. var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
  22838. return SDPUtils.parseSsrcMedia(line);
  22839. }).filter(function (msidParts) {
  22840. return msidParts.attribute === 'msid';
  22841. });
  22842. if (planB.length > 0) {
  22843. parts = planB[0].value.split(' ');
  22844. return {
  22845. stream: parts[0],
  22846. track: parts[1]
  22847. };
  22848. }
  22849. };
  22850. // SCTP
  22851. // parses draft-ietf-mmusic-sctp-sdp-26 first and falls back
  22852. // to draft-ietf-mmusic-sctp-sdp-05
  22853. SDPUtils.parseSctpDescription = function (mediaSection) {
  22854. var mline = SDPUtils.parseMLine(mediaSection);
  22855. var maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');
  22856. var maxMessageSize;
  22857. if (maxSizeLine.length > 0) {
  22858. maxMessageSize = parseInt(maxSizeLine[0].substr(19), 10);
  22859. }
  22860. if (isNaN(maxMessageSize)) {
  22861. maxMessageSize = 65536;
  22862. }
  22863. var sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');
  22864. if (sctpPort.length > 0) {
  22865. return {
  22866. port: parseInt(sctpPort[0].substr(12), 10),
  22867. protocol: mline.fmt,
  22868. maxMessageSize: maxMessageSize
  22869. };
  22870. }
  22871. var sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');
  22872. if (sctpMapLines.length > 0) {
  22873. var parts = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:')[0].substr(10).split(' ');
  22874. return {
  22875. port: parseInt(parts[0], 10),
  22876. protocol: parts[1],
  22877. maxMessageSize: maxMessageSize
  22878. };
  22879. }
  22880. };
  22881. // SCTP
  22882. // outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers
  22883. // support by now receiving in this format, unless we originally parsed
  22884. // as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line
  22885. // protocol of DTLS/SCTP -- without UDP/ or TCP/)
  22886. SDPUtils.writeSctpDescription = function (media, sctp) {
  22887. var output = [];
  22888. if (media.protocol !== 'DTLS/SCTP') {
  22889. output = ['m=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\r\n', 'c=IN IP4 0.0.0.0\r\n', 'a=sctp-port:' + sctp.port + '\r\n'];
  22890. } else {
  22891. output = ['m=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\r\n', 'c=IN IP4 0.0.0.0\r\n', 'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\r\n'];
  22892. }
  22893. if (sctp.maxMessageSize !== undefined) {
  22894. output.push('a=max-message-size:' + sctp.maxMessageSize + '\r\n');
  22895. }
  22896. return output.join('');
  22897. };
  22898. // Generate a session ID for SDP.
  22899. // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1
  22900. // recommends using a cryptographically random +ve 64-bit value
  22901. // but right now this should be acceptable and within the right range
  22902. SDPUtils.generateSessionId = function () {
  22903. return Math.random().toString().substr(2, 21);
  22904. };
  22905. // Write boilder plate for start of SDP
  22906. // sessId argument is optional - if not supplied it will
  22907. // be generated randomly
  22908. // sessVersion is optional and defaults to 2
  22909. // sessUser is optional and defaults to 'thisisadapterortc'
  22910. SDPUtils.writeSessionBoilerplate = function (sessId, sessVer, sessUser) {
  22911. var sessionId;
  22912. var version = sessVer !== undefined ? sessVer : 2;
  22913. if (sessId) {
  22914. sessionId = sessId;
  22915. } else {
  22916. sessionId = SDPUtils.generateSessionId();
  22917. }
  22918. var user = sessUser || 'thisisadapterortc';
  22919. // FIXME: sess-id should be an NTP timestamp.
  22920. return 'v=0\r\n' + 'o=' + user + ' ' + sessionId + ' ' + version + ' IN IP4 127.0.0.1\r\n' + 's=-\r\n' + 't=0 0\r\n';
  22921. };
  22922. SDPUtils.writeMediaSection = function (transceiver, caps, type, stream) {
  22923. var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);
  22924. // Map ICE parameters (ufrag, pwd) to SDP.
  22925. sdp += SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());
  22926. // Map DTLS parameters to SDP.
  22927. sdp += SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : 'active');
  22928. sdp += 'a=mid:' + transceiver.mid + '\r\n';
  22929. if (transceiver.direction) {
  22930. sdp += 'a=' + transceiver.direction + '\r\n';
  22931. } else if (transceiver.rtpSender && transceiver.rtpReceiver) {
  22932. sdp += 'a=sendrecv\r\n';
  22933. } else if (transceiver.rtpSender) {
  22934. sdp += 'a=sendonly\r\n';
  22935. } else if (transceiver.rtpReceiver) {
  22936. sdp += 'a=recvonly\r\n';
  22937. } else {
  22938. sdp += 'a=inactive\r\n';
  22939. }
  22940. if (transceiver.rtpSender) {
  22941. // spec.
  22942. var msid = 'msid:' + stream.id + ' ' + transceiver.rtpSender.track.id + '\r\n';
  22943. sdp += 'a=' + msid;
  22944. // for Chrome.
  22945. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid;
  22946. if (transceiver.sendEncodingParameters[0].rtx) {
  22947. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid;
  22948. sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n';
  22949. }
  22950. }
  22951. // FIXME: this should be written by writeRtpDescription.
  22952. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
  22953. if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
  22954. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
  22955. }
  22956. return sdp;
  22957. };
  22958. // Gets the direction from the mediaSection or the sessionpart.
  22959. SDPUtils.getDirection = function (mediaSection, sessionpart) {
  22960. // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.
  22961. var lines = SDPUtils.splitLines(mediaSection);
  22962. for (var i = 0; i < lines.length; i++) {
  22963. switch (lines[i]) {
  22964. case 'a=sendrecv':
  22965. case 'a=sendonly':
  22966. case 'a=recvonly':
  22967. case 'a=inactive':
  22968. return lines[i].substr(2);
  22969. // FIXME: What should happen here?
  22970. }
  22971. }
  22972. if (sessionpart) {
  22973. return SDPUtils.getDirection(sessionpart);
  22974. }
  22975. return 'sendrecv';
  22976. };
  22977. SDPUtils.getKind = function (mediaSection) {
  22978. var lines = SDPUtils.splitLines(mediaSection);
  22979. var mline = lines[0].split(' ');
  22980. return mline[0].substr(2);
  22981. };
  22982. SDPUtils.isRejected = function (mediaSection) {
  22983. return mediaSection.split(' ', 2)[1] === '0';
  22984. };
  22985. SDPUtils.parseMLine = function (mediaSection) {
  22986. var lines = SDPUtils.splitLines(mediaSection);
  22987. var parts = lines[0].substr(2).split(' ');
  22988. return {
  22989. kind: parts[0],
  22990. port: parseInt(parts[1], 10),
  22991. protocol: parts[2],
  22992. fmt: parts.slice(3).join(' ')
  22993. };
  22994. };
  22995. SDPUtils.parseOLine = function (mediaSection) {
  22996. var line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];
  22997. var parts = line.substr(2).split(' ');
  22998. return {
  22999. username: parts[0],
  23000. sessionId: parts[1],
  23001. sessionVersion: parseInt(parts[2], 10),
  23002. netType: parts[3],
  23003. addressType: parts[4],
  23004. address: parts[5]
  23005. };
  23006. };
  23007. // a very naive interpretation of a valid SDP.
  23008. SDPUtils.isValidSDP = function (blob) {
  23009. if (typeof blob !== 'string' || blob.length === 0) {
  23010. return false;
  23011. }
  23012. var lines = SDPUtils.splitLines(blob);
  23013. for (var i = 0; i < lines.length; i++) {
  23014. if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {
  23015. return false;
  23016. }
  23017. // TODO: check the modifier a bit more.
  23018. }
  23019. return true;
  23020. };
  23021. // Expose public methods.
  23022. if (_typeof(module) === 'object') {
  23023. module.exports = SDPUtils;
  23024. }
  23025. }, {}]
  23026. }, {}, [1])(1);
  23027. });
  23028. /*
  23029. The MIT License (MIT)
  23030. Copyright (c) 2016 Meetecho
  23031. Permission is hereby granted, free of charge, to any person obtaining
  23032. a copy of this software and associated documentation files (the "Software"),
  23033. to deal in the Software without restriction, including without limitation
  23034. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  23035. and/or sell copies of the Software, and to permit persons to whom the
  23036. Software is furnished to do so, subject to the following conditions:
  23037. The above copyright notice and this permission notice shall be included
  23038. in all copies or substantial portions of the Software.
  23039. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  23040. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23041. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23042. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  23043. OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  23044. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23045. OTHER DEALINGS IN THE SOFTWARE.
  23046. */
  23047. // List of sessions
  23048. Janus$1.sessions = {};
  23049. Janus$1.isExtensionEnabled = function () {
  23050. if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
  23051. // No need for the extension, getDisplayMedia is supported
  23052. return true;
  23053. }
  23054. if (window.navigator.userAgent.match('Chrome')) {
  23055. var chromever = parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1], 10);
  23056. var maxver = 33;
  23057. if (window.navigator.userAgent.match('Linux')) maxver = 35; // "known" crash in chrome 34 and 35 on linux
  23058. if (chromever >= 26 && chromever <= maxver) {
  23059. // Older versions of Chrome don't support this extension-based approach, so lie
  23060. return true;
  23061. }
  23062. return Janus$1.extension.isInstalled();
  23063. } else {
  23064. // Firefox of others, no need for the extension (but this doesn't mean it will work)
  23065. return true;
  23066. }
  23067. };
  23068. var defaultExtension = {
  23069. // Screensharing Chrome Extension ID
  23070. extensionId: 'hapfgfdkleiggjjpfpenajgdnfckjpaj',
  23071. isInstalled: function isInstalled() {
  23072. return document.querySelector('#janus-extension-installed') !== null;
  23073. },
  23074. getScreen: function getScreen(callback) {
  23075. var pending = window.setTimeout(function () {
  23076. var error = new Error('NavigatorUserMediaError');
  23077. error.name = 'The required Chrome extension is not installed: click <a href="#">here</a> to install it. (NOTE: this will need you to refresh the page)';
  23078. return callback(error);
  23079. }, 1000);
  23080. this.cache[pending] = callback;
  23081. window.postMessage({
  23082. type: 'janusGetScreen',
  23083. id: pending
  23084. }, '*');
  23085. },
  23086. init: function init() {
  23087. var cache = {};
  23088. this.cache = cache;
  23089. // Wait for events from the Chrome Extension
  23090. window.addEventListener('message', function (event) {
  23091. if (event.origin != window.location.origin) return;
  23092. if (event.data.type == 'janusGotScreen' && cache[event.data.id]) {
  23093. var callback = cache[event.data.id];
  23094. delete cache[event.data.id];
  23095. if (event.data.sourceId === '') {
  23096. // user canceled
  23097. var error = new Error('NavigatorUserMediaError');
  23098. error.name = 'You cancelled the request for permission, giving up...';
  23099. callback(error);
  23100. } else {
  23101. callback(null, event.data.sourceId);
  23102. }
  23103. } else if (event.data.type == 'janusGetScreenPending') {
  23104. console.log('clearing ', event.data.id);
  23105. window.clearTimeout(event.data.id);
  23106. }
  23107. });
  23108. }
  23109. };
  23110. Janus$1.useDefaultDependencies = function (deps) {
  23111. var f = deps && deps.fetch || fetch;
  23112. var p = deps && deps.Promise || Promise;
  23113. var socketCls = deps && deps.WebSocket || WebSocket;
  23114. return {
  23115. newWebSocket: function newWebSocket(server, proto) {
  23116. return new socketCls(server, proto);
  23117. },
  23118. extension: deps && deps.extension || defaultExtension,
  23119. isArray: function isArray(arr) {
  23120. return Array.isArray(arr);
  23121. },
  23122. webRTCAdapter: deps && deps.adapter || window.adapter,
  23123. httpAPICall: function httpAPICall(url, options) {
  23124. var fetchOptions = {
  23125. method: options.verb,
  23126. headers: {
  23127. 'Accept': 'application/json, text/plain, */*'
  23128. },
  23129. cache: 'no-cache'
  23130. };
  23131. if (options.verb === "POST") {
  23132. fetchOptions.headers['Content-Type'] = 'application/json';
  23133. }
  23134. if (options.withCredentials !== undefined) {
  23135. fetchOptions.credentials = options.withCredentials === true ? 'include' : options.withCredentials ? options.withCredentials : 'omit';
  23136. }
  23137. if (options.body !== undefined) {
  23138. fetchOptions.body = JSON.stringify(options.body);
  23139. }
  23140. var fetching = f(url, fetchOptions)["catch"](function (error) {
  23141. return p.reject({
  23142. message: 'Probably a network error, is the server down?',
  23143. error: error
  23144. });
  23145. });
  23146. /*
  23147. * fetch() does not natively support timeouts.
  23148. * Work around this by starting a timeout manually, and racing it agains the fetch() to see which thing resolves first.
  23149. */
  23150. if (options.timeout !== undefined) {
  23151. var timeout = new p(function (resolve, reject) {
  23152. var timerId = setTimeout(function () {
  23153. clearTimeout(timerId);
  23154. return reject({
  23155. message: 'Request timed out',
  23156. timeout: options.timeout
  23157. });
  23158. }, options.timeout);
  23159. });
  23160. fetching = p.race([fetching, timeout]);
  23161. }
  23162. fetching.then(function (response) {
  23163. if (response.ok) {
  23164. if (_typeof(options.success) === _typeof(Janus$1.noop)) {
  23165. return response.json().then(function (parsed) {
  23166. options.success(parsed);
  23167. })["catch"](function (error) {
  23168. return p.reject({
  23169. message: 'Failed to parse response body',
  23170. error: error,
  23171. response: response
  23172. });
  23173. });
  23174. }
  23175. } else {
  23176. return p.reject({
  23177. message: 'API call failed',
  23178. response: response
  23179. });
  23180. }
  23181. })["catch"](function (error) {
  23182. if (_typeof(options.error) === _typeof(Janus$1.noop)) {
  23183. options.error(error.message || '<< internal error >>', error);
  23184. }
  23185. });
  23186. return fetching;
  23187. }
  23188. };
  23189. };
  23190. Janus$1.useOldDependencies = function (deps) {
  23191. var jq = deps && deps.jQuery || jQuery;
  23192. var socketCls = deps && deps.WebSocket || WebSocket;
  23193. return {
  23194. newWebSocket: function newWebSocket(server, proto) {
  23195. return new socketCls(server, proto);
  23196. },
  23197. isArray: function isArray(arr) {
  23198. return jq.isArray(arr);
  23199. },
  23200. extension: deps && deps.extension || defaultExtension,
  23201. webRTCAdapter: deps && deps.adapter || adapter,
  23202. httpAPICall: function httpAPICall(url, options) {
  23203. var payload = options.body !== undefined ? {
  23204. contentType: 'application/json',
  23205. data: JSON.stringify(options.body)
  23206. } : {};
  23207. var credentials = options.withCredentials !== undefined ? {
  23208. xhrFields: {
  23209. withCredentials: options.withCredentials
  23210. }
  23211. } : {};
  23212. return jq.ajax(jq.extend(payload, credentials, {
  23213. url: url,
  23214. type: options.verb,
  23215. cache: false,
  23216. dataType: 'json',
  23217. async: options.async,
  23218. timeout: options.timeout,
  23219. success: function success(result) {
  23220. if (_typeof(options.success) === _typeof(Janus$1.noop)) {
  23221. options.success(result);
  23222. }
  23223. },
  23224. error: function error(xhr, status, err) {
  23225. if (_typeof(options.error) === _typeof(Janus$1.noop)) {
  23226. options.error(status, err);
  23227. }
  23228. }
  23229. }));
  23230. }
  23231. };
  23232. };
  23233. Janus$1.noop = function () {};
  23234. Janus$1.dataChanDefaultLabel = "JanusDataChannel";
  23235. // Note: in the future we may want to change this, e.g., as was
  23236. // attempted in https://github.com/meetecho/janus-gateway/issues/1670
  23237. Janus$1.endOfCandidates = null;
  23238. // Initialization
  23239. Janus$1.init = function (options) {
  23240. options = options || {};
  23241. options.callback = typeof options.callback == "function" ? options.callback : Janus$1.noop;
  23242. if (Janus$1.initDone === true) {
  23243. // Already initialized
  23244. options.callback();
  23245. } else {
  23246. if (typeof console == "undefined" || typeof console.log == "undefined") console = {
  23247. log: function log() {}
  23248. };
  23249. // Console logging (all debugging disabled by default)
  23250. Janus$1.trace = Janus$1.noop;
  23251. Janus$1.debug = Janus$1.noop;
  23252. Janus$1.vdebug = Janus$1.noop;
  23253. Janus$1.log = Janus$1.noop;
  23254. Janus$1.warn = Janus$1.noop;
  23255. Janus$1.error = Janus$1.noop;
  23256. if (options.debug === true || options.debug === "all") {
  23257. // Enable all debugging levels
  23258. Janus$1.trace = console.trace.bind(console);
  23259. Janus$1.debug = console.debug.bind(console);
  23260. Janus$1.vdebug = console.debug.bind(console);
  23261. Janus$1.log = console.log.bind(console);
  23262. Janus$1.warn = console.warn.bind(console);
  23263. Janus$1.error = console.error.bind(console);
  23264. } else if (Array.isArray(options.debug)) {
  23265. for (var i in options.debug) {
  23266. var d = options.debug[i];
  23267. switch (d) {
  23268. case "trace":
  23269. Janus$1.trace = console.trace.bind(console);
  23270. break;
  23271. case "debug":
  23272. Janus$1.debug = console.debug.bind(console);
  23273. break;
  23274. case "vdebug":
  23275. Janus$1.vdebug = console.debug.bind(console);
  23276. break;
  23277. case "log":
  23278. Janus$1.log = console.log.bind(console);
  23279. break;
  23280. case "warn":
  23281. Janus$1.warn = console.warn.bind(console);
  23282. break;
  23283. case "error":
  23284. Janus$1.error = console.error.bind(console);
  23285. break;
  23286. default:
  23287. console.error("Unknown debugging option '" + d + "' (supported: 'trace', 'debug', 'vdebug', 'log', warn', 'error')");
  23288. break;
  23289. }
  23290. }
  23291. }
  23292. Janus$1.log("Initializing library");
  23293. var usedDependencies = options.dependencies || Janus$1.useDefaultDependencies();
  23294. Janus$1.isArray = usedDependencies.isArray;
  23295. Janus$1.webRTCAdapter = usedDependencies.webRTCAdapter;
  23296. Janus$1.httpAPICall = usedDependencies.httpAPICall;
  23297. Janus$1.newWebSocket = usedDependencies.newWebSocket;
  23298. Janus$1.extension = usedDependencies.extension;
  23299. Janus$1.extension.init();
  23300. // Helper method to enumerate devices
  23301. Janus$1.listDevices = function (callback, config) {
  23302. callback = typeof callback == "function" ? callback : Janus$1.noop;
  23303. if (config == null) config = {
  23304. audio: true,
  23305. video: true
  23306. };
  23307. if (Janus$1.isGetUserMediaAvailable()) {
  23308. navigator.mediaDevices.getUserMedia(config).then(function (stream) {
  23309. navigator.mediaDevices.enumerateDevices().then(function (devices) {
  23310. Janus$1.debug(devices);
  23311. callback(devices);
  23312. // Get rid of the now useless stream
  23313. try {
  23314. var tracks = stream.getTracks();
  23315. for (var i in tracks) {
  23316. var mst = tracks[i];
  23317. if (mst !== null && mst !== undefined) mst.stop();
  23318. }
  23319. } catch (e) {}
  23320. });
  23321. })["catch"](function (err) {
  23322. Janus$1.error(err);
  23323. callback([]);
  23324. });
  23325. } else {
  23326. Janus$1.warn("navigator.mediaDevices unavailable");
  23327. callback([]);
  23328. }
  23329. };
  23330. // Helper methods to attach/reattach a stream to a video element (previously part of adapter.js)
  23331. Janus$1.attachMediaStream = function (element, stream) {
  23332. if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
  23333. var chromever = Janus$1.webRTCAdapter.browserDetails.version;
  23334. // if(chromever >= 52) {
  23335. // element.srcObject = stream;
  23336. // } else if(typeof element.src !== 'undefined') {
  23337. // element.src = URL.createObjectURL(stream);
  23338. // } else {
  23339. // Janus.error("Error attaching stream to element");
  23340. // }
  23341. if (chromever >= 52) {
  23342. element.srcObject = stream;
  23343. } else {
  23344. Janus$1.error("Error attaching stream to element");
  23345. }
  23346. } else {
  23347. element.srcObject = stream;
  23348. }
  23349. };
  23350. Janus$1.reattachMediaStream = function (to, from) {
  23351. if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
  23352. var chromever = Janus$1.webRTCAdapter.browserDetails.version;
  23353. if (chromever >= 52) {
  23354. to.srcObject = from.srcObject;
  23355. } else if (typeof to.src !== 'undefined') {
  23356. to.src = from.src;
  23357. } else {
  23358. Janus$1.error("Error reattaching stream to element");
  23359. }
  23360. } else {
  23361. to.srcObject = from.srcObject;
  23362. }
  23363. };
  23364. // Detect tab close: make sure we don't loose existing onbeforeunload handlers
  23365. // (note: for iOS we need to subscribe to a different event, 'pagehide', see
  23366. // https://gist.github.com/thehunmonkgroup/6bee8941a49b86be31a787fe8f4b8cfe)
  23367. var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
  23368. var eventName = iOS ? 'pagehide' : 'beforeunload';
  23369. var oldOBF = window["on" + eventName];
  23370. window.addEventListener(eventName, function (event) {
  23371. Janus$1.log("Closing window");
  23372. for (var s in Janus$1.sessions) {
  23373. if (Janus$1.sessions[s] !== null && Janus$1.sessions[s] !== undefined && Janus$1.sessions[s].destroyOnUnload) {
  23374. Janus$1.log("Destroying session " + s);
  23375. Janus$1.sessions[s].destroy({
  23376. asyncRequest: false,
  23377. notifyDestroyed: false
  23378. });
  23379. }
  23380. }
  23381. if (oldOBF && typeof oldOBF == "function") oldOBF();
  23382. });
  23383. // If this is a Safari Technology Preview, check if VP8 is supported
  23384. Janus$1.safariVp8 = false;
  23385. if (Janus$1.webRTCAdapter.browserDetails.browser === 'safari' && Janus$1.webRTCAdapter.browserDetails.version >= 605) {
  23386. // Let's see if RTCRtpSender.getCapabilities() is there
  23387. if (RTCRtpSender && RTCRtpSender.getCapabilities && RTCRtpSender.getCapabilities("video") && RTCRtpSender.getCapabilities("video").codecs && RTCRtpSender.getCapabilities("video").codecs.length) {
  23388. for (var i in RTCRtpSender.getCapabilities("video").codecs) {
  23389. var codec = RTCRtpSender.getCapabilities("video").codecs[i];
  23390. if (codec && codec.mimeType && codec.mimeType.toLowerCase() === "video/vp8") {
  23391. Janus$1.safariVp8 = true;
  23392. break;
  23393. }
  23394. }
  23395. if (Janus$1.safariVp8) {
  23396. Janus$1.log("This version of Safari supports VP8");
  23397. } else {
  23398. Janus$1.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, " + "try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu");
  23399. }
  23400. } else {
  23401. // We do it in a very ugly way, as there's no alternative...
  23402. // We create a PeerConnection to see if VP8 is in an offer
  23403. var testpc = new RTCPeerConnection({}, {});
  23404. testpc.createOffer({
  23405. offerToReceiveVideo: true
  23406. }).then(function (offer) {
  23407. Janus$1.safariVp8 = offer.sdp.indexOf("VP8") !== -1;
  23408. if (Janus$1.safariVp8) {
  23409. Janus$1.log("This version of Safari supports VP8");
  23410. } else {
  23411. Janus$1.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, " + "try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu");
  23412. }
  23413. testpc.close();
  23414. testpc = null;
  23415. });
  23416. }
  23417. }
  23418. // Check if this browser supports Unified Plan and transceivers
  23419. // Based on https://codepen.io/anon/pen/ZqLwWV?editors=0010
  23420. Janus$1.unifiedPlan = false;
  23421. if (Janus$1.webRTCAdapter.browserDetails.browser === 'firefox' && Janus$1.webRTCAdapter.browserDetails.version >= 59) {
  23422. // Firefox definitely does, starting from version 59
  23423. Janus$1.unifiedPlan = true;
  23424. } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome' && Janus$1.webRTCAdapter.browserDetails.version < 72) {
  23425. // Chrome does, but it's only usable from version 72 on
  23426. Janus$1.unifiedPlan = false;
  23427. } else if (typeof RTCRtpTransceiver !== 'undefined' && !('currentDirection' in RTCRtpTransceiver.prototype)) {
  23428. // Safari supports addTransceiver() but not Unified Plan when
  23429. // currentDirection is not defined (see codepen above)
  23430. Janus$1.unifiedPlan = false;
  23431. } else {
  23432. // Check if addTransceiver() throws an exception
  23433. var tempPc = new RTCPeerConnection();
  23434. try {
  23435. tempPc.addTransceiver('audio');
  23436. Janus$1.unifiedPlan = true;
  23437. } catch (e) {}
  23438. tempPc.close();
  23439. }
  23440. Janus$1.initDone = true;
  23441. options.callback();
  23442. }
  23443. };
  23444. // Helper method to check whether WebRTC is supported by this browser
  23445. Janus$1.isWebrtcSupported = function () {
  23446. return window.RTCPeerConnection !== undefined && window.RTCPeerConnection !== null;
  23447. };
  23448. // Helper method to check whether devices can be accessed by this browser (e.g., not possible via plain HTTP)
  23449. Janus$1.isGetUserMediaAvailable = function () {
  23450. return navigator.mediaDevices !== undefined && navigator.mediaDevices !== null && navigator.mediaDevices.getUserMedia !== undefined && navigator.mediaDevices.getUserMedia !== null;
  23451. };
  23452. // Helper method to create random identifiers (e.g., transaction)
  23453. Janus$1.randomString = function (len) {
  23454. var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  23455. var randomString = '';
  23456. for (var i = 0; i < len; i++) {
  23457. var randomPoz = Math.floor(Math.random() * charSet.length);
  23458. randomString += charSet.substring(randomPoz, randomPoz + 1);
  23459. }
  23460. return randomString;
  23461. };
  23462. function Janus$1(gatewayCallbacks) {
  23463. if (Janus$1.initDone === undefined) {
  23464. gatewayCallbacks.error("Library not initialized");
  23465. return {};
  23466. }
  23467. if (!Janus$1.isWebrtcSupported()) {
  23468. gatewayCallbacks.error("WebRTC not supported by this browser");
  23469. return {};
  23470. }
  23471. Janus$1.log("Library initialized: " + Janus$1.initDone);
  23472. gatewayCallbacks = gatewayCallbacks || {};
  23473. gatewayCallbacks.success = typeof gatewayCallbacks.success == "function" ? gatewayCallbacks.success : Janus$1.noop;
  23474. gatewayCallbacks.error = typeof gatewayCallbacks.error == "function" ? gatewayCallbacks.error : Janus$1.noop;
  23475. gatewayCallbacks.destroyed = typeof gatewayCallbacks.destroyed == "function" ? gatewayCallbacks.destroyed : Janus$1.noop;
  23476. if (gatewayCallbacks.server === null || gatewayCallbacks.server === undefined) {
  23477. gatewayCallbacks.error("Invalid server url");
  23478. return {};
  23479. }
  23480. var websockets = false;
  23481. var ws = null;
  23482. var wsHandlers = {};
  23483. var wsKeepaliveTimeoutId = null;
  23484. var servers = null,
  23485. serversIndex = 0;
  23486. var server = gatewayCallbacks.server;
  23487. if (Janus$1.isArray(server)) {
  23488. Janus$1.log("Multiple servers provided (" + server.length + "), will use the first that works");
  23489. server = null;
  23490. servers = gatewayCallbacks.server;
  23491. Janus$1.debug(servers);
  23492. } else {
  23493. if (server.indexOf("ws") === 0) {
  23494. websockets = true;
  23495. Janus$1.log("Using WebSockets to contact Janus: " + server);
  23496. } else {
  23497. websockets = false;
  23498. Janus$1.log("Using REST API to contact Janus: " + server);
  23499. }
  23500. }
  23501. var iceServers = gatewayCallbacks.iceServers;
  23502. if (iceServers === undefined || iceServers === null) iceServers = [{
  23503. urls: "stun:stun.l.google.com:19302"
  23504. }];
  23505. var iceTransportPolicy = gatewayCallbacks.iceTransportPolicy;
  23506. var bundlePolicy = gatewayCallbacks.bundlePolicy;
  23507. // Whether IPv6 candidates should be gathered
  23508. var ipv6Support = gatewayCallbacks.ipv6;
  23509. if (ipv6Support === undefined || ipv6Support === null) ipv6Support = false;
  23510. // Whether we should enable the withCredentials flag for XHR requests
  23511. var withCredentials = false;
  23512. if (gatewayCallbacks.withCredentials !== undefined && gatewayCallbacks.withCredentials !== null) withCredentials = gatewayCallbacks.withCredentials === true;
  23513. // Optional max events
  23514. var maxev = 10;
  23515. if (gatewayCallbacks.max_poll_events !== undefined && gatewayCallbacks.max_poll_events !== null) maxev = gatewayCallbacks.max_poll_events;
  23516. if (maxev < 1) maxev = 1;
  23517. // Token to use (only if the token based authentication mechanism is enabled)
  23518. var token = null;
  23519. if (gatewayCallbacks.token !== undefined && gatewayCallbacks.token !== null) token = gatewayCallbacks.token;
  23520. // API secret to use (only if the shared API secret is enabled)
  23521. var apisecret = null;
  23522. if (gatewayCallbacks.apisecret !== undefined && gatewayCallbacks.apisecret !== null) apisecret = gatewayCallbacks.apisecret;
  23523. // Whether we should destroy this session when onbeforeunload is called
  23524. this.destroyOnUnload = true;
  23525. if (gatewayCallbacks.destroyOnUnload !== undefined && gatewayCallbacks.destroyOnUnload !== null) this.destroyOnUnload = gatewayCallbacks.destroyOnUnload === true;
  23526. // Some timeout-related values
  23527. var keepAlivePeriod = 25000;
  23528. if (gatewayCallbacks.keepAlivePeriod !== undefined && gatewayCallbacks.keepAlivePeriod !== null) keepAlivePeriod = gatewayCallbacks.keepAlivePeriod;
  23529. if (isNaN(keepAlivePeriod)) keepAlivePeriod = 25000;
  23530. var longPollTimeout = 60000;
  23531. if (gatewayCallbacks.longPollTimeout !== undefined && gatewayCallbacks.longPollTimeout !== null) longPollTimeout = gatewayCallbacks.longPollTimeout;
  23532. if (isNaN(longPollTimeout)) longPollTimeout = 60000;
  23533. // overrides for default maxBitrate values for simulcasting
  23534. function getMaxBitrates(simulcastMaxBitrates) {
  23535. var maxBitrates = {
  23536. high: 900000,
  23537. medium: 300000,
  23538. low: 100000
  23539. };
  23540. if (simulcastMaxBitrates !== undefined && simulcastMaxBitrates !== null) {
  23541. if (simulcastMaxBitrates.high) maxBitrates.high = simulcastMaxBitrates.high;
  23542. if (simulcastMaxBitrates.medium) maxBitrates.medium = simulcastMaxBitrates.medium;
  23543. if (simulcastMaxBitrates.low) maxBitrates.low = simulcastMaxBitrates.low;
  23544. }
  23545. return maxBitrates;
  23546. }
  23547. var connected = false;
  23548. var sessionId = null;
  23549. var pluginHandles = {};
  23550. var that = this;
  23551. var retries = 0;
  23552. var transactions = {};
  23553. createSession(gatewayCallbacks);
  23554. // Public methods
  23555. this.getServer = function () {
  23556. return server;
  23557. };
  23558. this.isConnected = function () {
  23559. return connected;
  23560. };
  23561. this.reconnect = function (callbacks) {
  23562. callbacks = callbacks || {};
  23563. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  23564. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  23565. callbacks["reconnect"] = true;
  23566. createSession(callbacks);
  23567. };
  23568. this.getSessionId = function () {
  23569. return sessionId;
  23570. };
  23571. this.destroy = function (callbacks) {
  23572. destroySession(callbacks);
  23573. };
  23574. this.attach = function (callbacks) {
  23575. createHandle(callbacks);
  23576. };
  23577. function eventHandler() {
  23578. if (sessionId == null) return;
  23579. Janus$1.debug('Long poll...');
  23580. if (!connected) {
  23581. Janus$1.warn("Is the server down? (connected=false)");
  23582. return;
  23583. }
  23584. var longpoll = server + "/" + sessionId + "?rid=" + new Date().getTime();
  23585. if (maxev !== undefined && maxev !== null) longpoll = longpoll + "&maxev=" + maxev;
  23586. if (token !== null && token !== undefined) longpoll = longpoll + "&token=" + encodeURIComponent(token);
  23587. if (apisecret !== null && apisecret !== undefined) longpoll = longpoll + "&apisecret=" + encodeURIComponent(apisecret);
  23588. Janus$1.httpAPICall(longpoll, {
  23589. verb: 'GET',
  23590. withCredentials: withCredentials,
  23591. success: handleEvent,
  23592. timeout: longPollTimeout,
  23593. error: function error(textStatus, errorThrown) {
  23594. Janus$1.error(textStatus + ":", errorThrown);
  23595. retries++;
  23596. if (retries > 3) {
  23597. // Did we just lose the server? :-(
  23598. connected = false;
  23599. gatewayCallbacks.error("Lost connection to the server (is it down?)");
  23600. return;
  23601. }
  23602. eventHandler();
  23603. }
  23604. });
  23605. }
  23606. // Private event handler: this will trigger plugin callbacks, if set
  23607. function handleEvent(json, skipTimeout) {
  23608. retries = 0;
  23609. if (!websockets && sessionId !== undefined && sessionId !== null && skipTimeout !== true) eventHandler();
  23610. if (!websockets && Janus$1.isArray(json)) {
  23611. // We got an array: it means we passed a maxev > 1, iterate on all objects
  23612. for (var i = 0; i < json.length; i++) {
  23613. handleEvent(json[i], true);
  23614. }
  23615. return;
  23616. }
  23617. if (json["rtcgw"] === "keepalive") {
  23618. // Nothing happened
  23619. Janus$1.vdebug("Got a keepalive on session " + sessionId);
  23620. return;
  23621. } else if (json["rtcgw"] === "ack") {
  23622. // Just an ack, we can probably ignore
  23623. Janus$1.debug("Got an ack on session " + sessionId);
  23624. Janus$1.debug(json);
  23625. var transaction = json["transaction"];
  23626. if (transaction !== null && transaction !== undefined) {
  23627. var reportSuccess = transactions[transaction];
  23628. if (reportSuccess !== null && reportSuccess !== undefined) {
  23629. reportSuccess(json);
  23630. }
  23631. delete transactions[transaction];
  23632. }
  23633. return;
  23634. } else if (json["rtcgw"] === "success") {
  23635. // Success!
  23636. Janus$1.debug("Got a success on session " + sessionId);
  23637. Janus$1.debug(json);
  23638. var transaction = json["transaction"];
  23639. if (transaction !== null && transaction !== undefined) {
  23640. var reportSuccess = transactions[transaction];
  23641. if (reportSuccess !== null && reportSuccess !== undefined) {
  23642. reportSuccess(json);
  23643. }
  23644. delete transactions[transaction];
  23645. }
  23646. return;
  23647. } else if (json["rtcgw"] === "trickle") {
  23648. // We got a trickle candidate from Janus
  23649. var sender = json["sender"];
  23650. if (sender === undefined || sender === null) {
  23651. Janus$1.warn("Missing sender...");
  23652. return;
  23653. }
  23654. var pluginHandle = pluginHandles[sender];
  23655. if (pluginHandle === undefined || pluginHandle === null) {
  23656. Janus$1.debug("This handle is not attached to this session");
  23657. return;
  23658. }
  23659. var candidate = json["candidate"];
  23660. Janus$1.debug("Got a trickled candidate on session " + sessionId);
  23661. Janus$1.debug(candidate);
  23662. var config = pluginHandle.webrtcStuff;
  23663. if (config.pc && config.remoteSdp) {
  23664. // Add candidate right now
  23665. Janus$1.debug("Adding remote candidate:", candidate);
  23666. if (!candidate || candidate.completed === true) {
  23667. // end-of-candidates
  23668. config.pc.addIceCandidate(Janus$1.endOfCandidates);
  23669. } else {
  23670. // New candidate
  23671. config.pc.addIceCandidate(candidate);
  23672. }
  23673. } else {
  23674. // We didn't do setRemoteDescription (trickle got here before the offer?)
  23675. Janus$1.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate");
  23676. if (!config.candidates) config.candidates = [];
  23677. config.candidates.push(candidate);
  23678. Janus$1.debug(config.candidates);
  23679. }
  23680. } else if (json["rtcgw"] === "webrtcup") {
  23681. // The PeerConnection with the server is up! Notify this
  23682. Janus$1.debug("Got a webrtcup event on session " + sessionId);
  23683. Janus$1.debug(json);
  23684. var sender = json["sender"];
  23685. if (sender === undefined || sender === null) {
  23686. Janus$1.warn("Missing sender...");
  23687. return;
  23688. }
  23689. var pluginHandle = pluginHandles[sender];
  23690. if (pluginHandle === undefined || pluginHandle === null) {
  23691. Janus$1.debug("This handle is not attached to this session");
  23692. return;
  23693. }
  23694. pluginHandle.webrtcState(true);
  23695. return;
  23696. } else if (json["rtcgw"] === "hangup") {
  23697. // A plugin asked the core to hangup a PeerConnection on one of our handles
  23698. Janus$1.debug("Got a hangup event on session " + sessionId);
  23699. Janus$1.debug(json);
  23700. var sender = json["sender"];
  23701. if (sender === undefined || sender === null) {
  23702. Janus$1.warn("Missing sender...");
  23703. return;
  23704. }
  23705. var pluginHandle = pluginHandles[sender];
  23706. if (pluginHandle === undefined || pluginHandle === null) {
  23707. Janus$1.debug("This handle is not attached to this session");
  23708. return;
  23709. }
  23710. pluginHandle.webrtcState(false, json["reason"]);
  23711. pluginHandle.hangup();
  23712. } else if (json["rtcgw"] === "detached") {
  23713. // A plugin asked the core to detach one of our handles
  23714. Janus$1.debug("Got a detached event on session " + sessionId);
  23715. Janus$1.debug(json);
  23716. var sender = json["sender"];
  23717. if (sender === undefined || sender === null) {
  23718. Janus$1.warn("Missing sender...");
  23719. return;
  23720. }
  23721. var pluginHandle = pluginHandles[sender];
  23722. if (pluginHandle === undefined || pluginHandle === null) {
  23723. // Don't warn here because destroyHandle causes this situation.
  23724. return;
  23725. }
  23726. pluginHandle.detached = true;
  23727. pluginHandle.ondetached();
  23728. pluginHandle.detach();
  23729. } else if (json["rtcgw"] === "media") {
  23730. // Media started/stopped flowing
  23731. Janus$1.debug("Got a media event on session " + sessionId);
  23732. Janus$1.debug(json);
  23733. var sender = json["sender"];
  23734. if (sender === undefined || sender === null) {
  23735. Janus$1.warn("Missing sender...");
  23736. return;
  23737. }
  23738. var pluginHandle = pluginHandles[sender];
  23739. if (pluginHandle === undefined || pluginHandle === null) {
  23740. Janus$1.debug("This handle is not attached to this session");
  23741. return;
  23742. }
  23743. pluginHandle.mediaState(json["type"], json["receiving"]);
  23744. } else if (json["rtcgw"] === "slowlink") {
  23745. Janus$1.debug("Got a slowlink event on session " + sessionId);
  23746. Janus$1.debug(json);
  23747. // Trouble uplink or downlink
  23748. var sender = json["sender"];
  23749. if (sender === undefined || sender === null) {
  23750. Janus$1.warn("Missing sender...");
  23751. return;
  23752. }
  23753. var pluginHandle = pluginHandles[sender];
  23754. if (pluginHandle === undefined || pluginHandle === null) {
  23755. Janus$1.debug("This handle is not attached to this session");
  23756. return;
  23757. }
  23758. pluginHandle.slowLink(json["uplink"], json["lost"]);
  23759. } else if (json["rtcgw"] === "error") {
  23760. // Oops, something wrong happened
  23761. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  23762. Janus$1.debug(json);
  23763. var transaction = json["transaction"];
  23764. if (transaction !== null && transaction !== undefined) {
  23765. var reportSuccess = transactions[transaction];
  23766. if (reportSuccess !== null && reportSuccess !== undefined) {
  23767. reportSuccess(json);
  23768. }
  23769. delete transactions[transaction];
  23770. }
  23771. return;
  23772. } else if (json["rtcgw"] === "event") {
  23773. Janus$1.debug("Got a plugin event on session " + sessionId);
  23774. Janus$1.debug(json);
  23775. var sender = json["sender"];
  23776. if (sender === undefined || sender === null) {
  23777. Janus$1.warn("Missing sender...");
  23778. return;
  23779. }
  23780. var plugindata = json["plugindata"];
  23781. if (plugindata === undefined || plugindata === null) {
  23782. Janus$1.warn("Missing plugindata...");
  23783. return;
  23784. }
  23785. Janus$1.debug(" -- Event is coming from " + sender + " (" + plugindata["plugin"] + ")");
  23786. var data = plugindata["data"];
  23787. Janus$1.debug(data);
  23788. var pluginHandle = pluginHandles[sender];
  23789. if (pluginHandle === undefined || pluginHandle === null) {
  23790. Janus$1.warn("This handle is not attached to this session");
  23791. return;
  23792. }
  23793. var jsep = json["jsep"];
  23794. if (jsep !== undefined && jsep !== null) {
  23795. Janus$1.debug("Handling SDP as well...");
  23796. Janus$1.debug(jsep);
  23797. }
  23798. var callback = pluginHandle.onmessage;
  23799. if (callback !== null && callback !== undefined) {
  23800. Janus$1.debug("Notifying application...");
  23801. // Send to callback specified when attaching plugin handle
  23802. callback(data, jsep);
  23803. } else {
  23804. // Send to generic callback (?)
  23805. Janus$1.debug("No provided notification callback");
  23806. }
  23807. } else if (json["rtcgw"] === "timeout") {
  23808. Janus$1.error("Timeout on session " + sessionId);
  23809. Janus$1.debug(json);
  23810. if (websockets) {
  23811. ws.close(3504, "Gateway timeout");
  23812. }
  23813. return;
  23814. } else {
  23815. Janus$1.warn("Unknown message/event '" + json["rtcgw"] + "' on session " + sessionId);
  23816. Janus$1.debug(json);
  23817. }
  23818. }
  23819. // Private helper to send keep-alive messages on WebSockets
  23820. function keepAlive() {
  23821. if (server === null || !websockets || !connected) return;
  23822. wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
  23823. var request = {
  23824. "rtcgw": "keepalive",
  23825. "session_id": sessionId,
  23826. "transaction": Janus$1.randomString(12)
  23827. };
  23828. if (token !== null && token !== undefined) request["token"] = token;
  23829. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  23830. ws.send(JSON.stringify(request));
  23831. }
  23832. // Private method to create a session
  23833. function createSession(callbacks) {
  23834. var transaction = Janus$1.randomString(12);
  23835. // console.log("jannus create_token",stream);
  23836. var request = {
  23837. "rtcgw": "create",
  23838. "transaction": transaction,
  23839. "token": window.EZUIKit.opt.stream,
  23840. "device": window.EZUIKit.opt.deviceSerial,
  23841. "channel": window.EZUIKit.opt.channelNo
  23842. };
  23843. if (callbacks["reconnect"]) {
  23844. // We're reconnecting, claim the session
  23845. connected = false;
  23846. request["rtcgw"] = "claim";
  23847. request["session_id"] = sessionId;
  23848. // If we were using websockets, ignore the old connection
  23849. if (ws) {
  23850. ws.onopen = null;
  23851. ws.onerror = null;
  23852. ws.onclose = null;
  23853. if (wsKeepaliveTimeoutId) {
  23854. clearTimeout(wsKeepaliveTimeoutId);
  23855. wsKeepaliveTimeoutId = null;
  23856. }
  23857. }
  23858. }
  23859. if (token !== null && token !== undefined) request["token"] = token;
  23860. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  23861. if (server === null && Janus$1.isArray(servers)) {
  23862. // We still need to find a working server from the list we were given
  23863. server = servers[serversIndex];
  23864. if (server.indexOf("ws") === 0) {
  23865. websockets = true;
  23866. Janus$1.log("Server #" + (serversIndex + 1) + ": trying WebSockets to contact Janus (" + server + ")");
  23867. } else {
  23868. websockets = false;
  23869. Janus$1.log("Server #" + (serversIndex + 1) + ": trying REST API to contact Janus (" + server + ")");
  23870. }
  23871. }
  23872. if (websockets) {
  23873. ws = Janus$1.newWebSocket(server, 'rtcgw-protocol');
  23874. wsHandlers = {
  23875. 'error': function error() {
  23876. Janus$1.error("Error connecting to the Janus WebSockets server... " + server);
  23877. if (Janus$1.isArray(servers) && !callbacks["reconnect"]) {
  23878. serversIndex++;
  23879. if (serversIndex == servers.length) {
  23880. // We tried all the servers the user gave us and they all failed
  23881. callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
  23882. return;
  23883. }
  23884. // Let's try the next server
  23885. server = null;
  23886. setTimeout(function () {
  23887. createSession(callbacks);
  23888. }, 200);
  23889. return;
  23890. }
  23891. callbacks.error("Error connecting to the Janus WebSockets server: Is the server down?");
  23892. },
  23893. 'open': function open() {
  23894. // We need to be notified about the success
  23895. transactions[transaction] = function (json) {
  23896. Janus$1.debug(json);
  23897. if (json["rtcgw"] !== "success") {
  23898. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  23899. callbacks.error(json["error"].reason);
  23900. return;
  23901. }
  23902. wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
  23903. connected = true;
  23904. sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
  23905. if (callbacks["reconnect"]) {
  23906. Janus$1.log("Claimed session: " + sessionId);
  23907. } else {
  23908. Janus$1.log("Created session: " + sessionId);
  23909. }
  23910. Janus$1.sessions[sessionId] = that;
  23911. callbacks.success();
  23912. };
  23913. ws.send(JSON.stringify(request));
  23914. },
  23915. 'message': function message(event) {
  23916. handleEvent(JSON.parse(event.data));
  23917. },
  23918. 'close': function close() {
  23919. if (server === null || !connected) {
  23920. return;
  23921. }
  23922. connected = false;
  23923. // FIXME What if this is called when the page is closed?
  23924. gatewayCallbacks.error("Lost connection to the server (is it down?)");
  23925. }
  23926. };
  23927. for (var eventName in wsHandlers) {
  23928. ws.addEventListener(eventName, wsHandlers[eventName]);
  23929. }
  23930. return;
  23931. }
  23932. Janus$1.httpAPICall(server, {
  23933. verb: 'POST',
  23934. withCredentials: withCredentials,
  23935. body: request,
  23936. success: function success(json) {
  23937. Janus$1.debug(json);
  23938. if (json["rtcgw"] !== "success") {
  23939. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  23940. callbacks.error(json["error"].reason);
  23941. return;
  23942. }
  23943. connected = true;
  23944. sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
  23945. if (callbacks["reconnect"]) {
  23946. Janus$1.log("Claimed session: " + sessionId);
  23947. } else {
  23948. Janus$1.log("Created session: " + sessionId);
  23949. }
  23950. Janus$1.sessions[sessionId] = that;
  23951. eventHandler();
  23952. callbacks.success();
  23953. },
  23954. error: function error(textStatus, errorThrown) {
  23955. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  23956. if (Janus$1.isArray(servers) && !callbacks["reconnect"]) {
  23957. serversIndex++;
  23958. if (serversIndex == servers.length) {
  23959. // We tried all the servers the user gave us and they all failed
  23960. callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
  23961. return;
  23962. }
  23963. // Let's try the next server
  23964. server = null;
  23965. setTimeout(function () {
  23966. createSession(callbacks);
  23967. }, 200);
  23968. return;
  23969. }
  23970. if (errorThrown === "") callbacks.error(textStatus + ": Is the server down?");else callbacks.error(textStatus + ": " + errorThrown);
  23971. }
  23972. });
  23973. }
  23974. // Private method to destroy a session
  23975. function destroySession(callbacks) {
  23976. callbacks = callbacks || {};
  23977. // FIXME This method triggers a success even when we fail
  23978. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  23979. var asyncRequest = true;
  23980. if (callbacks.asyncRequest !== undefined && callbacks.asyncRequest !== null) asyncRequest = callbacks.asyncRequest === true;
  23981. var notifyDestroyed = true;
  23982. if (callbacks.notifyDestroyed !== undefined && callbacks.notifyDestroyed !== null) notifyDestroyed = callbacks.notifyDestroyed === true;
  23983. var cleanupHandles = false;
  23984. if (callbacks.cleanupHandles !== undefined && callbacks.cleanupHandles !== null) cleanupHandles = callbacks.cleanupHandles === true;
  23985. Janus$1.log("Destroying session " + sessionId + " (async=" + asyncRequest + ")");
  23986. if (!connected) {
  23987. Janus$1.warn("Is the server down? (connected=false)");
  23988. callbacks.success();
  23989. return;
  23990. }
  23991. if (sessionId === undefined || sessionId === null) {
  23992. Janus$1.warn("No session to destroy");
  23993. callbacks.success();
  23994. if (notifyDestroyed) gatewayCallbacks.destroyed();
  23995. return;
  23996. }
  23997. if (cleanupHandles) {
  23998. for (var handleId in pluginHandles) {
  23999. destroyHandle(handleId, {
  24000. noRequest: true
  24001. });
  24002. }
  24003. }
  24004. // No need to destroy all handles first, Janus will do that itself
  24005. var request = {
  24006. "rtcgw": "destroy",
  24007. "transaction": Janus$1.randomString(12)
  24008. };
  24009. if (token !== null && token !== undefined) request["token"] = token;
  24010. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  24011. if (websockets) {
  24012. request["session_id"] = sessionId;
  24013. var unbindWebSocket = function unbindWebSocket() {
  24014. for (var eventName in wsHandlers) {
  24015. ws.removeEventListener(eventName, wsHandlers[eventName]);
  24016. }
  24017. ws.removeEventListener('message', onUnbindMessage);
  24018. ws.removeEventListener('error', onUnbindError);
  24019. if (wsKeepaliveTimeoutId) {
  24020. clearTimeout(wsKeepaliveTimeoutId);
  24021. }
  24022. ws.close();
  24023. };
  24024. var onUnbindMessage = function onUnbindMessage(event) {
  24025. var data = JSON.parse(event.data);
  24026. if (data.session_id == request.session_id && data.transaction == request.transaction) {
  24027. unbindWebSocket();
  24028. callbacks.success();
  24029. if (notifyDestroyed) gatewayCallbacks.destroyed();
  24030. }
  24031. };
  24032. var onUnbindError = function onUnbindError(event) {
  24033. unbindWebSocket();
  24034. callbacks.error("Failed to destroy the server: Is the server down?");
  24035. if (notifyDestroyed) gatewayCallbacks.destroyed();
  24036. };
  24037. ws.addEventListener('message', onUnbindMessage);
  24038. ws.addEventListener('error', onUnbindError);
  24039. ws.send(JSON.stringify(request));
  24040. return;
  24041. }
  24042. Janus$1.httpAPICall(server + "/" + sessionId, {
  24043. verb: 'POST',
  24044. async: asyncRequest,
  24045. // Sometimes we need false here, or destroying in onbeforeunload won't work
  24046. withCredentials: withCredentials,
  24047. body: request,
  24048. success: function success(json) {
  24049. Janus$1.log("Destroyed session:");
  24050. Janus$1.debug(json);
  24051. sessionId = null;
  24052. connected = false;
  24053. if (json["rtcgw"] !== "success") {
  24054. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24055. }
  24056. callbacks.success();
  24057. if (notifyDestroyed) gatewayCallbacks.destroyed();
  24058. },
  24059. error: function error(textStatus, errorThrown) {
  24060. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  24061. // Reset everything anyway
  24062. sessionId = null;
  24063. connected = false;
  24064. callbacks.success();
  24065. if (notifyDestroyed) gatewayCallbacks.destroyed();
  24066. }
  24067. });
  24068. }
  24069. // Private method to create a plugin handle
  24070. function createHandle(callbacks) {
  24071. callbacks = callbacks || {};
  24072. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24073. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  24074. callbacks.consentDialog = typeof callbacks.consentDialog == "function" ? callbacks.consentDialog : Janus$1.noop;
  24075. callbacks.iceState = typeof callbacks.iceState == "function" ? callbacks.iceState : Janus$1.noop;
  24076. callbacks.mediaState = typeof callbacks.mediaState == "function" ? callbacks.mediaState : Janus$1.noop;
  24077. callbacks.webrtcState = typeof callbacks.webrtcState == "function" ? callbacks.webrtcState : Janus$1.noop;
  24078. callbacks.slowLink = typeof callbacks.slowLink == "function" ? callbacks.slowLink : Janus$1.noop;
  24079. callbacks.onmessage = typeof callbacks.onmessage == "function" ? callbacks.onmessage : Janus$1.noop;
  24080. callbacks.onlocalstream = typeof callbacks.onlocalstream == "function" ? callbacks.onlocalstream : Janus$1.noop;
  24081. callbacks.onremotestream = typeof callbacks.onremotestream == "function" ? callbacks.onremotestream : Janus$1.noop;
  24082. callbacks.ondata = typeof callbacks.ondata == "function" ? callbacks.ondata : Janus$1.noop;
  24083. callbacks.ondataopen = typeof callbacks.ondataopen == "function" ? callbacks.ondataopen : Janus$1.noop;
  24084. callbacks.oncleanup = typeof callbacks.oncleanup == "function" ? callbacks.oncleanup : Janus$1.noop;
  24085. callbacks.ondetached = typeof callbacks.ondetached == "function" ? callbacks.ondetached : Janus$1.noop;
  24086. if (!connected) {
  24087. Janus$1.warn("Is the server down? (connected=false)");
  24088. callbacks.error("Is the server down? (connected=false)");
  24089. return;
  24090. }
  24091. var plugin = callbacks.plugin;
  24092. if (plugin === undefined || plugin === null) {
  24093. Janus$1.error("Invalid plugin");
  24094. callbacks.error("Invalid plugin");
  24095. return;
  24096. }
  24097. var opaqueId = callbacks.opaqueId;
  24098. var handleToken = callbacks.token ? callbacks.token : token;
  24099. var transaction = Janus$1.randomString(12);
  24100. var request = {
  24101. "rtcgw": "attach",
  24102. "plugin": plugin,
  24103. "opaque_id": opaqueId,
  24104. "transaction": transaction
  24105. };
  24106. if (handleToken !== null && handleToken !== undefined) request["token"] = handleToken;
  24107. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  24108. if (websockets) {
  24109. transactions[transaction] = function (json) {
  24110. Janus$1.debug(json);
  24111. if (json["rtcgw"] !== "success") {
  24112. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24113. callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
  24114. return;
  24115. }
  24116. var handleId = json.data["id"];
  24117. Janus$1.log("Created handle: " + handleId);
  24118. var pluginHandle = {
  24119. session: that,
  24120. plugin: plugin,
  24121. id: handleId,
  24122. token: handleToken,
  24123. detached: false,
  24124. webrtcStuff: {
  24125. started: false,
  24126. myStream: null,
  24127. streamExternal: false,
  24128. remoteStream: null,
  24129. mySdp: null,
  24130. mediaConstraints: null,
  24131. pc: null,
  24132. dataChannel: {},
  24133. dtmfSender: null,
  24134. trickle: true,
  24135. iceDone: false,
  24136. volume: {
  24137. value: null,
  24138. timer: null
  24139. },
  24140. bitrate: {
  24141. value: null,
  24142. bsnow: null,
  24143. bsbefore: null,
  24144. tsnow: null,
  24145. tsbefore: null,
  24146. timer: null
  24147. }
  24148. },
  24149. getId: function getId() {
  24150. return handleId;
  24151. },
  24152. getPlugin: function getPlugin() {
  24153. return plugin;
  24154. },
  24155. getVolume: function getVolume() {
  24156. return _getVolume(handleId, true);
  24157. },
  24158. getRemoteVolume: function getRemoteVolume() {
  24159. return _getVolume(handleId, true);
  24160. },
  24161. getLocalVolume: function getLocalVolume() {
  24162. return _getVolume(handleId, false);
  24163. },
  24164. isAudioMuted: function isAudioMuted() {
  24165. return isMuted(handleId, false);
  24166. },
  24167. muteAudio: function muteAudio() {
  24168. return mute(handleId, false, true);
  24169. },
  24170. unmuteAudio: function unmuteAudio() {
  24171. return mute(handleId, false, false);
  24172. },
  24173. isVideoMuted: function isVideoMuted() {
  24174. return isMuted(handleId, true);
  24175. },
  24176. muteVideo: function muteVideo() {
  24177. return mute(handleId, true, true);
  24178. },
  24179. unmuteVideo: function unmuteVideo() {
  24180. return mute(handleId, true, false);
  24181. },
  24182. getBitrate: function getBitrate() {
  24183. return _getBitrate(handleId);
  24184. },
  24185. send: function send(callbacks) {
  24186. sendMessage(handleId, callbacks);
  24187. },
  24188. data: function data(callbacks) {
  24189. sendData(handleId, callbacks);
  24190. },
  24191. dtmf: function dtmf(callbacks) {
  24192. sendDtmf(handleId, callbacks);
  24193. },
  24194. consentDialog: callbacks.consentDialog,
  24195. iceState: callbacks.iceState,
  24196. mediaState: callbacks.mediaState,
  24197. webrtcState: callbacks.webrtcState,
  24198. slowLink: callbacks.slowLink,
  24199. onmessage: callbacks.onmessage,
  24200. createOffer: function createOffer(callbacks) {
  24201. prepareWebrtc(handleId, true, callbacks);
  24202. },
  24203. createAnswer: function createAnswer(callbacks) {
  24204. prepareWebrtc(handleId, false, callbacks);
  24205. },
  24206. handleRemoteJsep: function handleRemoteJsep(callbacks) {
  24207. prepareWebrtcPeer(handleId, callbacks);
  24208. },
  24209. onlocalstream: callbacks.onlocalstream,
  24210. onremotestream: callbacks.onremotestream,
  24211. ondata: callbacks.ondata,
  24212. ondataopen: callbacks.ondataopen,
  24213. oncleanup: callbacks.oncleanup,
  24214. ondetached: callbacks.ondetached,
  24215. hangup: function hangup(sendRequest) {
  24216. cleanupWebrtc(handleId, sendRequest === true);
  24217. },
  24218. detach: function detach(callbacks) {
  24219. destroyHandle(handleId, callbacks);
  24220. }
  24221. };
  24222. pluginHandles[handleId] = pluginHandle;
  24223. callbacks.success(pluginHandle);
  24224. };
  24225. request["session_id"] = sessionId;
  24226. ws.send(JSON.stringify(request));
  24227. return;
  24228. }
  24229. Janus$1.httpAPICall(server + "/" + sessionId, {
  24230. verb: 'POST',
  24231. withCredentials: withCredentials,
  24232. body: request,
  24233. success: function success(json) {
  24234. Janus$1.debug(json);
  24235. if (json["rtcgw"] !== "success") {
  24236. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24237. callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
  24238. return;
  24239. }
  24240. var handleId = json.data["id"];
  24241. Janus$1.log("Created handle: " + handleId);
  24242. var pluginHandle = {
  24243. session: that,
  24244. plugin: plugin,
  24245. id: handleId,
  24246. token: handleToken,
  24247. detached: false,
  24248. webrtcStuff: {
  24249. started: false,
  24250. myStream: null,
  24251. streamExternal: false,
  24252. remoteStream: null,
  24253. mySdp: null,
  24254. mediaConstraints: null,
  24255. pc: null,
  24256. dataChannel: {},
  24257. dtmfSender: null,
  24258. trickle: true,
  24259. iceDone: false,
  24260. volume: {
  24261. value: null,
  24262. timer: null
  24263. },
  24264. bitrate: {
  24265. value: null,
  24266. bsnow: null,
  24267. bsbefore: null,
  24268. tsnow: null,
  24269. tsbefore: null,
  24270. timer: null
  24271. }
  24272. },
  24273. getId: function getId() {
  24274. return handleId;
  24275. },
  24276. getPlugin: function getPlugin() {
  24277. return plugin;
  24278. },
  24279. getVolume: function getVolume() {
  24280. return _getVolume(handleId, true);
  24281. },
  24282. getRemoteVolume: function getRemoteVolume() {
  24283. return _getVolume(handleId, true);
  24284. },
  24285. getLocalVolume: function getLocalVolume() {
  24286. return _getVolume(handleId, false);
  24287. },
  24288. isAudioMuted: function isAudioMuted() {
  24289. return isMuted(handleId, false);
  24290. },
  24291. muteAudio: function muteAudio() {
  24292. return mute(handleId, false, true);
  24293. },
  24294. unmuteAudio: function unmuteAudio() {
  24295. return mute(handleId, false, false);
  24296. },
  24297. isVideoMuted: function isVideoMuted() {
  24298. return isMuted(handleId, true);
  24299. },
  24300. muteVideo: function muteVideo() {
  24301. return mute(handleId, true, true);
  24302. },
  24303. unmuteVideo: function unmuteVideo() {
  24304. return mute(handleId, true, false);
  24305. },
  24306. getBitrate: function getBitrate() {
  24307. return _getBitrate(handleId);
  24308. },
  24309. send: function send(callbacks) {
  24310. sendMessage(handleId, callbacks);
  24311. },
  24312. data: function data(callbacks) {
  24313. sendData(handleId, callbacks);
  24314. },
  24315. dtmf: function dtmf(callbacks) {
  24316. sendDtmf(handleId, callbacks);
  24317. },
  24318. consentDialog: callbacks.consentDialog,
  24319. iceState: callbacks.iceState,
  24320. mediaState: callbacks.mediaState,
  24321. webrtcState: callbacks.webrtcState,
  24322. slowLink: callbacks.slowLink,
  24323. onmessage: callbacks.onmessage,
  24324. createOffer: function createOffer(callbacks) {
  24325. prepareWebrtc(handleId, true, callbacks);
  24326. },
  24327. createAnswer: function createAnswer(callbacks) {
  24328. prepareWebrtc(handleId, false, callbacks);
  24329. },
  24330. handleRemoteJsep: function handleRemoteJsep(callbacks) {
  24331. prepareWebrtcPeer(handleId, callbacks);
  24332. },
  24333. onlocalstream: callbacks.onlocalstream,
  24334. onremotestream: callbacks.onremotestream,
  24335. ondata: callbacks.ondata,
  24336. ondataopen: callbacks.ondataopen,
  24337. oncleanup: callbacks.oncleanup,
  24338. ondetached: callbacks.ondetached,
  24339. hangup: function hangup(sendRequest) {
  24340. cleanupWebrtc(handleId, sendRequest === true);
  24341. },
  24342. detach: function detach(callbacks) {
  24343. destroyHandle(handleId, callbacks);
  24344. }
  24345. };
  24346. pluginHandles[handleId] = pluginHandle;
  24347. callbacks.success(pluginHandle);
  24348. },
  24349. error: function error(textStatus, errorThrown) {
  24350. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  24351. }
  24352. });
  24353. }
  24354. // Private method to send a message
  24355. function sendMessage(handleId, callbacks) {
  24356. callbacks = callbacks || {};
  24357. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24358. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  24359. if (!connected) {
  24360. Janus$1.warn("Is the server down? (connected=false)");
  24361. callbacks.error("Is the server down? (connected=false)");
  24362. return;
  24363. }
  24364. var pluginHandle = pluginHandles[handleId];
  24365. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24366. Janus$1.warn("Invalid handle");
  24367. callbacks.error("Invalid handle");
  24368. return;
  24369. }
  24370. var message = callbacks.message;
  24371. var jsep = callbacks.jsep;
  24372. var transaction = Janus$1.randomString(12);
  24373. var request = {
  24374. "rtcgw": "message",
  24375. "body": message,
  24376. "transaction": transaction
  24377. };
  24378. if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
  24379. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  24380. if (jsep !== null && jsep !== undefined) request.jsep = jsep;
  24381. Janus$1.debug("Sending message to plugin (handle=" + handleId + "):");
  24382. Janus$1.debug(request);
  24383. if (websockets) {
  24384. request["session_id"] = sessionId;
  24385. request["handle_id"] = handleId;
  24386. transactions[transaction] = function (json) {
  24387. Janus$1.debug("Message sent!");
  24388. Janus$1.debug(json);
  24389. if (json["rtcgw"] === "success") {
  24390. // We got a success, must have been a synchronous transaction
  24391. var plugindata = json["plugindata"];
  24392. if (plugindata === undefined || plugindata === null) {
  24393. Janus$1.warn("Request succeeded, but missing plugindata...");
  24394. callbacks.success();
  24395. return;
  24396. }
  24397. Janus$1.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
  24398. var data = plugindata["data"];
  24399. Janus$1.debug(data);
  24400. callbacks.success(data);
  24401. return;
  24402. } else if (json["rtcgw"] !== "ack") {
  24403. // Not a success and not an ack, must be an error
  24404. if (json["error"] !== undefined && json["error"] !== null) {
  24405. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24406. callbacks.error(json["error"].code + " " + json["error"].reason);
  24407. } else {
  24408. Janus$1.error("Unknown error"); // FIXME
  24409. callbacks.error("Unknown error");
  24410. }
  24411. return;
  24412. }
  24413. // If we got here, the plugin decided to handle the request asynchronously
  24414. callbacks.success();
  24415. };
  24416. ws.send(JSON.stringify(request));
  24417. return;
  24418. }
  24419. Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
  24420. verb: 'POST',
  24421. withCredentials: withCredentials,
  24422. body: request,
  24423. success: function success(json) {
  24424. Janus$1.debug("Message sent!");
  24425. Janus$1.debug(json);
  24426. if (json["rtcgw"] === "success") {
  24427. // We got a success, must have been a synchronous transaction
  24428. var plugindata = json["plugindata"];
  24429. if (plugindata === undefined || plugindata === null) {
  24430. Janus$1.warn("Request succeeded, but missing plugindata...");
  24431. callbacks.success();
  24432. return;
  24433. }
  24434. Janus$1.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
  24435. var data = plugindata["data"];
  24436. Janus$1.debug(data);
  24437. callbacks.success(data);
  24438. return;
  24439. } else if (json["rtcgw"] !== "ack") {
  24440. // Not a success and not an ack, must be an error
  24441. if (json["error"] !== undefined && json["error"] !== null) {
  24442. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24443. callbacks.error(json["error"].code + " " + json["error"].reason);
  24444. } else {
  24445. Janus$1.error("Unknown error"); // FIXME
  24446. callbacks.error("Unknown error");
  24447. }
  24448. return;
  24449. }
  24450. // If we got here, the plugin decided to handle the request asynchronously
  24451. callbacks.success();
  24452. },
  24453. error: function error(textStatus, errorThrown) {
  24454. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  24455. callbacks.error(textStatus + ": " + errorThrown);
  24456. }
  24457. });
  24458. }
  24459. // Private method to send a trickle candidate
  24460. function sendTrickleCandidate(handleId, candidate) {
  24461. if (!connected) {
  24462. Janus$1.warn("Is the server down? (connected=false)");
  24463. return;
  24464. }
  24465. var pluginHandle = pluginHandles[handleId];
  24466. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24467. Janus$1.warn("Invalid handle");
  24468. return;
  24469. }
  24470. var request = {
  24471. "rtcgw": "trickle",
  24472. "candidate": candidate,
  24473. "transaction": Janus$1.randomString(12)
  24474. };
  24475. if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
  24476. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  24477. Janus$1.vdebug("Sending trickle candidate (handle=" + handleId + "):");
  24478. Janus$1.vdebug(request);
  24479. if (websockets) {
  24480. request["session_id"] = sessionId;
  24481. request["handle_id"] = handleId;
  24482. ws.send(JSON.stringify(request));
  24483. return;
  24484. }
  24485. Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
  24486. verb: 'POST',
  24487. withCredentials: withCredentials,
  24488. body: request,
  24489. success: function success(json) {
  24490. Janus$1.vdebug("Candidate sent!");
  24491. Janus$1.vdebug(json);
  24492. if (json["rtcgw"] !== "ack") {
  24493. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24494. return;
  24495. }
  24496. },
  24497. error: function error(textStatus, errorThrown) {
  24498. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  24499. }
  24500. });
  24501. }
  24502. // Private method to create a data channel
  24503. function createDataChannel(handleId, dclabel, incoming, pendingText) {
  24504. var pluginHandle = pluginHandles[handleId];
  24505. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24506. Janus$1.warn("Invalid handle");
  24507. return;
  24508. }
  24509. var config = pluginHandle.webrtcStuff;
  24510. var onDataChannelMessage = function onDataChannelMessage(event) {
  24511. Janus$1.log('Received message on data channel:', event);
  24512. var label = event.target.label;
  24513. pluginHandle.ondata(event.data, label);
  24514. };
  24515. var onDataChannelStateChange = function onDataChannelStateChange(event) {
  24516. Janus$1.log('Received state change on data channel:', event);
  24517. var label = event.target.label;
  24518. var dcState = config.dataChannel[label] ? config.dataChannel[label].readyState : "null";
  24519. Janus$1.log('State change on <' + label + '> data channel: ' + dcState);
  24520. if (dcState === 'open') {
  24521. // Any pending messages to send?
  24522. if (config.dataChannel[label].pending && config.dataChannel[label].pending.length > 0) {
  24523. Janus$1.log("Sending pending messages on <" + label + ">:", config.dataChannel[label].pending.length);
  24524. for (var i in config.dataChannel[label].pending) {
  24525. var text = config.dataChannel[label].pending[i];
  24526. Janus$1.log("Sending string on data channel <" + label + ">: " + text);
  24527. config.dataChannel[label].send(text);
  24528. }
  24529. config.dataChannel[label].pending = [];
  24530. }
  24531. // Notify the open data channel
  24532. pluginHandle.ondataopen(label);
  24533. }
  24534. };
  24535. var onDataChannelError = function onDataChannelError(error) {
  24536. Janus$1.error('Got error on data channel:', error);
  24537. // TODO
  24538. };
  24539. if (!incoming) {
  24540. // FIXME Add options (ordered, maxRetransmits, etc.)
  24541. config.dataChannel[dclabel] = config.pc.createDataChannel(dclabel, {
  24542. ordered: false
  24543. });
  24544. } else {
  24545. // The channel was created by Janus
  24546. config.dataChannel[dclabel] = incoming;
  24547. }
  24548. config.dataChannel[dclabel].onmessage = onDataChannelMessage;
  24549. config.dataChannel[dclabel].onopen = onDataChannelStateChange;
  24550. config.dataChannel[dclabel].onclose = onDataChannelStateChange;
  24551. config.dataChannel[dclabel].onerror = onDataChannelError;
  24552. config.dataChannel[dclabel].pending = [];
  24553. if (pendingText) config.dataChannel[dclabel].pending.push(pendingText);
  24554. }
  24555. // Private method to send a data channel message
  24556. function sendData(handleId, callbacks) {
  24557. callbacks = callbacks || {};
  24558. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24559. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  24560. var pluginHandle = pluginHandles[handleId];
  24561. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24562. Janus$1.warn("Invalid handle");
  24563. callbacks.error("Invalid handle");
  24564. return;
  24565. }
  24566. var config = pluginHandle.webrtcStuff;
  24567. var text = callbacks.text;
  24568. if (text === null || text === undefined) {
  24569. Janus$1.warn("Invalid text");
  24570. callbacks.error("Invalid text");
  24571. return;
  24572. }
  24573. var label = callbacks.label ? callbacks.label : Janus$1.dataChanDefaultLabel;
  24574. if (!config.dataChannel[label]) {
  24575. // Create new data channel and wait for it to open
  24576. createDataChannel(handleId, label, false, text);
  24577. callbacks.success();
  24578. return;
  24579. }
  24580. if (config.dataChannel[label].readyState !== "open") {
  24581. config.dataChannel[label].pending.push(text);
  24582. callbacks.success();
  24583. return;
  24584. }
  24585. Janus$1.log("Sending string on data channel <" + label + ">: " + text);
  24586. config.dataChannel[label].send(text);
  24587. callbacks.success();
  24588. }
  24589. // Private method to send a DTMF tone
  24590. function sendDtmf(handleId, callbacks) {
  24591. callbacks = callbacks || {};
  24592. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24593. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  24594. var pluginHandle = pluginHandles[handleId];
  24595. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24596. Janus$1.warn("Invalid handle");
  24597. callbacks.error("Invalid handle");
  24598. return;
  24599. }
  24600. var config = pluginHandle.webrtcStuff;
  24601. if (config.dtmfSender === null || config.dtmfSender === undefined) {
  24602. // Create the DTMF sender the proper way, if possible
  24603. if (config.pc !== undefined && config.pc !== null) {
  24604. var senders = config.pc.getSenders();
  24605. var audioSender = senders.find(function (sender) {
  24606. return sender.track && sender.track.kind === 'audio';
  24607. });
  24608. if (!audioSender) {
  24609. Janus$1.warn("Invalid DTMF configuration (no audio track)");
  24610. callbacks.error("Invalid DTMF configuration (no audio track)");
  24611. return;
  24612. }
  24613. config.dtmfSender = audioSender.dtmf;
  24614. if (config.dtmfSender) {
  24615. Janus$1.log("Created DTMF Sender");
  24616. config.dtmfSender.ontonechange = function (tone) {
  24617. Janus$1.debug("Sent DTMF tone: " + tone.tone);
  24618. };
  24619. }
  24620. }
  24621. if (config.dtmfSender === null || config.dtmfSender === undefined) {
  24622. Janus$1.warn("Invalid DTMF configuration");
  24623. callbacks.error("Invalid DTMF configuration");
  24624. return;
  24625. }
  24626. }
  24627. var dtmf = callbacks.dtmf;
  24628. if (dtmf === null || dtmf === undefined) {
  24629. Janus$1.warn("Invalid DTMF parameters");
  24630. callbacks.error("Invalid DTMF parameters");
  24631. return;
  24632. }
  24633. var tones = dtmf.tones;
  24634. if (tones === null || tones === undefined) {
  24635. Janus$1.warn("Invalid DTMF string");
  24636. callbacks.error("Invalid DTMF string");
  24637. return;
  24638. }
  24639. var duration = dtmf.duration;
  24640. if (duration === null || duration === undefined) duration = 500; // We choose 500ms as the default duration for a tone
  24641. var gap = dtmf.gap;
  24642. if (gap === null || gap === undefined) gap = 50; // We choose 50ms as the default gap between tones
  24643. Janus$1.debug("Sending DTMF string " + tones + " (duration " + duration + "ms, gap " + gap + "ms)");
  24644. config.dtmfSender.insertDTMF(tones, duration, gap);
  24645. callbacks.success();
  24646. }
  24647. // Private method to destroy a plugin handle
  24648. function destroyHandle(handleId, callbacks) {
  24649. callbacks = callbacks || {};
  24650. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24651. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  24652. var asyncRequest = true;
  24653. if (callbacks.asyncRequest !== undefined && callbacks.asyncRequest !== null) asyncRequest = callbacks.asyncRequest === true;
  24654. var noRequest = true;
  24655. if (callbacks.noRequest !== undefined && callbacks.noRequest !== null) noRequest = callbacks.noRequest === true;
  24656. Janus$1.log("Destroying handle " + handleId + " (async=" + asyncRequest + ")");
  24657. cleanupWebrtc(handleId);
  24658. var pluginHandle = pluginHandles[handleId];
  24659. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.detached) {
  24660. // Plugin was already detached by Janus, calling detach again will return a handle not found error, so just exit here
  24661. delete pluginHandles[handleId];
  24662. callbacks.success();
  24663. return;
  24664. }
  24665. if (noRequest) {
  24666. // We're only removing the handle locally
  24667. delete pluginHandles[handleId];
  24668. callbacks.success();
  24669. return;
  24670. }
  24671. if (!connected) {
  24672. Janus$1.warn("Is the server down? (connected=false)");
  24673. callbacks.error("Is the server down? (connected=false)");
  24674. return;
  24675. }
  24676. var request = {
  24677. "rtcgw": "detach",
  24678. "transaction": Janus$1.randomString(12)
  24679. };
  24680. if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
  24681. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  24682. if (websockets) {
  24683. request["session_id"] = sessionId;
  24684. request["handle_id"] = handleId;
  24685. ws.send(JSON.stringify(request));
  24686. delete pluginHandles[handleId];
  24687. callbacks.success();
  24688. return;
  24689. }
  24690. Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
  24691. verb: 'POST',
  24692. async: asyncRequest,
  24693. // Sometimes we need false here, or destroying in onbeforeunload won't work
  24694. withCredentials: withCredentials,
  24695. body: request,
  24696. success: function success(json) {
  24697. Janus$1.log("Destroyed handle:");
  24698. Janus$1.debug(json);
  24699. if (json["rtcgw"] !== "success") {
  24700. Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
  24701. }
  24702. delete pluginHandles[handleId];
  24703. callbacks.success();
  24704. },
  24705. error: function error(textStatus, errorThrown) {
  24706. Janus$1.error(textStatus + ":", errorThrown); // FIXME
  24707. // We cleanup anyway
  24708. delete pluginHandles[handleId];
  24709. callbacks.success();
  24710. }
  24711. });
  24712. }
  24713. // WebRTC stuff
  24714. function streamsDone(handleId, jsep, media, callbacks, stream) {
  24715. var pluginHandle = pluginHandles[handleId];
  24716. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24717. Janus$1.warn("Invalid handle");
  24718. callbacks.error("Invalid handle");
  24719. return;
  24720. }
  24721. var config = pluginHandle.webrtcStuff;
  24722. Janus$1.debug("streamsDone:", stream);
  24723. if (stream) {
  24724. Janus$1.debug(" -- Audio tracks:", stream.getAudioTracks());
  24725. Janus$1.debug(" -- Video tracks:", stream.getVideoTracks());
  24726. }
  24727. // We're now capturing the new stream: check if we're updating or if it's a new thing
  24728. var addTracks = false;
  24729. if (!config.myStream || !media.update || config.streamExternal) {
  24730. config.myStream = stream;
  24731. addTracks = true;
  24732. } else {
  24733. // We only need to update the existing stream
  24734. if ((!media.update && isAudioSendEnabled(media) || media.update && (media.addAudio || media.replaceAudio)) && stream.getAudioTracks() && stream.getAudioTracks().length) {
  24735. config.myStream.addTrack(stream.getAudioTracks()[0]);
  24736. if (Janus$1.unifiedPlan) {
  24737. // Use Transceivers
  24738. Janus$1.log((media.replaceAudio ? "Replacing" : "Adding") + " audio track:", stream.getAudioTracks()[0]);
  24739. var audioTransceiver = null;
  24740. var transceivers = config.pc.getTransceivers();
  24741. if (transceivers && transceivers.length > 0) {
  24742. for (var i in transceivers) {
  24743. var t = transceivers[i];
  24744. if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
  24745. audioTransceiver = t;
  24746. break;
  24747. }
  24748. }
  24749. }
  24750. if (audioTransceiver && audioTransceiver.sender) {
  24751. audioTransceiver.sender.replaceTrack(stream.getAudioTracks()[0]);
  24752. } else {
  24753. config.pc.addTrack(stream.getAudioTracks()[0], stream);
  24754. }
  24755. } else {
  24756. Janus$1.log((media.replaceAudio ? "Replacing" : "Adding") + " audio track:", stream.getAudioTracks()[0]);
  24757. config.pc.addTrack(stream.getAudioTracks()[0], stream);
  24758. }
  24759. }
  24760. if ((!media.update && isVideoSendEnabled(media) || media.update && (media.addVideo || media.replaceVideo)) && stream.getVideoTracks() && stream.getVideoTracks().length) {
  24761. config.myStream.addTrack(stream.getVideoTracks()[0]);
  24762. if (Janus$1.unifiedPlan) {
  24763. // Use Transceivers
  24764. Janus$1.log((media.replaceVideo ? "Replacing" : "Adding") + " video track:", stream.getVideoTracks()[0]);
  24765. var videoTransceiver = null;
  24766. var transceivers = config.pc.getTransceivers();
  24767. if (transceivers && transceivers.length > 0) {
  24768. for (var i in transceivers) {
  24769. var t = transceivers[i];
  24770. if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
  24771. videoTransceiver = t;
  24772. break;
  24773. }
  24774. }
  24775. }
  24776. if (videoTransceiver && videoTransceiver.sender) {
  24777. videoTransceiver.sender.replaceTrack(stream.getVideoTracks()[0]);
  24778. } else {
  24779. config.pc.addTrack(stream.getVideoTracks()[0], stream);
  24780. }
  24781. } else {
  24782. Janus$1.log((media.replaceVideo ? "Replacing" : "Adding") + " video track:", stream.getVideoTracks()[0]);
  24783. config.pc.addTrack(stream.getVideoTracks()[0], stream);
  24784. }
  24785. }
  24786. }
  24787. // If we still need to create a PeerConnection, let's do that
  24788. if (!config.pc) {
  24789. var pc_config = {
  24790. "iceServers": iceServers,
  24791. "iceTransportPolicy": iceTransportPolicy,
  24792. "bundlePolicy": bundlePolicy
  24793. };
  24794. if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
  24795. // For Chrome versions before 72, we force a plan-b semantic, and unified-plan otherwise
  24796. pc_config["sdpSemantics"] = Janus$1.webRTCAdapter.browserDetails.version < 72 ? "plan-b" : "unified-plan";
  24797. }
  24798. var pc_constraints = {
  24799. "optional": [{
  24800. "DtlsSrtpKeyAgreement": true
  24801. }]
  24802. };
  24803. if (ipv6Support === true) {
  24804. pc_constraints.optional.push({
  24805. "googIPv6": true
  24806. });
  24807. }
  24808. // Any custom constraint to add?
  24809. if (callbacks.rtcConstraints && _typeof(callbacks.rtcConstraints) === 'object') {
  24810. Janus$1.debug("Adding custom PeerConnection constraints:", callbacks.rtcConstraints);
  24811. for (var i in callbacks.rtcConstraints) {
  24812. pc_constraints.optional.push(callbacks.rtcConstraints[i]);
  24813. }
  24814. }
  24815. if (Janus$1.webRTCAdapter.browserDetails.browser === "edge") {
  24816. // This is Edge, enable BUNDLE explicitly
  24817. pc_config.bundlePolicy = "max-bundle";
  24818. }
  24819. Janus$1.log("Creating PeerConnection");
  24820. Janus$1.debug(pc_constraints);
  24821. config.pc = new RTCPeerConnection(pc_config, pc_constraints);
  24822. Janus$1.debug(config.pc);
  24823. if (config.pc.getStats) {
  24824. // FIXME
  24825. config.volume = {};
  24826. config.bitrate.value = "0 kbits/sec";
  24827. }
  24828. Janus$1.log("Preparing local SDP and gathering candidates (trickle=" + config.trickle + ")");
  24829. config.pc.oniceconnectionstatechange = function (e) {
  24830. if (config.pc) pluginHandle.iceState(config.pc.iceConnectionState);
  24831. };
  24832. config.pc.onicecandidate = function (event) {
  24833. if (event.candidate == null || Janus$1.webRTCAdapter.browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {
  24834. Janus$1.log("End of candidates.");
  24835. config.iceDone = true;
  24836. if (config.trickle === true) {
  24837. // Notify end of candidates
  24838. sendTrickleCandidate(handleId, {
  24839. "completed": true
  24840. });
  24841. } else {
  24842. // No trickle, time to send the complete SDP (including all candidates)
  24843. sendSDP(handleId, callbacks);
  24844. }
  24845. } else {
  24846. // JSON.stringify doesn't work on some WebRTC objects anymore
  24847. // See https://code.google.com/p/chromium/issues/detail?id=467366
  24848. var candidate = {
  24849. "candidate": event.candidate.candidate,
  24850. "sdpMid": event.candidate.sdpMid,
  24851. "sdpMLineIndex": event.candidate.sdpMLineIndex
  24852. };
  24853. if (config.trickle === true) {
  24854. // Send candidate
  24855. sendTrickleCandidate(handleId, candidate);
  24856. }
  24857. }
  24858. };
  24859. config.pc.ontrack = function (event) {
  24860. Janus$1.log("Handling Remote Track");
  24861. Janus$1.debug(event);
  24862. if (!event.streams) return;
  24863. config.remoteStream = event.streams[0];
  24864. pluginHandle.onremotestream(config.remoteStream);
  24865. if (event.track.onended) return;
  24866. Janus$1.log("Adding onended callback to track:", event.track);
  24867. event.track.onended = function (ev) {
  24868. Janus$1.log("Remote track muted/removed:", ev);
  24869. if (config.remoteStream) {
  24870. config.remoteStream.removeTrack(ev.target);
  24871. pluginHandle.onremotestream(config.remoteStream);
  24872. }
  24873. };
  24874. event.track.onmute = event.track.onended;
  24875. event.track.onunmute = function (ev) {
  24876. Janus$1.log("Remote track flowing again:", ev);
  24877. try {
  24878. config.remoteStream.addTrack(ev.target);
  24879. pluginHandle.onremotestream(config.remoteStream);
  24880. } catch (e) {
  24881. Janus$1.error(e);
  24882. }
  24883. };
  24884. };
  24885. }
  24886. if (addTracks && stream !== null && stream !== undefined) {
  24887. Janus$1.log('Adding local stream');
  24888. var simulcast2 = callbacks.simulcast2 === true ? true : false;
  24889. stream.getTracks().forEach(function (track) {
  24890. Janus$1.log('Adding local track:', track);
  24891. if (!simulcast2) {
  24892. config.pc.addTrack(track, stream);
  24893. } else {
  24894. if (track.kind === "audio") {
  24895. config.pc.addTrack(track, stream);
  24896. } else {
  24897. Janus$1.log('Enabling rid-based simulcasting:', track);
  24898. var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
  24899. config.pc.addTransceiver(track, {
  24900. direction: "sendrecv",
  24901. streams: [stream],
  24902. sendEncodings: [{
  24903. rid: "h",
  24904. active: true,
  24905. maxBitrate: maxBitrates.high
  24906. }, {
  24907. rid: "m",
  24908. active: true,
  24909. maxBitrate: maxBitrates.medium,
  24910. scaleResolutionDownBy: 2
  24911. }, {
  24912. rid: "l",
  24913. active: true,
  24914. maxBitrate: maxBitrates.low,
  24915. scaleResolutionDownBy: 4
  24916. }]
  24917. });
  24918. }
  24919. }
  24920. });
  24921. }
  24922. // Any data channel to create?
  24923. if (isDataEnabled(media) && !config.dataChannel[Janus$1.dataChanDefaultLabel]) {
  24924. Janus$1.log("Creating data channel");
  24925. createDataChannel(handleId, Janus$1.dataChanDefaultLabel, false);
  24926. config.pc.ondatachannel = function (event) {
  24927. Janus$1.log("Data channel created by Janus:", event);
  24928. createDataChannel(handleId, event.channel.label, event.channel);
  24929. };
  24930. }
  24931. // If there's a new local stream, let's notify the application
  24932. if (config.myStream) pluginHandle.onlocalstream(config.myStream);
  24933. // Create offer/answer now
  24934. if (jsep === null || jsep === undefined) {
  24935. createOffer(handleId, media, callbacks);
  24936. } else {
  24937. config.pc.setRemoteDescription(jsep).then(function () {
  24938. Janus$1.log("Remote description accepted!");
  24939. config.remoteSdp = jsep.sdp;
  24940. // Any trickle candidate we cached?
  24941. if (config.candidates && config.candidates.length > 0) {
  24942. for (var i = 0; i < config.candidates.length; i++) {
  24943. var candidate = config.candidates[i];
  24944. Janus$1.debug("Adding remote candidate:", candidate);
  24945. if (!candidate || candidate.completed === true) {
  24946. // end-of-candidates
  24947. config.pc.addIceCandidate(Janus$1.endOfCandidates);
  24948. } else {
  24949. // New candidate
  24950. config.pc.addIceCandidate(candidate);
  24951. }
  24952. }
  24953. config.candidates = [];
  24954. }
  24955. // Create the answer now
  24956. createAnswer(handleId, media, callbacks);
  24957. }, callbacks.error);
  24958. }
  24959. }
  24960. function prepareWebrtc(handleId, offer, callbacks) {
  24961. callbacks = callbacks || {};
  24962. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  24963. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
  24964. var jsep = callbacks.jsep;
  24965. if (offer && jsep) {
  24966. Janus$1.error("Provided a JSEP to a createOffer");
  24967. callbacks.error("Provided a JSEP to a createOffer");
  24968. return;
  24969. } else if (!offer && (!jsep || !jsep.type || !jsep.sdp)) {
  24970. Janus$1.error("A valid JSEP is required for createAnswer");
  24971. callbacks.error("A valid JSEP is required for createAnswer");
  24972. return;
  24973. }
  24974. callbacks.media = callbacks.media || {
  24975. audio: true,
  24976. video: true
  24977. };
  24978. var media = callbacks.media;
  24979. var pluginHandle = pluginHandles[handleId];
  24980. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  24981. Janus$1.warn("Invalid handle");
  24982. callbacks.error("Invalid handle");
  24983. return;
  24984. }
  24985. var config = pluginHandle.webrtcStuff;
  24986. config.trickle = isTrickleEnabled(callbacks.trickle);
  24987. // Are we updating a session?
  24988. if (config.pc === undefined || config.pc === null) {
  24989. // Nope, new PeerConnection
  24990. media.update = false;
  24991. media.keepAudio = false;
  24992. media.keepVideo = false;
  24993. } else if (config.pc !== undefined && config.pc !== null) {
  24994. Janus$1.log("Updating existing media session");
  24995. media.update = true;
  24996. // Check if there's anything to add/remove/replace, or if we
  24997. // can go directly to preparing the new SDP offer or answer
  24998. if (callbacks.stream !== null && callbacks.stream !== undefined) {
  24999. // External stream: is this the same as the one we were using before?
  25000. if (callbacks.stream !== config.myStream) {
  25001. Janus$1.log("Renegotiation involves a new external stream");
  25002. }
  25003. } else {
  25004. // Check if there are changes on audio
  25005. if (media.addAudio) {
  25006. media.keepAudio = false;
  25007. media.replaceAudio = false;
  25008. media.removeAudio = false;
  25009. media.audioSend = true;
  25010. if (config.myStream && config.myStream.getAudioTracks() && config.myStream.getAudioTracks().length) {
  25011. Janus$1.error("Can't add audio stream, there already is one");
  25012. callbacks.error("Can't add audio stream, there already is one");
  25013. return;
  25014. }
  25015. } else if (media.removeAudio) {
  25016. media.keepAudio = false;
  25017. media.replaceAudio = false;
  25018. media.addAudio = false;
  25019. media.audioSend = false;
  25020. } else if (media.replaceAudio) {
  25021. media.keepAudio = false;
  25022. media.addAudio = false;
  25023. media.removeAudio = false;
  25024. media.audioSend = true;
  25025. }
  25026. if (config.myStream === null || config.myStream === undefined) {
  25027. // No media stream: if we were asked to replace, it's actually an "add"
  25028. if (media.replaceAudio) {
  25029. media.keepAudio = false;
  25030. media.replaceAudio = false;
  25031. media.addAudio = true;
  25032. media.audioSend = true;
  25033. }
  25034. if (isAudioSendEnabled(media)) {
  25035. media.keepAudio = false;
  25036. media.addAudio = true;
  25037. }
  25038. } else {
  25039. if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
  25040. // No audio track: if we were asked to replace, it's actually an "add"
  25041. if (media.replaceAudio) {
  25042. media.keepAudio = false;
  25043. media.replaceAudio = false;
  25044. media.addAudio = true;
  25045. media.audioSend = true;
  25046. }
  25047. if (isAudioSendEnabled(media)) {
  25048. media.keepVideo = false;
  25049. media.addAudio = true;
  25050. }
  25051. } else {
  25052. // We have an audio track: should we keep it as it is?
  25053. if (isAudioSendEnabled(media) && !media.removeAudio && !media.replaceAudio) {
  25054. media.keepAudio = true;
  25055. }
  25056. }
  25057. }
  25058. // Check if there are changes on video
  25059. if (media.addVideo) {
  25060. media.keepVideo = false;
  25061. media.replaceVideo = false;
  25062. media.removeVideo = false;
  25063. media.videoSend = true;
  25064. if (config.myStream && config.myStream.getVideoTracks() && config.myStream.getVideoTracks().length) {
  25065. Janus$1.error("Can't add video stream, there already is one");
  25066. callbacks.error("Can't add video stream, there already is one");
  25067. return;
  25068. }
  25069. } else if (media.removeVideo) {
  25070. media.keepVideo = false;
  25071. media.replaceVideo = false;
  25072. media.addVideo = false;
  25073. media.videoSend = false;
  25074. } else if (media.replaceVideo) {
  25075. media.keepVideo = false;
  25076. media.addVideo = false;
  25077. media.removeVideo = false;
  25078. media.videoSend = true;
  25079. }
  25080. if (config.myStream === null || config.myStream === undefined) {
  25081. // No media stream: if we were asked to replace, it's actually an "add"
  25082. if (media.replaceVideo) {
  25083. media.keepVideo = false;
  25084. media.replaceVideo = false;
  25085. media.addVideo = true;
  25086. media.videoSend = true;
  25087. }
  25088. if (isVideoSendEnabled(media)) {
  25089. media.keepVideo = false;
  25090. media.addVideo = true;
  25091. }
  25092. } else {
  25093. if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
  25094. // No video track: if we were asked to replace, it's actually an "add"
  25095. if (media.replaceVideo) {
  25096. media.keepVideo = false;
  25097. media.replaceVideo = false;
  25098. media.addVideo = true;
  25099. media.videoSend = true;
  25100. }
  25101. if (isVideoSendEnabled(media)) {
  25102. media.keepVideo = false;
  25103. media.addVideo = true;
  25104. }
  25105. } else {
  25106. // We have a video track: should we keep it as it is?
  25107. if (isVideoSendEnabled(media) && !media.removeVideo && !media.replaceVideo) {
  25108. media.keepVideo = true;
  25109. }
  25110. }
  25111. }
  25112. // Data channels can only be added
  25113. if (media.addData) media.data = true;
  25114. }
  25115. // If we're updating and keeping all tracks, let's skip the getUserMedia part
  25116. if (isAudioSendEnabled(media) && media.keepAudio && isVideoSendEnabled(media) && media.keepVideo) {
  25117. pluginHandle.consentDialog(false);
  25118. streamsDone(handleId, jsep, media, callbacks, config.myStream);
  25119. return;
  25120. }
  25121. }
  25122. // If we're updating, check if we need to remove/replace one of the tracks
  25123. if (media.update && !config.streamExternal) {
  25124. if (media.removeAudio || media.replaceAudio) {
  25125. if (config.myStream && config.myStream.getAudioTracks() && config.myStream.getAudioTracks().length) {
  25126. var s = config.myStream.getAudioTracks()[0];
  25127. Janus$1.log("Removing audio track:", s);
  25128. config.myStream.removeTrack(s);
  25129. try {
  25130. s.stop();
  25131. } catch (e) {}
  25132. }
  25133. if (config.pc.getSenders() && config.pc.getSenders().length) {
  25134. var ra = true;
  25135. if (media.replaceAudio && Janus$1.unifiedPlan) {
  25136. // We can use replaceTrack
  25137. ra = false;
  25138. }
  25139. if (ra) {
  25140. for (var index in config.pc.getSenders()) {
  25141. var s = config.pc.getSenders()[index];
  25142. if (s && s.track && s.track.kind === "audio") {
  25143. Janus$1.log("Removing audio sender:", s);
  25144. config.pc.removeTrack(s);
  25145. }
  25146. }
  25147. }
  25148. }
  25149. }
  25150. if (media.removeVideo || media.replaceVideo) {
  25151. if (config.myStream && config.myStream.getVideoTracks() && config.myStream.getVideoTracks().length) {
  25152. var s = config.myStream.getVideoTracks()[0];
  25153. Janus$1.log("Removing video track:", s);
  25154. config.myStream.removeTrack(s);
  25155. try {
  25156. s.stop();
  25157. } catch (e) {}
  25158. }
  25159. if (config.pc.getSenders() && config.pc.getSenders().length) {
  25160. var rv = true;
  25161. if (media.replaceVideo && Janus$1.unifiedPlan) {
  25162. // We can use replaceTrack
  25163. rv = false;
  25164. }
  25165. if (rv) {
  25166. for (var index in config.pc.getSenders()) {
  25167. var s = config.pc.getSenders()[index];
  25168. if (s && s.track && s.track.kind === "video") {
  25169. Janus$1.log("Removing video sender:", s);
  25170. config.pc.removeTrack(s);
  25171. }
  25172. }
  25173. }
  25174. }
  25175. }
  25176. }
  25177. // Was a MediaStream object passed, or do we need to take care of that?
  25178. if (callbacks.stream !== null && callbacks.stream !== undefined) {
  25179. var stream = callbacks.stream;
  25180. Janus$1.log("MediaStream provided by the application");
  25181. Janus$1.debug(stream);
  25182. // If this is an update, let's check if we need to release the previous stream
  25183. if (media.update) {
  25184. if (config.myStream && config.myStream !== callbacks.stream && !config.streamExternal) {
  25185. // We're replacing a stream we captured ourselves with an external one
  25186. try {
  25187. // Try a MediaStreamTrack.stop() for each track
  25188. var tracks = config.myStream.getTracks();
  25189. for (var i in tracks) {
  25190. var mst = tracks[i];
  25191. Janus$1.log(mst);
  25192. if (mst !== null && mst !== undefined) mst.stop();
  25193. }
  25194. } catch (e) {
  25195. // Do nothing if this fails
  25196. }
  25197. config.myStream = null;
  25198. }
  25199. }
  25200. // Skip the getUserMedia part
  25201. config.streamExternal = true;
  25202. pluginHandle.consentDialog(false);
  25203. streamsDone(handleId, jsep, media, callbacks, stream);
  25204. return;
  25205. }
  25206. if (isAudioSendEnabled(media) || isVideoSendEnabled(media)) {
  25207. if (!Janus$1.isGetUserMediaAvailable()) {
  25208. callbacks.error("getUserMedia not available");
  25209. return;
  25210. }
  25211. var constraints = {
  25212. mandatory: {},
  25213. optional: []
  25214. };
  25215. pluginHandle.consentDialog(true);
  25216. var audioSupport = isAudioSendEnabled(media);
  25217. if (audioSupport === true && media != undefined && media != null) {
  25218. if (_typeof(media.audio) === 'object') {
  25219. audioSupport = media.audio;
  25220. }
  25221. }
  25222. var videoSupport = isVideoSendEnabled(media);
  25223. if (videoSupport === true && media != undefined && media != null) {
  25224. var simulcast = callbacks.simulcast === true ? true : false;
  25225. var simulcast2 = callbacks.simulcast2 === true ? true : false;
  25226. if ((simulcast || simulcast2) && !jsep && (media.video === undefined || media.video === false)) media.video = "hires";
  25227. if (media.video && media.video != 'screen' && media.video != 'window') {
  25228. if (_typeof(media.video) === 'object') {
  25229. videoSupport = media.video;
  25230. } else {
  25231. var width = 0;
  25232. var height = 0;
  25233. if (media.video === 'lowres') {
  25234. // Small resolution, 4:3
  25235. height = 240;
  25236. width = 320;
  25237. } else if (media.video === 'lowres-16:9') {
  25238. // Small resolution, 16:9
  25239. height = 180;
  25240. width = 320;
  25241. } else if (media.video === 'hires' || media.video === 'hires-16:9' || media.video === 'hdres') {
  25242. // High(HD) resolution is only 16:9
  25243. height = 720;
  25244. width = 1280;
  25245. } else if (media.video === 'fhdres') {
  25246. // Full HD resolution is only 16:9
  25247. height = 1080;
  25248. width = 1920;
  25249. } else if (media.video === '4kres') {
  25250. // 4K resolution is only 16:9
  25251. height = 2160;
  25252. width = 3840;
  25253. } else if (media.video === 'stdres') {
  25254. // Normal resolution, 4:3
  25255. height = 480;
  25256. width = 640;
  25257. } else if (media.video === 'stdres-16:9') {
  25258. // Normal resolution, 16:9
  25259. height = 360;
  25260. width = 640;
  25261. } else {
  25262. Janus$1.log("Default video setting is stdres 4:3");
  25263. height = 480;
  25264. width = 640;
  25265. }
  25266. Janus$1.log("Adding media constraint:", media.video);
  25267. videoSupport = {
  25268. 'height': {
  25269. 'ideal': height
  25270. },
  25271. 'width': {
  25272. 'ideal': width
  25273. }
  25274. };
  25275. Janus$1.log("Adding video constraint:", videoSupport);
  25276. }
  25277. } else if (media.video === 'screen' || media.video === 'window') {
  25278. // We're going to try and use the extension for Chrome 34+, the old approach
  25279. // for older versions of Chrome, or the experimental support in Firefox 33+
  25280. var callbackUserMedia = function callbackUserMedia(error, stream) {
  25281. pluginHandle.consentDialog(false);
  25282. if (error) {
  25283. callbacks.error(error);
  25284. } else {
  25285. streamsDone(handleId, jsep, media, callbacks, stream);
  25286. }
  25287. };
  25288. var getScreenMedia = function getScreenMedia(constraints, gsmCallback, useAudio) {
  25289. Janus$1.log("Adding media constraint (screen capture)");
  25290. Janus$1.debug(constraints);
  25291. navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
  25292. if (useAudio) {
  25293. navigator.mediaDevices.getUserMedia({
  25294. audio: true,
  25295. video: false
  25296. }).then(function (audioStream) {
  25297. stream.addTrack(audioStream.getAudioTracks()[0]);
  25298. gsmCallback(null, stream);
  25299. });
  25300. } else {
  25301. gsmCallback(null, stream);
  25302. }
  25303. })["catch"](function (error) {
  25304. pluginHandle.consentDialog(false);
  25305. gsmCallback(error);
  25306. });
  25307. };
  25308. if (!media.screenshareFrameRate) {
  25309. media.screenshareFrameRate = 3;
  25310. }
  25311. if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
  25312. // The new experimental getDisplayMedia API is available, let's use that
  25313. // https://groups.google.com/forum/#!topic/discuss-webrtc/Uf0SrR4uxzk
  25314. // https://webrtchacks.com/chrome-screensharing-getdisplaymedia/
  25315. navigator.mediaDevices.getDisplayMedia({
  25316. video: true
  25317. }).then(function (stream) {
  25318. pluginHandle.consentDialog(false);
  25319. if (isAudioSendEnabled(media) && !media.keepAudio) {
  25320. navigator.mediaDevices.getUserMedia({
  25321. audio: true,
  25322. video: false
  25323. }).then(function (audioStream) {
  25324. stream.addTrack(audioStream.getAudioTracks()[0]);
  25325. streamsDone(handleId, jsep, media, callbacks, stream);
  25326. });
  25327. } else {
  25328. streamsDone(handleId, jsep, media, callbacks, stream);
  25329. }
  25330. }, function (error) {
  25331. pluginHandle.consentDialog(false);
  25332. callbacks.error(error);
  25333. });
  25334. return;
  25335. }
  25336. if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
  25337. var chromever = Janus$1.webRTCAdapter.browserDetails.version;
  25338. var maxver = 33;
  25339. if (window.navigator.userAgent.match('Linux')) maxver = 35; // "known" crash in chrome 34 and 35 on linux
  25340. if (chromever >= 26 && chromever <= maxver) {
  25341. // Chrome 26->33 requires some awkward chrome://flags manipulation
  25342. constraints = {
  25343. video: {
  25344. mandatory: {
  25345. googLeakyBucket: true,
  25346. maxWidth: window.screen.width,
  25347. maxHeight: window.screen.height,
  25348. minFrameRate: media.screenshareFrameRate,
  25349. maxFrameRate: media.screenshareFrameRate,
  25350. chromeMediaSource: 'screen'
  25351. }
  25352. },
  25353. audio: isAudioSendEnabled(media) && !media.keepAudio
  25354. };
  25355. getScreenMedia(constraints, callbackUserMedia);
  25356. } else {
  25357. // Chrome 34+ requires an extension
  25358. Janus$1.extension.getScreen(function (error, sourceId) {
  25359. if (error) {
  25360. pluginHandle.consentDialog(false);
  25361. return callbacks.error(error);
  25362. }
  25363. constraints = {
  25364. audio: false,
  25365. video: {
  25366. mandatory: {
  25367. chromeMediaSource: 'desktop',
  25368. maxWidth: window.screen.width,
  25369. maxHeight: window.screen.height,
  25370. minFrameRate: media.screenshareFrameRate,
  25371. maxFrameRate: media.screenshareFrameRate
  25372. },
  25373. optional: [{
  25374. googLeakyBucket: true
  25375. }, {
  25376. googTemporalLayeredScreencast: true
  25377. }]
  25378. }
  25379. };
  25380. constraints.video.mandatory.chromeMediaSourceId = sourceId;
  25381. getScreenMedia(constraints, callbackUserMedia, isAudioSendEnabled(media) && !media.keepAudio);
  25382. });
  25383. }
  25384. } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'firefox') {
  25385. if (Janus$1.webRTCAdapter.browserDetails.version >= 33) {
  25386. // Firefox 33+ has experimental support for screen sharing
  25387. constraints = {
  25388. video: {
  25389. mozMediaSource: media.video,
  25390. mediaSource: media.video
  25391. },
  25392. audio: isAudioSendEnabled(media) && !media.keepAudio
  25393. };
  25394. getScreenMedia(constraints, function (err, stream) {
  25395. callbackUserMedia(err, stream);
  25396. // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1045810
  25397. if (!err) {
  25398. var lastTime = stream.currentTime;
  25399. var polly = window.setInterval(function () {
  25400. if (!stream) window.clearInterval(polly);
  25401. if (stream.currentTime == lastTime) {
  25402. window.clearInterval(polly);
  25403. if (stream.onended) {
  25404. stream.onended();
  25405. }
  25406. }
  25407. lastTime = stream.currentTime;
  25408. }, 500);
  25409. }
  25410. });
  25411. } else {
  25412. var error = new Error('NavigatorUserMediaError');
  25413. error.name = 'Your version of Firefox does not support screen sharing, please install Firefox 33 (or more recent versions)';
  25414. pluginHandle.consentDialog(false);
  25415. callbacks.error(error);
  25416. return;
  25417. }
  25418. }
  25419. return;
  25420. }
  25421. }
  25422. // If we got here, we're not screensharing
  25423. if (media === null || media === undefined || media.video !== 'screen') {
  25424. // Check whether all media sources are actually available or not
  25425. navigator.mediaDevices.enumerateDevices().then(function (devices) {
  25426. var audioExist = devices.some(function (device) {
  25427. return device.kind === 'audioinput';
  25428. }),
  25429. videoExist = isScreenSendEnabled(media) || devices.some(function (device) {
  25430. return device.kind === 'videoinput';
  25431. });
  25432. // Check whether a missing device is really a problem
  25433. var audioSend = isAudioSendEnabled(media);
  25434. var videoSend = isVideoSendEnabled(media);
  25435. var needAudioDevice = isAudioSendRequired(media);
  25436. var needVideoDevice = isVideoSendRequired(media);
  25437. if (audioSend || videoSend || needAudioDevice || needVideoDevice) {
  25438. // We need to send either audio or video
  25439. var haveAudioDevice = audioSend ? audioExist : false;
  25440. var haveVideoDevice = videoSend ? videoExist : false;
  25441. if (!haveAudioDevice && !haveVideoDevice) {
  25442. // FIXME Should we really give up, or just assume recvonly for both?
  25443. pluginHandle.consentDialog(false);
  25444. callbacks.error('No capture device found');
  25445. return false;
  25446. } else if (!haveAudioDevice && needAudioDevice) {
  25447. pluginHandle.consentDialog(false);
  25448. callbacks.error('Audio capture is required, but no capture device found');
  25449. return false;
  25450. } else if (!haveVideoDevice && needVideoDevice) {
  25451. pluginHandle.consentDialog(false);
  25452. callbacks.error('Video capture is required, but no capture device found');
  25453. return false;
  25454. }
  25455. }
  25456. var gumConstraints = {
  25457. audio: audioExist && !media.keepAudio ? audioSupport : false,
  25458. video: videoExist && !media.keepVideo ? videoSupport : false
  25459. };
  25460. Janus$1.debug("getUserMedia constraints", gumConstraints);
  25461. if (!gumConstraints.audio && !gumConstraints.video) {
  25462. pluginHandle.consentDialog(false);
  25463. streamsDone(handleId, jsep, media, callbacks, stream);
  25464. } else {
  25465. navigator.mediaDevices.getUserMedia(gumConstraints).then(function (stream) {
  25466. pluginHandle.consentDialog(false);
  25467. streamsDone(handleId, jsep, media, callbacks, stream);
  25468. })["catch"](function (error) {
  25469. pluginHandle.consentDialog(false);
  25470. callbacks.error({
  25471. code: error.code,
  25472. name: error.name,
  25473. message: error.message
  25474. });
  25475. });
  25476. }
  25477. })["catch"](function (error) {
  25478. pluginHandle.consentDialog(false);
  25479. callbacks.error('enumerateDevices error', error);
  25480. });
  25481. }
  25482. } else {
  25483. // No need to do a getUserMedia, create offer/answer right away
  25484. streamsDone(handleId, jsep, media, callbacks);
  25485. }
  25486. }
  25487. function prepareWebrtcPeer(handleId, callbacks) {
  25488. callbacks = callbacks || {};
  25489. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  25490. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
  25491. var jsep = callbacks.jsep;
  25492. var pluginHandle = pluginHandles[handleId];
  25493. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  25494. Janus$1.warn("Invalid handle");
  25495. callbacks.error("Invalid handle");
  25496. return;
  25497. }
  25498. var config = pluginHandle.webrtcStuff;
  25499. if (jsep !== undefined && jsep !== null) {
  25500. if (config.pc === null) {
  25501. Janus$1.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep");
  25502. callbacks.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");
  25503. return;
  25504. }
  25505. config.pc.setRemoteDescription(jsep).then(function () {
  25506. Janus$1.log("Remote description accepted!");
  25507. config.remoteSdp = jsep.sdp;
  25508. // Any trickle candidate we cached?
  25509. if (config.candidates && config.candidates.length > 0) {
  25510. for (var i = 0; i < config.candidates.length; i++) {
  25511. var candidate = config.candidates[i];
  25512. Janus$1.debug("Adding remote candidate:", candidate);
  25513. if (!candidate || candidate.completed === true) {
  25514. // end-of-candidates
  25515. config.pc.addIceCandidate(Janus$1.endOfCandidates);
  25516. } else {
  25517. // New candidate
  25518. config.pc.addIceCandidate(candidate);
  25519. }
  25520. }
  25521. config.candidates = [];
  25522. }
  25523. // Done
  25524. callbacks.success();
  25525. }, callbacks.error);
  25526. } else {
  25527. callbacks.error("Invalid JSEP");
  25528. }
  25529. }
  25530. function createOffer(handleId, media, callbacks) {
  25531. callbacks = callbacks || {};
  25532. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  25533. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  25534. callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus$1.noop;
  25535. var pluginHandle = pluginHandles[handleId];
  25536. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  25537. Janus$1.warn("Invalid handle");
  25538. callbacks.error("Invalid handle");
  25539. return;
  25540. }
  25541. var config = pluginHandle.webrtcStuff;
  25542. var simulcast = callbacks.simulcast === true ? true : false;
  25543. if (!simulcast) {
  25544. Janus$1.log("Creating offer (iceDone=" + config.iceDone + ")");
  25545. } else {
  25546. Janus$1.log("Creating offer (iceDone=" + config.iceDone + ", simulcast=" + simulcast + ")");
  25547. }
  25548. // https://code.google.com/p/webrtc/issues/detail?id=3508
  25549. var mediaConstraints = {};
  25550. if (Janus$1.unifiedPlan) {
  25551. // We can use Transceivers
  25552. var audioTransceiver = null,
  25553. videoTransceiver = null;
  25554. var transceivers = config.pc.getTransceivers();
  25555. if (transceivers && transceivers.length > 0) {
  25556. for (var i in transceivers) {
  25557. var t = transceivers[i];
  25558. if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
  25559. if (!audioTransceiver) audioTransceiver = t;
  25560. continue;
  25561. }
  25562. if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
  25563. if (!videoTransceiver) videoTransceiver = t;
  25564. continue;
  25565. }
  25566. }
  25567. }
  25568. // Handle audio (and related changes, if any)
  25569. var audioSend = isAudioSendEnabled(media);
  25570. var audioRecv = isAudioRecvEnabled(media);
  25571. if (!audioSend && !audioRecv) {
  25572. // Audio disabled: have we removed it?
  25573. if (media.removeAudio && audioTransceiver) {
  25574. if (audioTransceiver.setDirection) {
  25575. audioTransceiver.setDirection("inactive");
  25576. } else {
  25577. audioTransceiver.direction = "inactive";
  25578. }
  25579. Janus$1.log("Setting audio transceiver to inactive:", audioTransceiver);
  25580. }
  25581. } else {
  25582. // Take care of audio m-line
  25583. if (audioSend && audioRecv) {
  25584. if (audioTransceiver) {
  25585. if (audioTransceiver.setDirection) {
  25586. audioTransceiver.setDirection("sendrecv");
  25587. } else {
  25588. audioTransceiver.direction = "sendrecv";
  25589. }
  25590. Janus$1.log("Setting audio transceiver to sendrecv:", audioTransceiver);
  25591. }
  25592. } else if (audioSend && !audioRecv) {
  25593. if (audioTransceiver) {
  25594. if (audioTransceiver.setDirection) {
  25595. audioTransceiver.setDirection("sendonly");
  25596. } else {
  25597. audioTransceiver.direction = "sendonly";
  25598. }
  25599. Janus$1.log("Setting audio transceiver to sendonly:", audioTransceiver);
  25600. }
  25601. } else if (!audioSend && audioRecv) {
  25602. if (audioTransceiver) {
  25603. if (audioTransceiver.setDirection) {
  25604. audioTransceiver.setDirection("recvonly");
  25605. } else {
  25606. audioTransceiver.direction = "recvonly";
  25607. }
  25608. Janus$1.log("Setting audio transceiver to recvonly:", audioTransceiver);
  25609. } else {
  25610. // In theory, this is the only case where we might not have a transceiver yet
  25611. audioTransceiver = config.pc.addTransceiver("audio", {
  25612. direction: "recvonly"
  25613. });
  25614. Janus$1.log("Adding recvonly audio transceiver:", audioTransceiver);
  25615. }
  25616. }
  25617. }
  25618. // Handle video (and related changes, if any)
  25619. var videoSend = isVideoSendEnabled(media);
  25620. var videoRecv = isVideoRecvEnabled(media);
  25621. if (!videoSend && !videoRecv) {
  25622. // Video disabled: have we removed it?
  25623. if (media.removeVideo && videoTransceiver) {
  25624. if (videoTransceiver.setDirection) {
  25625. videoTransceiver.setDirection("inactive");
  25626. } else {
  25627. videoTransceiver.direction = "inactive";
  25628. }
  25629. Janus$1.log("Setting video transceiver to inactive:", videoTransceiver);
  25630. }
  25631. } else {
  25632. // Take care of video m-line
  25633. if (videoSend && videoRecv) {
  25634. if (videoTransceiver) {
  25635. if (videoTransceiver.setDirection) {
  25636. videoTransceiver.setDirection("sendrecv");
  25637. } else {
  25638. videoTransceiver.direction = "sendrecv";
  25639. }
  25640. Janus$1.log("Setting video transceiver to sendrecv:", videoTransceiver);
  25641. }
  25642. } else if (videoSend && !videoRecv) {
  25643. if (videoTransceiver) {
  25644. if (videoTransceiver.setDirection) {
  25645. videoTransceiver.setDirection("sendonly");
  25646. } else {
  25647. videoTransceiver.direction = "sendonly";
  25648. }
  25649. Janus$1.log("Setting video transceiver to sendonly:", videoTransceiver);
  25650. }
  25651. } else if (!videoSend && videoRecv) {
  25652. if (videoTransceiver) {
  25653. if (videoTransceiver.setDirection) {
  25654. videoTransceiver.setDirection("recvonly");
  25655. } else {
  25656. videoTransceiver.direction = "recvonly";
  25657. }
  25658. Janus$1.log("Setting video transceiver to recvonly:", videoTransceiver);
  25659. } else {
  25660. // In theory, this is the only case where we might not have a transceiver yet
  25661. videoTransceiver = config.pc.addTransceiver("video", {
  25662. direction: "recvonly"
  25663. });
  25664. Janus$1.log("Adding recvonly video transceiver:", videoTransceiver);
  25665. }
  25666. }
  25667. }
  25668. } else {
  25669. mediaConstraints["offerToReceiveAudio"] = isAudioRecvEnabled(media);
  25670. mediaConstraints["offerToReceiveVideo"] = isVideoRecvEnabled(media);
  25671. }
  25672. var iceRestart = callbacks.iceRestart === true ? true : false;
  25673. if (iceRestart) {
  25674. mediaConstraints["iceRestart"] = true;
  25675. }
  25676. Janus$1.debug(mediaConstraints);
  25677. // Check if this is Firefox and we've been asked to do simulcasting
  25678. var sendVideo = isVideoSendEnabled(media);
  25679. if (sendVideo && simulcast && Janus$1.webRTCAdapter.browserDetails.browser === "firefox") {
  25680. // FIXME Based on https://gist.github.com/voluntas/088bc3cc62094730647b
  25681. Janus$1.log("Enabling Simulcasting for Firefox (RID)");
  25682. var sender = config.pc.getSenders().find(function (s) {
  25683. return s.track.kind == "video";
  25684. });
  25685. if (sender) {
  25686. var parameters = sender.getParameters();
  25687. if (!parameters) parameters = {};
  25688. var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
  25689. parameters.encodings = [{
  25690. rid: "h",
  25691. active: true,
  25692. maxBitrate: maxBitrates.high
  25693. }, {
  25694. rid: "m",
  25695. active: true,
  25696. maxBitrate: maxBitrates.medium,
  25697. scaleResolutionDownBy: 2
  25698. }, {
  25699. rid: "l",
  25700. active: true,
  25701. maxBitrate: maxBitrates.low,
  25702. scaleResolutionDownBy: 4
  25703. }];
  25704. sender.setParameters(parameters);
  25705. }
  25706. }
  25707. config.pc.createOffer(mediaConstraints).then(function (offer) {
  25708. Janus$1.debug(offer);
  25709. // JSON.stringify doesn't work on some WebRTC objects anymore
  25710. // See https://code.google.com/p/chromium/issues/detail?id=467366
  25711. var jsep = {
  25712. "type": offer.type,
  25713. "sdp": offer.sdp
  25714. };
  25715. callbacks.customizeSdp(jsep);
  25716. offer.sdp = jsep.sdp;
  25717. Janus$1.log("Setting local description");
  25718. if (sendVideo && simulcast) {
  25719. // This SDP munging only works with Chrome (Safari STP may support it too)
  25720. if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome" || Janus$1.webRTCAdapter.browserDetails.browser === "safari") {
  25721. Janus$1.log("Enabling Simulcasting for Chrome (SDP munging)");
  25722. offer.sdp = mungeSdpForSimulcasting(offer.sdp);
  25723. } else if (Janus$1.webRTCAdapter.browserDetails.browser !== "firefox") {
  25724. Janus$1.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
  25725. }
  25726. }
  25727. config.mySdp = offer.sdp;
  25728. config.pc.setLocalDescription(offer)["catch"](callbacks.error);
  25729. config.mediaConstraints = mediaConstraints;
  25730. if (!config.iceDone && !config.trickle) {
  25731. // Don't do anything until we have all candidates
  25732. Janus$1.log("Waiting for all candidates...");
  25733. return;
  25734. }
  25735. Janus$1.log("Offer ready");
  25736. Janus$1.debug(callbacks);
  25737. callbacks.success(offer);
  25738. }, callbacks.error);
  25739. }
  25740. function createAnswer(handleId, media, callbacks) {
  25741. callbacks = callbacks || {};
  25742. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  25743. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  25744. callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus$1.noop;
  25745. var pluginHandle = pluginHandles[handleId];
  25746. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  25747. Janus$1.warn("Invalid handle");
  25748. callbacks.error("Invalid handle");
  25749. return;
  25750. }
  25751. var config = pluginHandle.webrtcStuff;
  25752. var simulcast = callbacks.simulcast === true ? true : false;
  25753. if (!simulcast) {
  25754. Janus$1.log("Creating answer (iceDone=" + config.iceDone + ")");
  25755. } else {
  25756. Janus$1.log("Creating answer (iceDone=" + config.iceDone + ", simulcast=" + simulcast + ")");
  25757. }
  25758. var mediaConstraints = null;
  25759. if (Janus$1.unifiedPlan) {
  25760. // We can use Transceivers
  25761. mediaConstraints = {};
  25762. var audioTransceiver = null,
  25763. videoTransceiver = null;
  25764. var transceivers = config.pc.getTransceivers();
  25765. if (transceivers && transceivers.length > 0) {
  25766. for (var i in transceivers) {
  25767. var t = transceivers[i];
  25768. if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
  25769. if (!audioTransceiver) audioTransceiver = t;
  25770. continue;
  25771. }
  25772. if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
  25773. if (!videoTransceiver) videoTransceiver = t;
  25774. continue;
  25775. }
  25776. }
  25777. }
  25778. // Handle audio (and related changes, if any)
  25779. var audioSend = isAudioSendEnabled(media);
  25780. var audioRecv = isAudioRecvEnabled(media);
  25781. if (!audioSend && !audioRecv) {
  25782. // Audio disabled: have we removed it?
  25783. if (media.removeAudio && audioTransceiver) {
  25784. try {
  25785. if (audioTransceiver.setDirection) {
  25786. audioTransceiver.setDirection("inactive");
  25787. } else {
  25788. audioTransceiver.direction = "inactive";
  25789. }
  25790. Janus$1.log("Setting audio transceiver to inactive:", audioTransceiver);
  25791. } catch (e) {
  25792. Janus$1.error(e);
  25793. }
  25794. }
  25795. } else {
  25796. // Take care of audio m-line
  25797. if (audioSend && audioRecv) {
  25798. if (audioTransceiver) {
  25799. try {
  25800. if (audioTransceiver.setDirection) {
  25801. audioTransceiver.setDirection("sendrecv");
  25802. } else {
  25803. audioTransceiver.direction = "sendrecv";
  25804. }
  25805. Janus$1.log("Setting audio transceiver to sendrecv:", audioTransceiver);
  25806. } catch (e) {
  25807. Janus$1.error(e);
  25808. }
  25809. }
  25810. } else if (audioSend && !audioRecv) {
  25811. try {
  25812. if (audioTransceiver) {
  25813. if (audioTransceiver.setDirection) {
  25814. audioTransceiver.setDirection("sendonly");
  25815. } else {
  25816. audioTransceiver.direction = "sendonly";
  25817. }
  25818. Janus$1.log("Setting audio transceiver to sendonly:", audioTransceiver);
  25819. }
  25820. } catch (e) {
  25821. Janus$1.error(e);
  25822. }
  25823. } else if (!audioSend && audioRecv) {
  25824. if (audioTransceiver) {
  25825. try {
  25826. if (audioTransceiver.setDirection) {
  25827. audioTransceiver.setDirection("recvonly");
  25828. } else {
  25829. audioTransceiver.direction = "recvonly";
  25830. }
  25831. Janus$1.log("Setting audio transceiver to recvonly:", audioTransceiver);
  25832. } catch (e) {
  25833. Janus$1.error(e);
  25834. }
  25835. } else {
  25836. // In theory, this is the only case where we might not have a transceiver yet
  25837. audioTransceiver = config.pc.addTransceiver("audio", {
  25838. direction: "recvonly"
  25839. });
  25840. Janus$1.log("Adding recvonly audio transceiver:", audioTransceiver);
  25841. }
  25842. }
  25843. }
  25844. // Handle video (and related changes, if any)
  25845. var videoSend = isVideoSendEnabled(media);
  25846. var videoRecv = isVideoRecvEnabled(media);
  25847. if (!videoSend && !videoRecv) {
  25848. // Video disabled: have we removed it?
  25849. if (media.removeVideo && videoTransceiver) {
  25850. try {
  25851. if (videoTransceiver.setDirection) {
  25852. videoTransceiver.setDirection("inactive");
  25853. } else {
  25854. videoTransceiver.direction = "inactive";
  25855. }
  25856. Janus$1.log("Setting video transceiver to inactive:", videoTransceiver);
  25857. } catch (e) {
  25858. Janus$1.error(e);
  25859. }
  25860. }
  25861. } else {
  25862. // Take care of video m-line
  25863. if (videoSend && videoRecv) {
  25864. if (videoTransceiver) {
  25865. try {
  25866. if (videoTransceiver.setDirection) {
  25867. videoTransceiver.setDirection("sendrecv");
  25868. } else {
  25869. videoTransceiver.direction = "sendrecv";
  25870. }
  25871. Janus$1.log("Setting video transceiver to sendrecv:", videoTransceiver);
  25872. } catch (e) {
  25873. Janus$1.error(e);
  25874. }
  25875. }
  25876. } else if (videoSend && !videoRecv) {
  25877. if (videoTransceiver) {
  25878. try {
  25879. if (videoTransceiver.setDirection) {
  25880. videoTransceiver.setDirection("sendonly");
  25881. } else {
  25882. videoTransceiver.direction = "sendonly";
  25883. }
  25884. Janus$1.log("Setting video transceiver to sendonly:", videoTransceiver);
  25885. } catch (e) {
  25886. Janus$1.error(e);
  25887. }
  25888. }
  25889. } else if (!videoSend && videoRecv) {
  25890. if (videoTransceiver) {
  25891. try {
  25892. if (videoTransceiver.setDirection) {
  25893. videoTransceiver.setDirection("recvonly");
  25894. } else {
  25895. videoTransceiver.direction = "recvonly";
  25896. }
  25897. Janus$1.log("Setting video transceiver to recvonly:", videoTransceiver);
  25898. } catch (e) {
  25899. Janus$1.error(e);
  25900. }
  25901. } else {
  25902. // In theory, this is the only case where we might not have a transceiver yet
  25903. videoTransceiver = config.pc.addTransceiver("video", {
  25904. direction: "recvonly"
  25905. });
  25906. Janus$1.log("Adding recvonly video transceiver:", videoTransceiver);
  25907. }
  25908. }
  25909. }
  25910. } else {
  25911. if (Janus$1.webRTCAdapter.browserDetails.browser == "firefox" || Janus$1.webRTCAdapter.browserDetails.browser == "edge") {
  25912. mediaConstraints = {
  25913. offerToReceiveAudio: isAudioRecvEnabled(media),
  25914. offerToReceiveVideo: isVideoRecvEnabled(media)
  25915. };
  25916. } else {
  25917. mediaConstraints = {
  25918. mandatory: {
  25919. OfferToReceiveAudio: isAudioRecvEnabled(media),
  25920. OfferToReceiveVideo: isVideoRecvEnabled(media)
  25921. }
  25922. };
  25923. }
  25924. }
  25925. Janus$1.debug(mediaConstraints);
  25926. // Check if this is Firefox and we've been asked to do simulcasting
  25927. var sendVideo = isVideoSendEnabled(media);
  25928. if (sendVideo && simulcast && Janus$1.webRTCAdapter.browserDetails.browser === "firefox") {
  25929. // FIXME Based on https://gist.github.com/voluntas/088bc3cc62094730647b
  25930. Janus$1.log("Enabling Simulcasting for Firefox (RID)");
  25931. var sender = config.pc.getSenders()[1];
  25932. Janus$1.log(sender);
  25933. var parameters = sender.getParameters();
  25934. Janus$1.log(parameters);
  25935. var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
  25936. sender.setParameters({
  25937. encodings: [{
  25938. rid: "high",
  25939. active: true,
  25940. priority: "high",
  25941. maxBitrate: maxBitrates.high
  25942. }, {
  25943. rid: "medium",
  25944. active: true,
  25945. priority: "medium",
  25946. maxBitrate: maxBitrates.medium
  25947. }, {
  25948. rid: "low",
  25949. active: true,
  25950. priority: "low",
  25951. maxBitrate: maxBitrates.low
  25952. }]
  25953. });
  25954. }
  25955. config.pc.createAnswer(mediaConstraints).then(function (answer) {
  25956. Janus$1.debug(answer);
  25957. // JSON.stringify doesn't work on some WebRTC objects anymore
  25958. // See https://code.google.com/p/chromium/issues/detail?id=467366
  25959. var jsep = {
  25960. "type": answer.type,
  25961. "sdp": answer.sdp
  25962. };
  25963. callbacks.customizeSdp(jsep);
  25964. answer.sdp = jsep.sdp;
  25965. Janus$1.log("Setting local description");
  25966. if (sendVideo && simulcast) {
  25967. // This SDP munging only works with Chrome
  25968. if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
  25969. // FIXME Apparently trying to simulcast when answering breaks video in Chrome...
  25970. //~ Janus.log("Enabling Simulcasting for Chrome (SDP munging)");
  25971. //~ answer.sdp = mungeSdpForSimulcasting(answer.sdp);
  25972. Janus$1.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it");
  25973. } else if (Janus$1.webRTCAdapter.browserDetails.browser !== "firefox") {
  25974. Janus$1.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
  25975. }
  25976. }
  25977. config.mySdp = answer.sdp;
  25978. config.pc.setLocalDescription(answer)["catch"](callbacks.error);
  25979. config.mediaConstraints = mediaConstraints;
  25980. if (!config.iceDone && !config.trickle) {
  25981. // Don't do anything until we have all candidates
  25982. Janus$1.log("Waiting for all candidates...");
  25983. return;
  25984. }
  25985. callbacks.success(answer);
  25986. }, callbacks.error);
  25987. }
  25988. function sendSDP(handleId, callbacks) {
  25989. callbacks = callbacks || {};
  25990. callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
  25991. callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
  25992. var pluginHandle = pluginHandles[handleId];
  25993. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  25994. Janus$1.warn("Invalid handle, not sending anything");
  25995. return;
  25996. }
  25997. var config = pluginHandle.webrtcStuff;
  25998. Janus$1.log("Sending offer/answer SDP...");
  25999. if (config.mySdp === null || config.mySdp === undefined) {
  26000. Janus$1.warn("Local SDP instance is invalid, not sending anything...");
  26001. return;
  26002. }
  26003. config.mySdp = {
  26004. "type": config.pc.localDescription.type,
  26005. "sdp": config.pc.localDescription.sdp
  26006. };
  26007. if (config.trickle === false) config.mySdp["trickle"] = false;
  26008. Janus$1.debug(callbacks);
  26009. config.sdpSent = true;
  26010. callbacks.success(config.mySdp);
  26011. }
  26012. function _getVolume(handleId, remote) {
  26013. var pluginHandle = pluginHandles[handleId];
  26014. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  26015. Janus$1.warn("Invalid handle");
  26016. return 0;
  26017. }
  26018. var stream = remote ? "remote" : "local";
  26019. var config = pluginHandle.webrtcStuff;
  26020. if (!config.volume[stream]) config.volume[stream] = {
  26021. value: 0
  26022. };
  26023. // Start getting the volume, if getStats is supported
  26024. if (config.pc.getStats && Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
  26025. if (remote && (config.remoteStream === null || config.remoteStream === undefined)) {
  26026. Janus$1.warn("Remote stream unavailable");
  26027. return 0;
  26028. } else if (!remote && (config.myStream === null || config.myStream === undefined)) {
  26029. Janus$1.warn("Local stream unavailable");
  26030. return 0;
  26031. }
  26032. if (config.volume[stream].timer === null || config.volume[stream].timer === undefined) {
  26033. Janus$1.log("Starting " + stream + " volume monitor");
  26034. config.volume[stream].timer = setInterval(function () {
  26035. config.pc.getStats(function (stats) {
  26036. var results = stats.result();
  26037. for (var i = 0; i < results.length; i++) {
  26038. var res = results[i];
  26039. if (res.type == 'ssrc') {
  26040. if (remote && res.stat('audioOutputLevel')) config.volume[stream].value = parseInt(res.stat('audioOutputLevel'));else if (!remote && res.stat('audioInputLevel')) config.volume[stream].value = parseInt(res.stat('audioInputLevel'));
  26041. }
  26042. }
  26043. });
  26044. }, 200);
  26045. return 0; // We don't have a volume to return yet
  26046. }
  26047. return config.volume[stream].value;
  26048. } else {
  26049. // audioInputLevel and audioOutputLevel seem only available in Chrome? audioLevel
  26050. // seems to be available on Chrome and Firefox, but they don't seem to work
  26051. Janus$1.warn("Getting the " + stream + " volume unsupported by browser");
  26052. return 0;
  26053. }
  26054. }
  26055. function isMuted(handleId, video) {
  26056. var pluginHandle = pluginHandles[handleId];
  26057. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  26058. Janus$1.warn("Invalid handle");
  26059. return true;
  26060. }
  26061. var config = pluginHandle.webrtcStuff;
  26062. if (config.pc === null || config.pc === undefined) {
  26063. Janus$1.warn("Invalid PeerConnection");
  26064. return true;
  26065. }
  26066. if (config.myStream === undefined || config.myStream === null) {
  26067. Janus$1.warn("Invalid local MediaStream");
  26068. return true;
  26069. }
  26070. if (video) {
  26071. // Check video track
  26072. if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
  26073. Janus$1.warn("No video track");
  26074. return true;
  26075. }
  26076. return !config.myStream.getVideoTracks()[0].enabled;
  26077. } else {
  26078. // Check audio track
  26079. if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
  26080. Janus$1.warn("No audio track");
  26081. return true;
  26082. }
  26083. return !config.myStream.getAudioTracks()[0].enabled;
  26084. }
  26085. }
  26086. function mute(handleId, video, mute) {
  26087. var pluginHandle = pluginHandles[handleId];
  26088. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  26089. Janus$1.warn("Invalid handle");
  26090. return false;
  26091. }
  26092. var config = pluginHandle.webrtcStuff;
  26093. if (config.pc === null || config.pc === undefined) {
  26094. Janus$1.warn("Invalid PeerConnection");
  26095. return false;
  26096. }
  26097. if (config.myStream === undefined || config.myStream === null) {
  26098. Janus$1.warn("Invalid local MediaStream");
  26099. return false;
  26100. }
  26101. if (video) {
  26102. // Mute/unmute video track
  26103. if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
  26104. Janus$1.warn("No video track");
  26105. return false;
  26106. }
  26107. config.myStream.getVideoTracks()[0].enabled = mute ? false : true;
  26108. return true;
  26109. } else {
  26110. // Mute/unmute audio track
  26111. if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
  26112. Janus$1.warn("No audio track");
  26113. return false;
  26114. }
  26115. config.myStream.getAudioTracks()[0].enabled = mute ? false : true;
  26116. return true;
  26117. }
  26118. }
  26119. function _getBitrate(handleId) {
  26120. var pluginHandle = pluginHandles[handleId];
  26121. if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
  26122. Janus$1.warn("Invalid handle");
  26123. return "Invalid handle";
  26124. }
  26125. var config = pluginHandle.webrtcStuff;
  26126. if (config.pc === null || config.pc === undefined) return "Invalid PeerConnection";
  26127. // Start getting the bitrate, if getStats is supported
  26128. if (config.pc.getStats) {
  26129. if (config.bitrate.timer === null || config.bitrate.timer === undefined) {
  26130. Janus$1.log("Starting bitrate timer (via getStats)");
  26131. config.bitrate.timer = setInterval(function () {
  26132. config.pc.getStats().then(function (stats) {
  26133. stats.forEach(function (res) {
  26134. if (!res) return;
  26135. var inStats = false;
  26136. // Check if these are statistics on incoming media
  26137. if ((res.mediaType === "video" || res.id.toLowerCase().indexOf("video") > -1) && res.type === "inbound-rtp" && res.id.indexOf("rtcp") < 0) {
  26138. // New stats
  26139. inStats = true;
  26140. } else if (res.type == 'ssrc' && res.bytesReceived && (res.googCodecName === "VP8" || res.googCodecName === "")) {
  26141. // Older Chromer versions
  26142. inStats = true;
  26143. }
  26144. // Parse stats now
  26145. if (inStats) {
  26146. config.bitrate.bsnow = res.bytesReceived;
  26147. config.bitrate.tsnow = res.timestamp;
  26148. if (config.bitrate.bsbefore === null || config.bitrate.tsbefore === null) {
  26149. // Skip this round
  26150. config.bitrate.bsbefore = config.bitrate.bsnow;
  26151. config.bitrate.tsbefore = config.bitrate.tsnow;
  26152. } else {
  26153. // Calculate bitrate
  26154. var timePassed = config.bitrate.tsnow - config.bitrate.tsbefore;
  26155. if (Janus$1.webRTCAdapter.browserDetails.browser == "safari") timePassed = timePassed / 1000; // Apparently the timestamp is in microseconds, in Safari
  26156. var bitRate = Math.round((config.bitrate.bsnow - config.bitrate.bsbefore) * 8 / timePassed);
  26157. if (Janus$1.webRTCAdapter.browserDetails.browser === 'safari') bitRate = parseInt(bitRate / 1000);
  26158. config.bitrate.value = bitRate + ' kbits/sec';
  26159. //~ Janus.log("Estimated bitrate is " + config.bitrate.value);
  26160. config.bitrate.bsbefore = config.bitrate.bsnow;
  26161. config.bitrate.tsbefore = config.bitrate.tsnow;
  26162. }
  26163. }
  26164. });
  26165. });
  26166. }, 1000);
  26167. return "0 kbits/sec"; // We don't have a bitrate value yet
  26168. }
  26169. return config.bitrate.value;
  26170. } else {
  26171. Janus$1.warn("Getting the video bitrate unsupported by browser");
  26172. return "Feature unsupported by browser";
  26173. }
  26174. }
  26175. function webrtcError(error) {
  26176. Janus$1.error("WebRTC error:", error);
  26177. }
  26178. function cleanupWebrtc(handleId, hangupRequest) {
  26179. Janus$1.log("Cleaning WebRTC stuff");
  26180. var pluginHandle = pluginHandles[handleId];
  26181. if (pluginHandle === null || pluginHandle === undefined) {
  26182. // Nothing to clean
  26183. return;
  26184. }
  26185. var config = pluginHandle.webrtcStuff;
  26186. if (config !== null && config !== undefined) {
  26187. if (hangupRequest === true) {
  26188. // Send a hangup request (we don't really care about the response)
  26189. var request = {
  26190. "rtcgw": "hangup",
  26191. "transaction": Janus$1.randomString(12)
  26192. };
  26193. if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
  26194. if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
  26195. Janus$1.debug("Sending hangup request (handle=" + handleId + "):");
  26196. Janus$1.debug(request);
  26197. if (websockets) {
  26198. request["session_id"] = sessionId;
  26199. request["handle_id"] = handleId;
  26200. ws.send(JSON.stringify(request));
  26201. } else {
  26202. Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
  26203. verb: 'POST',
  26204. withCredentials: withCredentials,
  26205. body: request
  26206. });
  26207. }
  26208. }
  26209. // Cleanup stack
  26210. config.remoteStream = null;
  26211. if (config.volume) {
  26212. if (config.volume["local"] && config.volume["local"].timer) clearInterval(config.volume["local"].timer);
  26213. if (config.volume["remote"] && config.volume["remote"].timer) clearInterval(config.volume["remote"].timer);
  26214. }
  26215. config.volume = {};
  26216. if (config.bitrate.timer) clearInterval(config.bitrate.timer);
  26217. config.bitrate.timer = null;
  26218. config.bitrate.bsnow = null;
  26219. config.bitrate.bsbefore = null;
  26220. config.bitrate.tsnow = null;
  26221. config.bitrate.tsbefore = null;
  26222. config.bitrate.value = null;
  26223. try {
  26224. // Try a MediaStreamTrack.stop() for each track
  26225. if (!config.streamExternal && config.myStream !== null && config.myStream !== undefined) {
  26226. Janus$1.log("Stopping local stream tracks");
  26227. var tracks = config.myStream.getTracks();
  26228. for (var i in tracks) {
  26229. var mst = tracks[i];
  26230. Janus$1.log(mst);
  26231. if (mst !== null && mst !== undefined) mst.stop();
  26232. }
  26233. }
  26234. } catch (e) {
  26235. // Do nothing if this fails
  26236. }
  26237. config.streamExternal = false;
  26238. config.myStream = null;
  26239. // Close PeerConnection
  26240. try {
  26241. config.pc.close();
  26242. } catch (e) {
  26243. // Do nothing
  26244. }
  26245. config.pc = null;
  26246. config.candidates = null;
  26247. config.mySdp = null;
  26248. config.remoteSdp = null;
  26249. config.iceDone = false;
  26250. config.dataChannel = {};
  26251. config.dtmfSender = null;
  26252. }
  26253. pluginHandle.oncleanup();
  26254. }
  26255. // Helper method to munge an SDP to enable simulcasting (Chrome only)
  26256. function mungeSdpForSimulcasting(sdp) {
  26257. // Let's munge the SDP to add the attributes for enabling simulcasting
  26258. // (based on https://gist.github.com/ggarber/a19b4c33510028b9c657)
  26259. var lines = sdp.split("\r\n");
  26260. var video = false;
  26261. var ssrc = [-1],
  26262. ssrc_fid = [-1];
  26263. var cname = null,
  26264. msid = null,
  26265. mslabel = null,
  26266. label = null;
  26267. var insertAt = -1;
  26268. for (var i = 0; i < lines.length; i++) {
  26269. var mline = lines[i].match(/m=(\w+) */);
  26270. if (mline) {
  26271. var medium = mline[1];
  26272. if (medium === "video") {
  26273. // New video m-line: make sure it's the first one
  26274. if (ssrc[0] < 0) {
  26275. video = true;
  26276. } else {
  26277. // We're done, let's add the new attributes here
  26278. insertAt = i;
  26279. break;
  26280. }
  26281. } else {
  26282. // New non-video m-line: do we have what we were looking for?
  26283. if (ssrc[0] > -1) {
  26284. // We're done, let's add the new attributes here
  26285. insertAt = i;
  26286. break;
  26287. }
  26288. }
  26289. continue;
  26290. }
  26291. if (!video) continue;
  26292. var fid = lines[i].match(/a=ssrc-group:FID (\d+) (\d+)/);
  26293. if (fid) {
  26294. ssrc[0] = fid[1];
  26295. ssrc_fid[0] = fid[2];
  26296. lines.splice(i, 1);
  26297. i--;
  26298. continue;
  26299. }
  26300. if (ssrc[0]) {
  26301. var match = lines[i].match('a=ssrc:' + ssrc[0] + ' cname:(.+)');
  26302. if (match) {
  26303. cname = match[1];
  26304. }
  26305. match = lines[i].match('a=ssrc:' + ssrc[0] + ' msid:(.+)');
  26306. if (match) {
  26307. msid = match[1];
  26308. }
  26309. match = lines[i].match('a=ssrc:' + ssrc[0] + ' mslabel:(.+)');
  26310. if (match) {
  26311. mslabel = match[1];
  26312. }
  26313. match = lines[i].match('a=ssrc:' + ssrc[0] + ' label:(.+)');
  26314. if (match) {
  26315. label = match[1];
  26316. }
  26317. if (lines[i].indexOf('a=ssrc:' + ssrc_fid[0]) === 0) {
  26318. lines.splice(i, 1);
  26319. i--;
  26320. continue;
  26321. }
  26322. if (lines[i].indexOf('a=ssrc:' + ssrc[0]) === 0) {
  26323. lines.splice(i, 1);
  26324. i--;
  26325. continue;
  26326. }
  26327. }
  26328. if (lines[i].length == 0) {
  26329. lines.splice(i, 1);
  26330. i--;
  26331. continue;
  26332. }
  26333. }
  26334. if (ssrc[0] < 0) {
  26335. // Couldn't find a FID attribute, let's just take the first video SSRC we find
  26336. insertAt = -1;
  26337. video = false;
  26338. for (var i = 0; i < lines.length; i++) {
  26339. var mline = lines[i].match(/m=(\w+) */);
  26340. if (mline) {
  26341. var medium = mline[1];
  26342. if (medium === "video") {
  26343. // New video m-line: make sure it's the first one
  26344. if (ssrc[0] < 0) {
  26345. video = true;
  26346. } else {
  26347. // We're done, let's add the new attributes here
  26348. insertAt = i;
  26349. break;
  26350. }
  26351. } else {
  26352. // New non-video m-line: do we have what we were looking for?
  26353. if (ssrc[0] > -1) {
  26354. // We're done, let's add the new attributes here
  26355. insertAt = i;
  26356. break;
  26357. }
  26358. }
  26359. continue;
  26360. }
  26361. if (!video) continue;
  26362. if (ssrc[0] < 0) {
  26363. var value = lines[i].match(/a=ssrc:(\d+)/);
  26364. if (value) {
  26365. ssrc[0] = value[1];
  26366. lines.splice(i, 1);
  26367. i--;
  26368. continue;
  26369. }
  26370. } else {
  26371. var match = lines[i].match('a=ssrc:' + ssrc[0] + ' cname:(.+)');
  26372. if (match) {
  26373. cname = match[1];
  26374. }
  26375. match = lines[i].match('a=ssrc:' + ssrc[0] + ' msid:(.+)');
  26376. if (match) {
  26377. msid = match[1];
  26378. }
  26379. match = lines[i].match('a=ssrc:' + ssrc[0] + ' mslabel:(.+)');
  26380. if (match) {
  26381. mslabel = match[1];
  26382. }
  26383. match = lines[i].match('a=ssrc:' + ssrc[0] + ' label:(.+)');
  26384. if (match) {
  26385. label = match[1];
  26386. }
  26387. if (lines[i].indexOf('a=ssrc:' + ssrc_fid[0]) === 0) {
  26388. lines.splice(i, 1);
  26389. i--;
  26390. continue;
  26391. }
  26392. if (lines[i].indexOf('a=ssrc:' + ssrc[0]) === 0) {
  26393. lines.splice(i, 1);
  26394. i--;
  26395. continue;
  26396. }
  26397. }
  26398. if (lines[i].length == 0) {
  26399. lines.splice(i, 1);
  26400. i--;
  26401. continue;
  26402. }
  26403. }
  26404. }
  26405. if (ssrc[0] < 0) {
  26406. // Still nothing, let's just return the SDP we were asked to munge
  26407. Janus$1.warn("Couldn't find the video SSRC, simulcasting NOT enabled");
  26408. return sdp;
  26409. }
  26410. if (insertAt < 0) {
  26411. // Append at the end
  26412. insertAt = lines.length;
  26413. }
  26414. // Generate a couple of SSRCs (for retransmissions too)
  26415. // Note: should we check if there are conflicts, here?
  26416. ssrc[1] = Math.floor(Math.random() * 0xFFFFFFFF);
  26417. ssrc[2] = Math.floor(Math.random() * 0xFFFFFFFF);
  26418. ssrc_fid[1] = Math.floor(Math.random() * 0xFFFFFFFF);
  26419. ssrc_fid[2] = Math.floor(Math.random() * 0xFFFFFFFF);
  26420. // Add attributes to the SDP
  26421. for (var i = 0; i < ssrc.length; i++) {
  26422. if (cname) {
  26423. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' cname:' + cname);
  26424. insertAt++;
  26425. }
  26426. if (msid) {
  26427. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' msid:' + msid);
  26428. insertAt++;
  26429. }
  26430. if (mslabel) {
  26431. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' mslabel:' + mslabel);
  26432. insertAt++;
  26433. }
  26434. if (label) {
  26435. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' label:' + label);
  26436. insertAt++;
  26437. }
  26438. // Add the same info for the retransmission SSRC
  26439. if (cname) {
  26440. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' cname:' + cname);
  26441. insertAt++;
  26442. }
  26443. if (msid) {
  26444. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' msid:' + msid);
  26445. insertAt++;
  26446. }
  26447. if (mslabel) {
  26448. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' mslabel:' + mslabel);
  26449. insertAt++;
  26450. }
  26451. if (label) {
  26452. lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' label:' + label);
  26453. insertAt++;
  26454. }
  26455. }
  26456. lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[2] + ' ' + ssrc_fid[2]);
  26457. lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[1] + ' ' + ssrc_fid[1]);
  26458. lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[0] + ' ' + ssrc_fid[0]);
  26459. lines.splice(insertAt, 0, 'a=ssrc-group:SIM ' + ssrc[0] + ' ' + ssrc[1] + ' ' + ssrc[2]);
  26460. sdp = lines.join("\r\n");
  26461. if (!sdp.endsWith("\r\n")) sdp += "\r\n";
  26462. return sdp;
  26463. }
  26464. // Helper methods to parse a media object
  26465. function isAudioSendEnabled(media) {
  26466. Janus$1.debug("isAudioSendEnabled:", media);
  26467. if (media === undefined || media === null) return true; // Default
  26468. if (media.audio === false) return false; // Generic audio has precedence
  26469. if (media.audioSend === undefined || media.audioSend === null) return true; // Default
  26470. return media.audioSend === true;
  26471. }
  26472. function isAudioSendRequired(media) {
  26473. Janus$1.debug("isAudioSendRequired:", media);
  26474. if (media === undefined || media === null) return false; // Default
  26475. if (media.audio === false || media.audioSend === false) return false; // If we're not asking to capture audio, it's not required
  26476. if (media.failIfNoAudio === undefined || media.failIfNoAudio === null) return false; // Default
  26477. return media.failIfNoAudio === true;
  26478. }
  26479. function isAudioRecvEnabled(media) {
  26480. Janus$1.debug("isAudioRecvEnabled:", media);
  26481. if (media === undefined || media === null) return true; // Default
  26482. if (media.audio === false) return false; // Generic audio has precedence
  26483. if (media.audioRecv === undefined || media.audioRecv === null) return true; // Default
  26484. return media.audioRecv === true;
  26485. }
  26486. function isVideoSendEnabled(media) {
  26487. Janus$1.debug("isVideoSendEnabled:", media);
  26488. if (media === undefined || media === null) return true; // Default
  26489. if (media.video === false) return false; // Generic video has precedence
  26490. if (media.videoSend === undefined || media.videoSend === null) return true; // Default
  26491. return media.videoSend === true;
  26492. }
  26493. function isVideoSendRequired(media) {
  26494. Janus$1.debug("isVideoSendRequired:", media);
  26495. if (media === undefined || media === null) return false; // Default
  26496. if (media.video === false || media.videoSend === false) return false; // If we're not asking to capture video, it's not required
  26497. if (media.failIfNoVideo === undefined || media.failIfNoVideo === null) return false; // Default
  26498. return media.failIfNoVideo === true;
  26499. }
  26500. function isVideoRecvEnabled(media) {
  26501. Janus$1.debug("isVideoRecvEnabled:", media);
  26502. if (media === undefined || media === null) return true; // Default
  26503. if (media.video === false) return false; // Generic video has precedence
  26504. if (media.videoRecv === undefined || media.videoRecv === null) return true; // Default
  26505. return media.videoRecv === true;
  26506. }
  26507. function isScreenSendEnabled(media) {
  26508. Janus$1.debug("isScreenSendEnabled:", media);
  26509. if (media === undefined || media === null) return false;
  26510. if (_typeof(media.video) !== 'object' || _typeof(media.video.mandatory) !== 'object') return false;
  26511. var constraints = media.video.mandatory;
  26512. if (constraints.chromeMediaSource) return constraints.chromeMediaSource === 'desktop' || constraints.chromeMediaSource === 'screen';else if (constraints.mozMediaSource) return constraints.mozMediaSource === 'window' || constraints.mozMediaSource === 'screen';else if (constraints.mediaSource) return constraints.mediaSource === 'window' || constraints.mediaSource === 'screen';
  26513. return false;
  26514. }
  26515. function isDataEnabled(media) {
  26516. Janus$1.debug("isDataEnabled:", media);
  26517. if (Janus$1.webRTCAdapter.browserDetails.browser == "edge") {
  26518. Janus$1.warn("Edge doesn't support data channels yet");
  26519. return false;
  26520. }
  26521. if (media === undefined || media === null) return false; // Default
  26522. return media.data === true;
  26523. }
  26524. function isTrickleEnabled(trickle) {
  26525. Janus$1.debug("isTrickleEnabled:", trickle);
  26526. if (trickle === undefined || trickle === null) return true; // Default is true
  26527. return trickle === true;
  26528. }
  26529. }
  26530. window.Janus = Janus$1;
  26531. // We make use of this 'server' variable to provide the address of the
  26532. var janus = null;
  26533. var tts = null;
  26534. var opaqueId = "tts-" + Janus.randomString(12);
  26535. var spinner = null;
  26536. Janus = window.Janus;
  26537. // Initialize the library (all console debuggers enabled)
  26538. Janus.init({
  26539. debug: "all",
  26540. callback: function callback() {
  26541. window.stopTalk = function () {
  26542. janus.destroy();
  26543. };
  26544. // debugger;
  26545. window.startTalk = function () {
  26546. // Make sure the browser supports WebRTC
  26547. if (!Janus.isWebrtcSupported()) {
  26548. bootbox.alert("No WebRTC support... ");
  26549. return;
  26550. }
  26551. // if($('#tts_url').val().length == 0){
  26552. // bootbox.alert("Please input tts url... ");
  26553. // return;
  26554. // }
  26555. // $(this).attr('disabled', true).unbind('click');
  26556. // Create session
  26557. janus = new Janus({
  26558. server: window.EZUIKit.opt.rtcUrl,
  26559. // No "iceServers" is provided, meaning janus.js will use a default STUN server
  26560. // Here are some examples of how an iceServers field may look like to support TURN
  26561. // iceServers: [{urls: "turn:yourturnserver.com:3478", username: "janususer", credential: "januspwd"}],
  26562. // iceServers: [{urls: "turn:yourturnserver.com:443?transport=tcp", username: "janususer", credential: "januspwd"}],
  26563. // iceServers: [{urls: "turns:yourturnserver.com:443?transport=tcp", username: "janususer", credential: "januspwd"}],
  26564. // Should the Janus API require authentication, you can specify either the API secret or user token here too
  26565. // token: "mytoken",
  26566. // or
  26567. // apisecret: "serversecret",
  26568. success: function success() {
  26569. // Attach to tts plugin
  26570. janus.attach({
  26571. plugin: "rtcgw.plugin.tts",
  26572. opaqueId: opaqueId,
  26573. success: function success(pluginHandle) {
  26574. // $('#details').remove();
  26575. tts = pluginHandle;
  26576. Janus.log("Plugin attached! (" + tts.getPlugin() + ", id=" + tts.getId() + ")");
  26577. // Negotiate WebRTC
  26578. //var url = "tts://61.130.6.23:8664/talk://D13781761:0:1:cas.ys7.com:6500?97fbd2a75fa94b7682c994d3d1fac8ca:ut.5porslgu79e9r7ca48z32k8abgl3rp58-77bhb6i7xr-1kmumtg-jkhy7pvfr:0:3"
  26579. //var url = "tts://10.86.15.209:8664/talk://D13781761:0:1:cas.ys7.com:6500?32db2578ba7c4a84be22ecc0bcd0f8db:ut.5lqpkhim5m7cdk2y5w60g7hm9vd7i3v0-3d2pwhxe2t-11wx2ge-sh4yazbll:0:3"
  26580. //var url = "tts://10.86.15.209:8664/talk://D13781761:0:1:cas.ys7.com:6500"
  26581. //test12.ys.com
  26582. //var url = "tts://10.86.15.209:8664/talk://D08197169:0:1:cas.ys7.com:6500"
  26583. //test10.ys.com
  26584. //var url = "tts://10.86.29.210:8664/talk://D08197169:0:1:cas.ys7.com:6500"
  26585. var url = window.EZUIKit.opt.talkLink;
  26586. console.log("ttsUlr", url);
  26587. var body = {
  26588. "request": "start",
  26589. "url": url,
  26590. "codec": "opus",
  26591. "dir": "sendrecv",
  26592. "audio_debug": 1
  26593. };
  26594. if (window.EZUIKit.opt.talkType === 'gb28181') {
  26595. body['devProto'] = 'gb28181';
  26596. }
  26597. //tts.send({"message": body});
  26598. Janus.debug("Trying a createOffer too (audio/video sendrecv)");
  26599. tts.createOffer({
  26600. // No media provided: by default, it's sendrecv for audio and video
  26601. media: {
  26602. audio: true,
  26603. video: false,
  26604. data: false
  26605. },
  26606. // Audio only
  26607. // If you want to test simulcasting (Chrome and Firefox only), then
  26608. // pass a ?simulcast=true when opening this demo page: it will turn
  26609. // the following 'simulcast' property to pass to janus.js to true
  26610. simulcast: false,
  26611. simulcast2: false,
  26612. success: function success(jsep) {
  26613. Janus.debug("Got SDP!");
  26614. Janus.debug(jsep);
  26615. tts.send({
  26616. "message": body,
  26617. "jsep": jsep
  26618. });
  26619. if (typeof window.EZUIKit.handleTalkSuccess !== 'undefined') {
  26620. window.EZUIKit.handleTalkSuccess();
  26621. }
  26622. },
  26623. error: function error(_error) {
  26624. Janus.error("WebRTC error:", _error);
  26625. // bootbox.alert("WebRTC error... " + JSON.stringify(error));
  26626. if (typeof window.EZUIKit.handleTalkError !== 'undefined') {
  26627. window.EZUIKit.handleTalkError(_error);
  26628. }
  26629. }
  26630. });
  26631. // $('#start').removeAttr('disabled').html("Stop")
  26632. // .click(function() {
  26633. // $(this).attr('disabled', true);
  26634. // janus.destroy();
  26635. // });
  26636. },
  26637. error: function error(_error2) {
  26638. console.error(" -- Error attaching plugin...", _error2);
  26639. bootbox.alert("Error attaching plugin... " + _error2);
  26640. if (window.EZUIKit.handleTalkError !== 'undefined') {
  26641. window.EZUIKit.handleTalkError(_error2);
  26642. }
  26643. },
  26644. consentDialog: function consentDialog(on) {
  26645. Janus.debug("Consent dialog should be " + (on ? "on" : "off") + " now");
  26646. },
  26647. iceState: function iceState(state) {
  26648. Janus.log("ICE state changed to " + state);
  26649. },
  26650. mediaState: function mediaState(medium, on) {
  26651. Janus.log("Janus " + (on ? "started" : "stopped") + " receiving our " + medium);
  26652. },
  26653. webrtcState: function webrtcState(on) {
  26654. Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now");
  26655. // $("#audioleft").parent().unblock();
  26656. },
  26657. slowLink: function slowLink(uplink, lost) {
  26658. Janus.warn("Janus reports problems " + (uplink ? "sending" : "receiving") + " packets on this PeerConnection (" + lost + " lost packets)");
  26659. },
  26660. onmessage: function onmessage(msg, jsep) {
  26661. Janus.debug(" ::: Got a message :::");
  26662. Janus.debug(msg);
  26663. if (jsep !== undefined && jsep !== null) {
  26664. Janus.debug("Handling SDP as well...");
  26665. Janus.debug(jsep);
  26666. tts.handleRemoteJsep({
  26667. jsep: jsep
  26668. });
  26669. }
  26670. var result = msg["result"];
  26671. if (result !== null && result !== undefined) {
  26672. if (result === "done") {
  26673. // The plugin closed
  26674. bootbox.alert("The TTS Test is over");
  26675. if (spinner !== null && spinner !== undefined) spinner.stop();
  26676. spinner = null;
  26677. // $('#myaudio').remove();
  26678. //$('#waitingvideo').remove();
  26679. // $('#peeraudio').remove();
  26680. return;
  26681. }
  26682. if (result === "msg") {
  26683. if (typeof window.EZUIKit.handleTalkMessage !== 'undefined') {
  26684. window.EZUIKit.handleTalkMessage(msg);
  26685. }
  26686. }
  26687. // Any loss?
  26688. var status = result["status"];
  26689. if (status === "slow_link") {
  26690. //~ var bitrate = result["bitrate"];
  26691. //~ toastr.warning("The bitrate has been cut to " + (bitrate/1000) + "kbps", "Packet loss?", {timeOut: 2000});
  26692. toastr.warning("Janus apparently missed many packets we sent, maybe we should reduce the bitrate", "Packet loss?", {
  26693. timeOut: 2000
  26694. });
  26695. }
  26696. }
  26697. },
  26698. onlocalstream: function onlocalstream(stream) {
  26699. Janus.debug(" ::: Got a local stream :::");
  26700. Janus.debug(stream);
  26701. // if($('#myaudio').length === 0) {
  26702. // $('#audios').removeClass('hide').show();
  26703. // $('#audioleft').append('<audio id="myaudio" autoplay controls muted>Your browser does not support audio tag</audio>');
  26704. // }
  26705. Janus.attachMediaStream(document.getElementById("myaudio"), stream);
  26706. //$("#myaudio").get(0).muted = "muted";
  26707. if (tts.webrtcStuff.pc.iceConnectionState !== "completed" && tts.webrtcStuff.pc.iceConnectionState !== "connected") {
  26708. // $("#audioleft").parent().block({
  26709. // message: '<b>Publishing...</b>',
  26710. // css: {
  26711. // border: 'none',
  26712. // backgroundColor: 'transparent',
  26713. // color: 'white'
  26714. // }
  26715. // });
  26716. // No remote video yet
  26717. //$('#audioright').append('<video class="rounded centered" id="waitingvideo" width=320 height=240 />');
  26718. if (spinner == null) {
  26719. document.getElementById('audioright');
  26720. //spinner = new Spinner({top:100}).spin(target);
  26721. } else {
  26722. spinner.spin();
  26723. }
  26724. }
  26725. var audioTracks = stream.getAudioTracks();
  26726. if (audioTracks === null || audioTracks === undefined || audioTracks.length === 0) ;
  26727. },
  26728. onremotestream: function onremotestream(stream) {
  26729. Janus.debug(" ::: Got a remote stream :::");
  26730. Janus.debug(stream);
  26731. // if($('#peeraudio').length === 0) {
  26732. // $('#audios').removeClass('hide').show();
  26733. // // $('#audioright').append('<audio id="peeraudio" autoplay controls>Your browser does not support audio tag</audio>');
  26734. // // Show the video, hide the spinner and show the resolution when we get a playing event
  26735. // var audio = $('<audio id="peeraudio" autoplay controls playsinline preload="preload" loop="true"></audio>');
  26736. // audio = audio.get(0);
  26737. // audio.setAttribute("id", 'peeraudio');
  26738. // audio.setAttribute("preload","preload");
  26739. // // 自动播放解决苹果不兼容autoplay属性
  26740. // audio.setAttribute("loop",true);
  26741. // $('#audioright').append(audio);
  26742. // $("#peeraudio").bind("playing", function () {
  26743. // //$('#waitingvideo').remove();
  26744. // $('#peeraudio').removeClass('hide').show();
  26745. // if(spinner !== null && spinner !== undefined)
  26746. // spinner.stop();
  26747. // spinner = null;
  26748. // });
  26749. // }
  26750. Janus.attachMediaStream(document.getElementById("peeraudio"), stream);
  26751. var audioTracks = stream.getAudioTracks();
  26752. if (audioTracks === null || audioTracks === undefined || audioTracks.length === 0) ; else {
  26753. // $('#peeraudio').removeClass('hide').show();
  26754. document.getElementById('peeraudio').play();
  26755. }
  26756. },
  26757. ondataopen: function ondataopen(data) {
  26758. Janus.log("The DataChannel is available!");
  26759. },
  26760. ondata: function ondata(data) {
  26761. Janus.debug("We got data from the DataChannel! " + data);
  26762. },
  26763. oncleanup: function oncleanup() {
  26764. Janus.log(" ::: Got a cleanup notification :::");
  26765. if (spinner !== null && spinner !== undefined) spinner.stop();
  26766. spinner = null;
  26767. // $('#myaudio').remove();
  26768. // //$('#waitingvideo').remove();
  26769. // $("#audioleft").parent().unblock();
  26770. // $('#peeraudio').remove();
  26771. }
  26772. });
  26773. },
  26774. error: function error(_error3) {
  26775. Janus.error(_error3);
  26776. if (window.EZUIKit.handleTalkError !== 'undefined') {
  26777. window.EZUIKit.handleTalkError(_error3);
  26778. }
  26779. },
  26780. destroyed: function destroyed() {
  26781. // window.location.reload();
  26782. }
  26783. });
  26784. };
  26785. }
  26786. });
  26787. window.janus = janus;
  26788. window.tts = tts;
  26789. var Talk = /*#__PURE__*/function () {
  26790. function Talk(jSPlugin) {
  26791. var _this = this;
  26792. _classCallCheck$1(this, Talk);
  26793. this.jSPlugin = jSPlugin;
  26794. this.codeHandler = new UikitCode();
  26795. this.pluginStatus = new Status(this, this.jSPlugin.params.id);
  26796. var audioLeft = document.createElement('div');
  26797. audioLeft.id = "audioleft";
  26798. var audioRight = document.createElement('div');
  26799. audioRight.id = "audioright";
  26800. audioRight.style = "display:none;";
  26801. var audioLeftDOM = document.createElement('audio');
  26802. audioLeftDOM.id = "myaudio";
  26803. audioLeftDOM.muted = true;
  26804. audioLeftDOM.setAttribute("autoplay", true);
  26805. audioLeftDOM.setAttribute("controls", true);
  26806. audioLeft.appendChild(audioLeftDOM);
  26807. audioLeft.style = "display:none;";
  26808. var audioRightDOM = document.createElement('audio');
  26809. audioRightDOM.id = "peeraudio";
  26810. audioRightDOM.setAttribute("autoplay", true);
  26811. audioRightDOM.setAttribute("controls", true);
  26812. audioRight.appendChild(audioRightDOM);
  26813. // addJs(`${this.jSPlugin.staticPath}/talk/adapeter.js`, () => {
  26814. // addJs(`${this.jSPlugin.staticPath}/talk/janus.js`, () => {
  26815. // addJs(`${this.jSPlugin.staticPath}/talk/tts-v4.js`, () => {
  26816. // 临时处理
  26817. window.EZUIKit["handleTalkError"] = function (err) {
  26818. console.log("talk err", err);
  26819. if (typeof _this.jSPlugin.handleTalkError !== 'undefined') {
  26820. _this.jSPlugin.handleTalkError(err);
  26821. }
  26822. };
  26823. window.EZUIKit["handleTalkSuccess"] = function (data) {
  26824. console.log("talk success", data);
  26825. if (typeof _this.jSPlugin.handleTalkSuccess !== 'undefined') {
  26826. _this.jSPlugin.handleTalkSuccess(data);
  26827. }
  26828. };
  26829. window.EZUIKit.opt = {
  26830. rtcUrl: "",
  26831. talkLink: "",
  26832. ttsUrl: "",
  26833. stream: "",
  26834. deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial,
  26835. channelNo: matchEzopenUrl(this.jSPlugin.url).channelNo
  26836. };
  26837. document.body.appendChild(audioLeft);
  26838. document.body.appendChild(audioRight);
  26839. // });
  26840. // });
  26841. // });
  26842. }
  26843. _createClass$1(Talk, [{
  26844. key: "toString",
  26845. value: function toString() {
  26846. return "".concat(this.coreX, "-").concat(this.coreY);
  26847. }
  26848. }, {
  26849. key: "startTalk",
  26850. value: function startTalk() {
  26851. var _this2 = this;
  26852. if (this.jSPlugin.capacity && this.jSPlugin.capacity.support_talk && !(this.jSPlugin.capacity && (this.jSPlugin.capacity.support_talk === '3' || this.jSPlugin.capacity.support_talk === '1'))) {
  26853. if (typeof this.jSPlugin.params.handleError === 'function') {
  26854. this.pluginStatus.loadingSetText({
  26855. text: "设备不支持对讲",
  26856. color: 'red',
  26857. delayClear: 2000
  26858. });
  26859. this.jSPlugin.params.handleError({
  26860. msg: "设备不支持对讲",
  26861. retcode: -1000,
  26862. id: this.jSPlugin.params.id,
  26863. type: "handleError"
  26864. });
  26865. }
  26866. console.log("设备不支持对讲");
  26867. return false;
  26868. }
  26869. var formData = new FormData();
  26870. formData.append("accessToken", this.jSPlugin.accessToken);
  26871. formData.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
  26872. formData.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
  26873. fetch(this.jSPlugin.env.domain + "/api/lapp/live/talk/url", {
  26874. method: "POST",
  26875. // headers: {
  26876. // 'Content-Type': 'application/json'
  26877. // },
  26878. body: formData
  26879. }).then(function (response) {
  26880. return response.json();
  26881. }).then(function (data) {
  26882. if (data.code == 200) {
  26883. var apiResult = data.data;
  26884. if (apiResult) {
  26885. // 临时将https转换为websocket
  26886. var rtcTrunk = apiResult.rtcUrl;
  26887. if (rtcTrunk.indexOf("ws") === -1) {
  26888. rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
  26889. }
  26890. window.EZUIKit.opt.rtcUrl = rtcTrunk;
  26891. window.EZUIKit.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
  26892. window.EZUIKit.opt.deviceSerial = matchEzopenUrl(_this2.jSPlugin.url).deviceSerial;
  26893. window.EZUIKit.opt.channelNo = matchEzopenUrl(_this2.jSPlugin.url).channelNo;
  26894. var urlList = window.EZUIKit.opt.ttsUrl.split("?");
  26895. if (urlList.length === 2) {
  26896. // 国标设备
  26897. var talk = "talk?dev=" + window.EZUIKit.opt.deviceSerial + "&chann=" + window.EZUIKit.opt.channelNo + "&encodetype=2";
  26898. window.EZUIKit.opt.talkLink = window.EZUIKit.opt.ttsUrl.split("?")[0] + "/" + talk;
  26899. window.EZUIKit.opt.talkType = "gb28181";
  26900. } else {
  26901. // 普通设备
  26902. var talk = "talk://" + window.EZUIKit.opt.deviceSerial + ":0:" + window.EZUIKit.opt.channelNo + ":cas.ys7.com:6500";
  26903. window.EZUIKit.opt.talkLink = window.EZUIKit.opt.ttsUrl.split("?")[0] + "/" + talk;
  26904. }
  26905. window.EZUIKit.opt.stream = apiResult.stream;
  26906. window.startTalk();
  26907. }
  26908. } else {
  26909. console.log(data.code, _this2.codeHandler.matchInfo(data.code, 'talk'));
  26910. _this2.pluginStatus.loadingSetText({
  26911. text: _this2.codeHandler.matchInfo(data.code, 'talk').msg || data.msg,
  26912. color: 'red',
  26913. delayClear: 2000
  26914. });
  26915. if (typeof _this2.jSPlugin.params.handleError === 'function') {
  26916. _this2.jSPlugin.params.handleError({
  26917. msg: data.msg,
  26918. retcode: data.code,
  26919. id: _this2.jSPlugin.params.id,
  26920. type: "handleError"
  26921. });
  26922. }
  26923. }
  26924. })["catch"](function (err) {
  26925. console.log("err", err);
  26926. });
  26927. }
  26928. }, {
  26929. key: "stopTalk",
  26930. value: function stopTalk() {
  26931. window.stopTalk();
  26932. if (document.getElementById("myaudio") && document.getElementById("myaudio").srcObject) {
  26933. document.getElementById("myaudio").srcObject.getTracks()[0].stop();
  26934. }
  26935. }
  26936. }]);
  26937. return Talk;
  26938. }();
  26939. var MobilePtz = /*#__PURE__*/function () {
  26940. function MobilePtz(jSPlugin) {
  26941. var _this = this;
  26942. _classCallCheck$1(this, MobilePtz);
  26943. this.jSPlugin = jSPlugin;
  26944. var oS = document.createElement('style');
  26945. oS.innerHTML = "\n body{\n padding: 0;\n margin: 0;\n }\n #mobile-ez-ptz-container {\n display: inline-block;\n width: 375px;\n text-align: center;\n }\n .live-ptz-title{\n height: 25px;\n font-size: 18px;\n color: #2c2c2c;\n text-align: center;\n font-weight: 700;\n margin: 24px 0 12px;\n }\n .live-ptz-intro {\n margin-bottom: 24px;\n color: #aaaaaa;\n }\n .mobile-ez-ptz-wrap {\n background-image: linear-gradient(180deg, #f6f8ff 0%, #ededed6b 50%)\n }\n #mobile-ez-ptz-container .mobile-ez-ptz-container {\n position: relative;\n width: 260px;\n height: 260px;\n background: rgba(255, 255, 255, 0.80);\n border: 1px solid rgba(255, 255, 255, 0.80);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n margin: auto;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n top: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top.active {\n border-bottom-color: #1890FF;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n bottom: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom.active {\n border-top-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-left: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n right: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right.active {\n border-left-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-right: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n left: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left.active {\n border-right-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .ez-ptz-main.center {\n width: 52px;\n height: 52px;\n background: #FFFFFF;\n border: 2px solid #eee;\n border-radius: 100%;\n top: calc(50% - 26px);\n left: calc(50% - 26px);\n position: absolute;\n /* box-shadow: 0px -39px 40px 6px #1890ff; */\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-wrap {\n display: inline-block;\n padding: 24px 24px;\n border-radius: 100%;\n overflow: hidden;\n }\n\n #mobile-ez-ptz-container .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }";
  26946. document.getElementsByTagName("head")[0].appendChild(oS);
  26947. var mobileContainer = document.createElement('div');
  26948. mobileContainer.className = "mobile-ez-ptz-container";
  26949. mobileContainer.id = "mobile-ez-ptz-container";
  26950. mobileContainer.style = "display:inline-block;width: ".concat(this.jSPlugin.width, "px;text-align:center;");
  26951. var mobileContainerTitle = document.createElement('div');
  26952. mobileContainerTitle.className = "live-ptz-title";
  26953. mobileContainerTitle.id = "live-ptz-title";
  26954. mobileContainerTitle.innerHTML = "云台控制";
  26955. if (!document.getElementById("live-ptz-title")) {
  26956. mobileContainer.appendChild(mobileContainerTitle);
  26957. }
  26958. var mobileContainerIntro = document.createElement('div');
  26959. mobileContainerIntro.className = "live-ptz-intro";
  26960. mobileContainerIntro.id = "live-ptz-intro";
  26961. mobileContainerIntro.innerHTML = "请通过操控云台来调整摄像机视角";
  26962. if (!document.getElementById("live-ptz-intro")) {
  26963. mobileContainer.appendChild(mobileContainerIntro);
  26964. }
  26965. var ptzWrap = document.createElement('div');
  26966. ptzWrap.id = "mobile-ez-ptz-item";
  26967. ptzWrap.className = "mobile-ez-ptz-wrap";
  26968. ptzWrap.innerHTML = "\n <div class=\"mobile-ez-ptz-container\" id=\"mobile-ez-ptz-container\">\n <div class=\"ez-ptz-main center\"></div>\n <div class=\"mobile-ez-ptz-icon top default\"></div>\n <div class=\"mobile-ez-ptz-icon left default\"></div>\n <div class=\"mobile-ez-ptz-icon bottom default\"></div>\n <div class=\"mobile-ez-ptz-icon right default\"></div>\n </div>\n ";
  26969. if (!document.getElementById("mobile-ez-ptz-item")) {
  26970. mobileContainer.appendChild(ptzWrap);
  26971. }
  26972. //document.getElementById(jSPlugin.id).appendChild(mobileContainer);
  26973. insertAfter$1(mobileContainer, document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
  26974. // 云台控制事件绑定
  26975. // 云台控制
  26976. document.getElementById("mobile-ez-ptz-item").ontouchstart = function (e) {
  26977. e.preventDefault();
  26978. console.log("触摸开始");
  26979. _this._handlePtzTouch(e, 'start');
  26980. };
  26981. document.getElementById("mobile-ez-ptz-item").ontouchend = function (e) {
  26982. e.preventDefault();
  26983. console.log("触摸结束", e);
  26984. _this._handlePtzTouch(e, 'stop');
  26985. };
  26986. // 云台控制
  26987. document.getElementById("mobile-ez-ptz-item").onmousedown = function (e) {
  26988. e.preventDefault();
  26989. console.log("触摸开始");
  26990. _this._handlePtzTouch(e, 'start');
  26991. };
  26992. document.getElementById("mobile-ez-ptz-item").onmouseup = function (e) {
  26993. e.preventDefault();
  26994. console.log("触摸结束", e);
  26995. _this._handlePtzTouch(e, 'stop');
  26996. };
  26997. }
  26998. _createClass$1(MobilePtz, [{
  26999. key: "show",
  27000. value: function show() {
  27001. document.getElementById("mobile-ez-ptz-item").style = "display: inline-block";
  27002. }
  27003. }, {
  27004. key: "hide",
  27005. value: function hide() {
  27006. document.getElementById("mobile-ez-ptz-item").style = "display: none";
  27007. }
  27008. }, {
  27009. key: "_handlePtzTouch",
  27010. value: function _handlePtzTouch(e, type) {
  27011. var container = document.getElementById('mobile-ez-ptz-item').getBoundingClientRect();
  27012. var containerCenterX = container.left + 130;
  27013. var containerCenterY = container.top + 130;
  27014. var eventX = e.x || e.changedTouches[0].clientX;
  27015. var eventY = e.y || e.changedTouches[0].clientY;
  27016. var left = eventX - containerCenterX;
  27017. var top = eventY - containerCenterY;
  27018. var direction = 0; //操作命令:0-上,1-下,2-左,3右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
  27019. var url = this.jSPlugin.env.domain + "/api/lapp/device/ptz/start";
  27020. // var nextPtzImg = ptzNormalImg;
  27021. // var nextPtzImgFailed = ptzNormalImg;
  27022. // 判读方位
  27023. if (Math.abs(left) > Math.abs(top)) {
  27024. if (left > 0) {
  27025. direction = 3;
  27026. document.getElementsByClassName("mobile-ez-ptz-icon")[3].className = document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("default", "active");
  27027. } else {
  27028. direction = 2;
  27029. document.getElementsByClassName("mobile-ez-ptz-icon")[1].className = document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("default", "active");
  27030. }
  27031. } else {
  27032. if (top > 0) {
  27033. direction = 1;
  27034. document.getElementsByClassName("mobile-ez-ptz-icon")[2].className = document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("default", "active");
  27035. } else {
  27036. direction = 0;
  27037. document.getElementsByClassName("mobile-ez-ptz-icon")[0].className = document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("default", "active");
  27038. }
  27039. }
  27040. document.getElementById("mobile-ez-ptz-item").style = "background-image:linear-gradient(".concat(direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270, "deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)");
  27041. if (type === 'stop') {
  27042. url = this.jSPlugin.env.domain + '/api/lapp/device/ptz/stop';
  27043. document.getElementById("mobile-ez-ptz-item").style = "";
  27044. document.getElementsByClassName("mobile-ez-ptz-icon")[3].className = document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("active", "default");
  27045. document.getElementsByClassName("mobile-ez-ptz-icon")[1].className = document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("active", "default");
  27046. document.getElementsByClassName("mobile-ez-ptz-icon")[2].className = document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("active", "default");
  27047. document.getElementsByClassName("mobile-ez-ptz-icon")[0].className = document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("active", "default");
  27048. }
  27049. var data = new FormData();
  27050. data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
  27051. data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
  27052. data.append("speed", 1);
  27053. data.append("direction", direction);
  27054. data.append("accessToken", this.jSPlugin.accessToken);
  27055. fetch(url, {
  27056. method: "POST",
  27057. body: data
  27058. }).then(function (response) {
  27059. return response.json();
  27060. }).then(function (rt) {
  27061. if (rt.code == 200) ; else {
  27062. //document.getElementById('ptz-img-container').childNodes[0].src = nextPtzImgFailed;
  27063. // layer.msg(data.msg);
  27064. if (rt.code == 60005 || rt.code == 60002 || rt.code == 60003 || rt.code == 60004) {
  27065. document.getElementById("mobile-ez-ptz-item").style = "background-image:linear-gradient(".concat(direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270, "deg, #f45656 0%, rgba(100,143,252,0.00) 50%)");
  27066. }
  27067. }
  27068. })["catch"](function (err) {
  27069. console.log("云台调用异常", err);
  27070. });
  27071. }
  27072. }]);
  27073. return MobilePtz;
  27074. }();
  27075. var retcode = 0;
  27076. var msg = "成功";
  27077. var data$7 = {
  27078. header: {
  27079. color: "#FFFFFF",
  27080. backgroundColor: "#000000",
  27081. activeColor: "#1890FF",
  27082. btnList: [
  27083. {
  27084. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
  27085. iconId: "deviceID",
  27086. part: "left",
  27087. defaultActive: 0,
  27088. isrender: 0,
  27089. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27090. },
  27091. {
  27092. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
  27093. iconId: "deviceName",
  27094. part: "left",
  27095. defaultActive: 0,
  27096. isrender: 0,
  27097. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27098. },
  27099. {
  27100. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
  27101. iconId: "cloudRec",
  27102. part: "right",
  27103. defaultActive: 0,
  27104. isrender: 0,
  27105. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27106. },
  27107. {
  27108. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
  27109. iconId: "rec",
  27110. part: "right",
  27111. defaultActive: 0,
  27112. isrender: 0,
  27113. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27114. }
  27115. ]
  27116. },
  27117. footer: {
  27118. color: "#FFFFFF",
  27119. backgroundColor: "rgb(0 0 0 / 0%)",
  27120. activeColor: "#1890FF",
  27121. btnList: [
  27122. {
  27123. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-0",
  27124. iconId: "play",
  27125. part: "left",
  27126. defaultActive: 1,
  27127. isrender: 0,
  27128. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27129. },
  27130. {
  27131. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-1",
  27132. iconId: "capturePicture",
  27133. part: "left",
  27134. defaultActive: 0,
  27135. isrender: 0,
  27136. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27137. },
  27138. {
  27139. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-2",
  27140. iconId: "sound",
  27141. part: "left",
  27142. defaultActive: 0,
  27143. isrender: 0,
  27144. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27145. },
  27146. {
  27147. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-3",
  27148. iconId: "pantile",
  27149. part: "left",
  27150. defaultActive: 0,
  27151. isrender: 0,
  27152. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27153. },
  27154. {
  27155. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-4",
  27156. iconId: "recordvideo",
  27157. part: "left",
  27158. defaultActive: 0,
  27159. isrender: 0,
  27160. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27161. },
  27162. {
  27163. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-5",
  27164. iconId: "talk",
  27165. part: "left",
  27166. defaultActive: 0,
  27167. isrender: 0,
  27168. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27169. },
  27170. {
  27171. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-6",
  27172. iconId: "hd",
  27173. part: "right",
  27174. defaultActive: 0,
  27175. isrender: 0,
  27176. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27177. },
  27178. {
  27179. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-7",
  27180. iconId: "webExpend",
  27181. part: "right",
  27182. defaultActive: 0,
  27183. isrender: 0,
  27184. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27185. },
  27186. {
  27187. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-8",
  27188. iconId: "expend",
  27189. part: "right",
  27190. defaultActive: 0,
  27191. isrender: 0,
  27192. themeId: "f7896c8942c9476fb439370dd974f1c0"
  27193. }
  27194. ]
  27195. }
  27196. };
  27197. var emptyData = {
  27198. retcode: retcode,
  27199. msg: msg,
  27200. data: data$7
  27201. };
  27202. var data$6 = {
  27203. header: {
  27204. color: "#FFFFFF",
  27205. backgroundColor: "#000000",
  27206. activeColor: "#1890FF",
  27207. btnList: [
  27208. {
  27209. iconId: "deviceID",
  27210. part: "left",
  27211. defaultActive: 0,
  27212. isrender: 1
  27213. },
  27214. {
  27215. iconId: "deviceName",
  27216. part: "left",
  27217. defaultActive: 0,
  27218. isrender: 1
  27219. },
  27220. {
  27221. iconId: "cloudRec",
  27222. part: "right",
  27223. defaultActive: 0,
  27224. isrender: 0
  27225. },
  27226. {
  27227. iconId: "rec",
  27228. part: "right",
  27229. defaultActive: 0,
  27230. isrender: 0
  27231. }
  27232. ]
  27233. },
  27234. footer: {
  27235. color: "#FFFFFF",
  27236. backgroundColor: "#00000080",
  27237. activeColor: "#1890FF",
  27238. btnList: [
  27239. {
  27240. iconId: "play",
  27241. part: "left",
  27242. defaultActive: 1,
  27243. isrender: 1
  27244. },
  27245. {
  27246. iconId: "capturePicture",
  27247. part: "left",
  27248. defaultActive: 0,
  27249. isrender: 0
  27250. },
  27251. {
  27252. iconId: "sound",
  27253. part: "left",
  27254. defaultActive: 1,
  27255. isrender: 1
  27256. },
  27257. {
  27258. iconId: "pantile",
  27259. part: "left",
  27260. defaultActive: 0,
  27261. isrender: 1
  27262. },
  27263. {
  27264. iconId: "recordvideo",
  27265. part: "left",
  27266. defaultActive: 0,
  27267. isrender: 0
  27268. },
  27269. {
  27270. iconId: "talk",
  27271. part: "left",
  27272. defaultActive: 0,
  27273. isrender: 1
  27274. },
  27275. {
  27276. iconId: "zoom",
  27277. part: "left",
  27278. defaultActive: 0,
  27279. isrender: 1
  27280. },
  27281. {
  27282. iconId: "hd",
  27283. part: "right",
  27284. defaultActive: 0,
  27285. isrender: 1
  27286. },
  27287. {
  27288. iconId: "webExpend",
  27289. part: "right",
  27290. defaultActive: 0,
  27291. isrender: 0
  27292. },
  27293. {
  27294. iconId: "expend",
  27295. part: "right",
  27296. defaultActive: 0,
  27297. isrender: 1
  27298. }
  27299. ]
  27300. }
  27301. };
  27302. var mobileLiveFullData = {
  27303. data: data$6
  27304. };
  27305. var data$5 = {
  27306. header: {
  27307. color: "#FFFFFF",
  27308. backgroundColor: "#000000",
  27309. activeColor: "#1890FF",
  27310. btnList: [
  27311. {
  27312. iconId: "deviceID",
  27313. part: "left",
  27314. defaultActive: 0,
  27315. isrender: 1
  27316. },
  27317. {
  27318. iconId: "deviceName",
  27319. part: "left",
  27320. defaultActive: 0,
  27321. isrender: 1
  27322. },
  27323. {
  27324. iconId: "cloudRec",
  27325. part: "right",
  27326. defaultActive: 0,
  27327. isrender: 1
  27328. },
  27329. {
  27330. iconId: "rec",
  27331. part: "right",
  27332. defaultActive: 0,
  27333. isrender: 1
  27334. }
  27335. ]
  27336. },
  27337. footer: {
  27338. color: "#FFFFFF",
  27339. backgroundColor: "#00000080",
  27340. activeColor: "#1890FF",
  27341. btnList: [
  27342. {
  27343. iconId: "play",
  27344. part: "left",
  27345. defaultActive: 1,
  27346. isrender: 1
  27347. },
  27348. {
  27349. iconId: "capturePicture",
  27350. part: "left",
  27351. defaultActive: 0,
  27352. isrender: 0
  27353. },
  27354. {
  27355. iconId: "sound",
  27356. part: "left",
  27357. defaultActive: 1,
  27358. isrender: 1
  27359. },
  27360. {
  27361. iconId: "pantile",
  27362. part: "left",
  27363. defaultActive: 0,
  27364. isrender: 0
  27365. },
  27366. {
  27367. iconId: "recordvideo",
  27368. part: "left",
  27369. defaultActive: 0,
  27370. isrender: 0
  27371. },
  27372. {
  27373. iconId: "talk",
  27374. part: "left",
  27375. defaultActive: 0,
  27376. isrender: 0
  27377. },
  27378. {
  27379. iconId: "zoom",
  27380. part: "left",
  27381. defaultActive: 0,
  27382. isrender: 1
  27383. },
  27384. {
  27385. iconId: "speed",
  27386. part: "right",
  27387. defaultActive: 0,
  27388. isrender: 1
  27389. },
  27390. {
  27391. iconId: "hd",
  27392. part: "right",
  27393. defaultActive: 0,
  27394. isrender: 0
  27395. },
  27396. {
  27397. iconId: "webExpend",
  27398. part: "right",
  27399. defaultActive: 0,
  27400. isrender: 0
  27401. },
  27402. {
  27403. iconId: "expend",
  27404. part: "right",
  27405. defaultActive: 0,
  27406. isrender: 1
  27407. }
  27408. ]
  27409. }
  27410. };
  27411. var mobileRecFullData = {
  27412. data: data$5
  27413. };
  27414. var data$4 = {
  27415. header: {
  27416. color: "#FFFFFF",
  27417. backgroundColor: "#000000",
  27418. activeColor: "#1890FF",
  27419. btnList: [
  27420. {
  27421. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
  27422. iconId: "deviceID",
  27423. part: "left",
  27424. defaultActive: 0,
  27425. isrender: 1
  27426. },
  27427. {
  27428. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
  27429. iconId: "deviceName",
  27430. part: "left",
  27431. defaultActive: 0,
  27432. isrender: 1
  27433. },
  27434. {
  27435. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
  27436. iconId: "cloudRec",
  27437. part: "right",
  27438. defaultActive: 0,
  27439. isrender: 0
  27440. },
  27441. {
  27442. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
  27443. iconId: "rec",
  27444. part: "right",
  27445. defaultActive: 0,
  27446. isrender: 0
  27447. }
  27448. ]
  27449. },
  27450. footer: {
  27451. color: "#FFFFFF",
  27452. backgroundColor: "#00000080",
  27453. activeColor: "#1890FF",
  27454. btnList: [
  27455. {
  27456. iconId: "play",
  27457. part: "left",
  27458. defaultActive: 1,
  27459. isrender: 1
  27460. },
  27461. {
  27462. iconId: "capturePicture",
  27463. part: "left",
  27464. defaultActive: 0,
  27465. isrender: 1
  27466. },
  27467. {
  27468. iconId: "sound",
  27469. part: "left",
  27470. defaultActive: 1,
  27471. isrender: 1
  27472. },
  27473. {
  27474. iconId: "pantile",
  27475. part: "left",
  27476. defaultActive: 0,
  27477. isrender: 1
  27478. },
  27479. {
  27480. iconId: "recordvideo",
  27481. part: "left",
  27482. defaultActive: 0,
  27483. isrender: 1
  27484. },
  27485. {
  27486. iconId: "talk",
  27487. part: "left",
  27488. defaultActive: 0,
  27489. isrender: 1
  27490. },
  27491. {
  27492. iconId: "zoom",
  27493. part: "left",
  27494. defaultActive: 0,
  27495. isrender: 1
  27496. },
  27497. {
  27498. iconId: "speed",
  27499. part: "right",
  27500. defaultActive: 0,
  27501. isrender: 0
  27502. },
  27503. {
  27504. iconId: "hd",
  27505. part: "right",
  27506. defaultActive: 0,
  27507. isrender: 1
  27508. },
  27509. {
  27510. iconId: "webExpend",
  27511. part: "right",
  27512. defaultActive: 0,
  27513. isrender: 1
  27514. },
  27515. {
  27516. iconId: "expend",
  27517. part: "right",
  27518. defaultActive: 0,
  27519. isrender: 1
  27520. }
  27521. ]
  27522. }
  27523. };
  27524. var pcLiveFullData = {
  27525. data: data$4
  27526. };
  27527. var data$3 = {
  27528. header: {
  27529. color: "#FFFFFF",
  27530. backgroundColor: "#000000",
  27531. activeColor: "#1890FF",
  27532. btnList: [
  27533. {
  27534. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
  27535. iconId: "deviceID",
  27536. part: "left",
  27537. defaultActive: 0,
  27538. isrender: 1
  27539. },
  27540. {
  27541. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
  27542. iconId: "deviceName",
  27543. part: "left",
  27544. defaultActive: 0,
  27545. isrender: 1
  27546. },
  27547. {
  27548. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
  27549. iconId: "cloudRec",
  27550. part: "right",
  27551. defaultActive: 0,
  27552. isrender: 0
  27553. },
  27554. {
  27555. btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
  27556. iconId: "rec",
  27557. part: "right",
  27558. defaultActive: 0,
  27559. isrender: 0
  27560. }
  27561. ]
  27562. },
  27563. footer: {
  27564. color: "#FFFFFF",
  27565. backgroundColor: "#00000080",
  27566. activeColor: "#1890FF",
  27567. btnList: [
  27568. {
  27569. iconId: "play",
  27570. part: "left",
  27571. defaultActive: 1,
  27572. isrender: 1
  27573. },
  27574. {
  27575. iconId: "talk",
  27576. part: "left",
  27577. defaultActive: 0,
  27578. isrender: 1
  27579. },
  27580. {
  27581. iconId: "sound",
  27582. part: "left",
  27583. defaultActive: 1,
  27584. isrender: 1
  27585. },
  27586. {
  27587. iconId: "capturePicture",
  27588. part: "left",
  27589. defaultActive: 0,
  27590. isrender: 1
  27591. },
  27592. {
  27593. iconId: "recordvideo",
  27594. part: "left",
  27595. defaultActive: 0,
  27596. isrender: 1
  27597. },
  27598. {
  27599. iconId: "pantile",
  27600. part: "left",
  27601. defaultActive: 0,
  27602. isrender: 0
  27603. },
  27604. {
  27605. iconId: "zoom",
  27606. part: "left",
  27607. defaultActive: 0,
  27608. isrender: 1
  27609. },
  27610. {
  27611. iconId: "hd",
  27612. part: "right",
  27613. defaultActive: 0,
  27614. isrender: 1
  27615. },
  27616. {
  27617. iconId: "webExpend",
  27618. part: "right",
  27619. defaultActive: 0,
  27620. isrender: 0
  27621. },
  27622. {
  27623. iconId: "expend",
  27624. part: "right",
  27625. defaultActive: 0,
  27626. isrender: 1
  27627. }
  27628. ]
  27629. }
  27630. };
  27631. var pcLiveSecurityData = {
  27632. data: data$3
  27633. };
  27634. var data$2 = {
  27635. header: {
  27636. color: "#FFFFFF",
  27637. backgroundColor: "#000000",
  27638. activeColor: "#1890FF",
  27639. btnList: [
  27640. {
  27641. iconId: "deviceID",
  27642. part: "left",
  27643. defaultActive: 0,
  27644. isrender: 0
  27645. },
  27646. {
  27647. iconId: "deviceName",
  27648. part: "left",
  27649. defaultActive: 0,
  27650. isrender: 0
  27651. },
  27652. {
  27653. iconId: "cloudRec",
  27654. part: "right",
  27655. defaultActive: 0,
  27656. isrender: 0
  27657. },
  27658. {
  27659. iconId: "rec",
  27660. part: "right",
  27661. defaultActive: 0,
  27662. isrender: 0
  27663. }
  27664. ]
  27665. },
  27666. footer: {
  27667. color: "#FFFFFF",
  27668. backgroundColor: "#000000",
  27669. activeColor: "#1890FF",
  27670. btnList: [
  27671. {
  27672. iconId: "play",
  27673. part: "left",
  27674. defaultActive: 1,
  27675. isrender: 0
  27676. },
  27677. {
  27678. iconId: "capturePicture",
  27679. part: "left",
  27680. defaultActive: 0,
  27681. isrender: 0
  27682. },
  27683. {
  27684. iconId: "sound",
  27685. part: "left",
  27686. defaultActive: 1,
  27687. isrender: 0
  27688. },
  27689. {
  27690. iconId: "pantile",
  27691. part: "left",
  27692. defaultActive: 0,
  27693. isrender: 0
  27694. },
  27695. {
  27696. iconId: "recordvideo",
  27697. part: "left",
  27698. defaultActive: 0,
  27699. isrender: 0
  27700. },
  27701. {
  27702. iconId: "talk",
  27703. part: "left",
  27704. defaultActive: 0,
  27705. isrender: 0
  27706. },
  27707. {
  27708. iconId: "zoom",
  27709. part: "left",
  27710. defaultActive: 0,
  27711. isrender: 0
  27712. },
  27713. {
  27714. iconId: "hd",
  27715. part: "right",
  27716. defaultActive: 0,
  27717. isrender: 0
  27718. },
  27719. {
  27720. iconId: "webExpend",
  27721. part: "right",
  27722. defaultActive: 0,
  27723. isrender: 0
  27724. },
  27725. {
  27726. iconId: "expend",
  27727. part: "right",
  27728. defaultActive: 0,
  27729. isrender: 0
  27730. }
  27731. ]
  27732. }
  27733. };
  27734. var pcLiveSimpleData = {
  27735. data: data$2
  27736. };
  27737. var data$1 = {
  27738. header: {
  27739. color: "#FFFFFF",
  27740. backgroundColor: "#000000",
  27741. activeColor: "#1890FF",
  27742. btnList: [
  27743. {
  27744. iconId: "deviceID",
  27745. part: "left",
  27746. defaultActive: 0,
  27747. isrender: 1
  27748. },
  27749. {
  27750. iconId: "deviceName",
  27751. part: "left",
  27752. defaultActive: 0,
  27753. isrender: 1
  27754. },
  27755. {
  27756. iconId: "cloudRec",
  27757. part: "right",
  27758. defaultActive: 0,
  27759. isrender: 0
  27760. },
  27761. {
  27762. iconId: "rec",
  27763. part: "right",
  27764. defaultActive: 0,
  27765. isrender: 0
  27766. }
  27767. ]
  27768. },
  27769. footer: {
  27770. color: "#FFFFFF",
  27771. backgroundColor: "#00000080",
  27772. activeColor: "#1890FF",
  27773. btnList: [
  27774. {
  27775. iconId: "play",
  27776. part: "left",
  27777. defaultActive: 1,
  27778. isrender: 1
  27779. },
  27780. {
  27781. iconId: "capturePicture",
  27782. part: "left",
  27783. defaultActive: 0,
  27784. isrender: 0
  27785. },
  27786. {
  27787. iconId: "talk",
  27788. part: "left",
  27789. defaultActive: 0,
  27790. isrender: 1
  27791. },
  27792. {
  27793. iconId: "sound",
  27794. part: "left",
  27795. defaultActive: 1,
  27796. isrender: 1
  27797. },
  27798. {
  27799. iconId: "pantile",
  27800. part: "left",
  27801. defaultActive: 0,
  27802. isrender: 0
  27803. },
  27804. {
  27805. iconId: "recordvideo",
  27806. part: "left",
  27807. defaultActive: 0,
  27808. isrender: 0
  27809. },
  27810. {
  27811. iconId: "hd",
  27812. part: "right",
  27813. defaultActive: 0,
  27814. isrender: 0
  27815. },
  27816. {
  27817. iconId: "zoom",
  27818. part: "left",
  27819. defaultActive: 0,
  27820. isrender: 0
  27821. },
  27822. {
  27823. iconId: "webExpend",
  27824. part: "right",
  27825. defaultActive: 0,
  27826. isrender: 0
  27827. },
  27828. {
  27829. iconId: "expend",
  27830. part: "right",
  27831. defaultActive: 0,
  27832. isrender: 1
  27833. }
  27834. ]
  27835. }
  27836. };
  27837. var pcLiveVoiceData = {
  27838. data: data$1
  27839. };
  27840. var data = {
  27841. header: {
  27842. color: "#FFFFFF",
  27843. backgroundColor: "#000000",
  27844. activeColor: "#1890FF",
  27845. btnList: [
  27846. {
  27847. iconId: "deviceID",
  27848. part: "left",
  27849. defaultActive: 0,
  27850. isrender: 1
  27851. },
  27852. {
  27853. iconId: "deviceName",
  27854. part: "left",
  27855. defaultActive: 0,
  27856. isrender: 1
  27857. },
  27858. {
  27859. iconId: "cloudRec",
  27860. part: "right",
  27861. defaultActive: 0,
  27862. isrender: 1
  27863. },
  27864. {
  27865. iconId: "rec",
  27866. part: "right",
  27867. defaultActive: 0,
  27868. isrender: 1
  27869. }
  27870. ]
  27871. },
  27872. footer: {
  27873. color: "#FFFFFF",
  27874. backgroundColor: "#00000080",
  27875. activeColor: "#1890FF",
  27876. btnList: [
  27877. {
  27878. iconId: "play",
  27879. part: "left",
  27880. defaultActive: 1,
  27881. isrender: 1
  27882. },
  27883. {
  27884. iconId: "capturePicture",
  27885. part: "left",
  27886. defaultActive: 0,
  27887. isrender: 1
  27888. },
  27889. {
  27890. iconId: "sound",
  27891. part: "left",
  27892. defaultActive: 1,
  27893. isrender: 1
  27894. },
  27895. {
  27896. iconId: "pantile",
  27897. part: "left",
  27898. defaultActive: 0,
  27899. isrender: 0
  27900. },
  27901. {
  27902. iconId: "recordvideo",
  27903. part: "left",
  27904. defaultActive: 0,
  27905. isrender: 1
  27906. },
  27907. {
  27908. iconId: "zoom",
  27909. part: "left",
  27910. defaultActive: 0,
  27911. isrender: 1
  27912. },
  27913. {
  27914. iconId: "speed",
  27915. part: "right",
  27916. defaultActive: 0,
  27917. isrender: 1
  27918. },
  27919. {
  27920. iconId: "hd",
  27921. part: "right",
  27922. defaultActive: 0,
  27923. isrender: 0
  27924. },
  27925. {
  27926. iconId: "webExpend",
  27927. part: "right",
  27928. defaultActive: 0,
  27929. isrender: 1
  27930. },
  27931. {
  27932. iconId: "expend",
  27933. part: "right",
  27934. defaultActive: 0,
  27935. isrender: 1
  27936. }
  27937. ]
  27938. }
  27939. };
  27940. var pcRecFullDataData = {
  27941. data: data
  27942. };
  27943. var officeTemplateList = [{
  27944. autoFocus: 5,
  27945. createTime: '2021-06-14T08:04:37.000Z',
  27946. themeId: 'pcLive',
  27947. themeIntro: 'PC直播全量版',
  27948. themeName: 'PC直播全量版',
  27949. themeType: 'webLive',
  27950. updateTime: '2021-06-14T08:04:37.000Z',
  27951. label: '官方',
  27952. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
  27953. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  27954. header: pcLiveFullData.data.header,
  27955. footer: pcLiveFullData.data.footer
  27956. }, {
  27957. autoFocus: 5,
  27958. createTime: '2021-06-14T08:04:37.000Z',
  27959. themeId: 'security',
  27960. themeIntro: 'PC直播安防版',
  27961. themeName: 'PC直播安防版',
  27962. themeType: 'webLive',
  27963. updateTime: '2021-06-14T08:04:37.000Z',
  27964. label: '官方',
  27965. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
  27966. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  27967. header: pcLiveSecurityData.data.header,
  27968. footer: pcLiveSecurityData.data.footer
  27969. }, {
  27970. autoFocus: 5,
  27971. createTime: '2021-06-14T08:04:37.000Z',
  27972. themeId: 'voice',
  27973. themeIntro: 'PC直播语音版',
  27974. themeName: 'PC直播语音版',
  27975. themeType: 'webLive',
  27976. updateTime: '2021-06-14T08:04:37.000Z',
  27977. label: '官方',
  27978. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
  27979. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  27980. header: pcLiveVoiceData.data.header,
  27981. footer: pcLiveVoiceData.data.footer
  27982. }, {
  27983. autoFocus: 5,
  27984. createTime: '2021-06-14T08:04:37.000Z',
  27985. themeId: 'simple',
  27986. themeIntro: 'PC直播极简版',
  27987. themeName: 'PC直播极简版',
  27988. themeType: 'webLive',
  27989. updateTime: '2021-06-14T08:04:37.000Z',
  27990. label: '官方',
  27991. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
  27992. poster: "",
  27993. header: pcLiveSimpleData.data.header,
  27994. footer: pcLiveSimpleData.data.footer
  27995. }, {
  27996. autoFocus: 5,
  27997. createTime: '2021-06-14T08:04:37.000Z',
  27998. themeId: 'pcRec',
  27999. themeIntro: 'PC回放全量版',
  28000. themeName: 'PC回放全量版',
  28001. themeType: 'webRec',
  28002. updateTime: '2021-06-14T08:04:37.000Z',
  28003. label: '官方',
  28004. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
  28005. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  28006. header: pcRecFullDataData.data.header,
  28007. footer: pcRecFullDataData.data.footer
  28008. }, {
  28009. autoFocus: 5,
  28010. createTime: '2021-06-14T08:04:37.000Z',
  28011. themeId: 'mobileLive',
  28012. themeIntro: 'Mobile直播全量版',
  28013. themeName: 'Mobile直播全量版',
  28014. themeType: 'mobileLive',
  28015. updateTime: '2021-06-14T08:04:37.000Z',
  28016. label: '官方',
  28017. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",
  28018. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  28019. header: mobileLiveFullData.data.header,
  28020. footer: mobileLiveFullData.data.footer
  28021. }, {
  28022. autoFocus: 5,
  28023. createTime: '2021-06-14T08:04:37.000Z',
  28024. themeId: 'mobileRec',
  28025. themeIntro: 'Mobile回放全量版',
  28026. themeName: 'Mobile回放全量版',
  28027. themeType: 'mobileRec',
  28028. updateTime: '2021-06-14T08:04:37.000Z',
  28029. label: '官方',
  28030. labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",
  28031. poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
  28032. header: mobileRecFullData.data.header,
  28033. footer: mobileRecFullData.data.footer
  28034. }];
  28035. var Zoom = /*#__PURE__*/function () {
  28036. function Zoom(jSPlugin) {
  28037. var _this = this;
  28038. _classCallCheck$1(this, Zoom);
  28039. this.jSPlugin = jSPlugin;
  28040. this.enableZoom = false;
  28041. this.isMouseDown = false, this.videoWidth = 1920;
  28042. this.videoHeight = 1080;
  28043. this.currentScale = 1;
  28044. this.currentPosition = {
  28045. x: 0,
  28046. //操作点 -x
  28047. y: 0,
  28048. //
  28049. xPercent: 0.10,
  28050. // 百分比 -x
  28051. yPercent: 0.10,
  28052. // 百分比
  28053. xCurrentVideo: 0,
  28054. // 当前放大后可视视频左上角起点
  28055. yCurrentVideo: 0,
  28056. left: 0,
  28057. top: 0,
  28058. right: 1920,
  28059. bottom: 1080
  28060. };
  28061. this.DOM = document.getElementById(jSPlugin.id);
  28062. this.clientRect = document.getElementById(jSPlugin.id).getBoundingClientRect();
  28063. //audioControls-left
  28064. var scaleDOMContainer = document.createElement('div');
  28065. scaleDOMContainer.id = "".concat(jSPlugin.id, "-zoom-container");
  28066. scaleDOMContainer.style = "position: absolute;\n display:none;\n left: 12px;\n bottom: 80px;";
  28067. var scaleDOMHTML = "\n <div\n style=\"display: inline-flex;flex-direction: column;width: 38px;height: 160px;background:rgba(0,0,0,0.60);border-radius: 8px;align-items: center;\">\n <div id=\"".concat(this.jSPlugin.id, "-scale-value\" style=\"font-size: 12px;color:#FFFFFF;margin-top:10px;margin-bottom:4px;\">2.0X</div>\n <div style=\"width: 24px;\" id=\"").concat(this.jSPlugin.id, "-addScale\">\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <svg version=\"1.1\" fill=\"#FFFFFF\" id=\"\u56FE\u5C42_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n viewBox=\"0 0 20 20\" style=\"enable-background:new 0 0 20 20;\" xml:space=\"preserve\">\n <title>\u653E\u5927</title>\n <g id=\"\u77E9\u5F62\">\n <rect class=\"st0\" width=\"20\" height=\"20\" fill=\"none\"/>\n </g>\n <g id=\"\u5F62\u72B6\u7ED3\u5408\">\n <path class=\"st1\" d=\"M10,3.8c3.5,0,6.2,2.8,6.2,6.2s-2.8,6.2-6.2,6.2S3.8,13.5,3.8,10S6.5,3.8,10,3.8z M10,5c-2.8,0-5,2.2-5,5\n s2.2,5,5,5s5-2.2,5-5S12.8,5,10,5z\"/>\n </g>\n <g id=\"\u8DEF\u5F84-4\">\n <path class=\"st2\" d=\"M12.5,10.7h-5c-0.3,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h5c0.3,0,0.6,0.3,0.6,0.6S12.8,10.7,12.5,10.7z\"/>\n </g>\n <g id=\"\u8DEF\u5F84-4\u5907\u4EFD\">\n <path class=\"st2\" d=\"M10,13.2c-0.3,0-0.6-0.3-0.6-0.6v-5c0-0.3,0.3-0.6,0.6-0.6s0.6,0.3,0.6,0.6v5C10.6,12.9,10.3,13.2,10,13.2z\"/>\n </g>\n </svg>\n </div>\n <div style=\"\n position: relative;\n width: 1px;\n height: 64px;\n border: 1px solid rgba(255,255,255,0.75);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-end;\">\n <div class=\"scale-body-line-dot\" id=\"").concat(this.jSPlugin.id, "-scale-body-line-dot\" style=\"width: 8px;\n height: 8px;\n background: #FFFFFF;\n border-radius: 100%;\n position: absolute;\n border: 1.5px solid rgba(64,122,255,1);\"></div>\n <div id=\"").concat(this.jSPlugin.id, "-line-dot\" style=\"width: 1px;\n height: 0%;\n background: #1890FF;\n bottom: 0;\"></div>\n </div>\n <div style=\"width: 24px;margin-top: 6px;\" id=\"").concat(this.jSPlugin.id, "-subScale\">\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <svg fill=\"#FFFFFF\" version=\"1.1\" id=\"\u56FE\u5C42_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n viewBox=\"0 0 20 20\" style=\"enable-background:new 0 0 20 20;\" xml:space=\"preserve\">\n <title>\u7F29\u5C0F</title>\n <g id=\"\u77E9\u5F62\">\n <rect class=\"st0\" width=\"20\" height=\"20\" fill=\"none\"/>\n </g>\n <g id=\"\u5F62\u72B6\u7ED3\u5408\">\n <path class=\"st1\" d=\"M10,3.8c3.5,0,6.2,2.8,6.2,6.2s-2.8,6.2-6.2,6.2S3.8,13.5,3.8,10S6.5,3.8,10,3.8z M10,5c-2.8,0-5,2.2-5,5\n s2.2,5,5,5s5-2.2,5-5S12.8,5,10,5z\"/>\n </g>\n <g id=\"\u8DEF\u5F84-4\">\n <path class=\"st2\" d=\"M12.5,10.7h-5c-0.3,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h5c0.3,0,0.6,0.3,0.6,0.6S12.8,10.7,12.5,10.7z\"/>\n </g>\n </svg>\n </div>\n </div>\n ");
  28068. scaleDOMContainer.innerHTML = scaleDOMHTML;
  28069. document.getElementById("".concat(jSPlugin.id, "-audioControls-left")).parentNode.appendChild(scaleDOMContainer);
  28070. document.getElementById("".concat(jSPlugin.id, "-addScale")).onclick = function () {
  28071. _this.addScale();
  28072. };
  28073. document.getElementById("".concat(jSPlugin.id, "-subScale")).onclick = function () {
  28074. _this.subScale();
  28075. };
  28076. // document.getElementById("video-container").addEventListener("mouseenter",(event)=> {
  28077. // console.log("鼠标进入", event);
  28078. // });
  28079. }
  28080. _createClass$1(Zoom, [{
  28081. key: "onMouseDown",
  28082. value: function onMouseDown(event) {
  28083. this.currentPosition;
  28084. this.currentScale;
  28085. var enableZoom = this.enableZoom;
  28086. if (!enableZoom) {
  28087. return false;
  28088. }
  28089. this.moveX = event.clientX;
  28090. this.moveY = event.clientY;
  28091. this.isMouseDown = true;
  28092. }
  28093. }, {
  28094. key: "onMouseUp",
  28095. value: function onMouseUp(event) {
  28096. var currentPosition = this.currentPosition,
  28097. enableZoom = this.enableZoom;
  28098. if (!enableZoom) {
  28099. return false;
  28100. }
  28101. this.isMouseDown = false;
  28102. currentPosition.left = currentPosition.left - (event.clientX - this.moveX);
  28103. currentPosition.top = currentPosition.top - (event.clientY - this.moveY);
  28104. this.doScale();
  28105. }
  28106. }, {
  28107. key: "onMouseOut",
  28108. value: function onMouseOut(event) {
  28109. var enableZoom = this.enableZoom;
  28110. if (!enableZoom) {
  28111. return false;
  28112. }
  28113. if (this.isMouseDown) {
  28114. console.log("鼠标按上", event);
  28115. this.isMouseDown = false;
  28116. }
  28117. this.isMouseDown = false;
  28118. }
  28119. }, {
  28120. key: "renderDot",
  28121. value: function renderDot() {
  28122. var currentScale = this.currentScale;
  28123. document.getElementById("".concat(this.jSPlugin.id, "-scale-value")).innerHTML = "".concat(currentScale, ".0X");
  28124. document.getElementById("".concat(this.jSPlugin.id, "-line-dot")).style.height = "".concat((currentScale - 1) / 7 * 100, "%");
  28125. document.getElementById("".concat(this.jSPlugin.id, "-scale-body-line-dot")).style.bottom = "calc(".concat((currentScale - 1) / 7 * 100, "% - 6px)");
  28126. }
  28127. }, {
  28128. key: "startZoom",
  28129. value: function startZoom() {
  28130. var _this2 = this;
  28131. var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
  28132. this.videoWidth = info.width;
  28133. this.videoHeight = info.height;
  28134. this.currentPosition.right = info.width;
  28135. this.currentPosition.bottom = info.height;
  28136. this.currentScale = 1;
  28137. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "block";
  28138. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
  28139. this.renderDot();
  28140. this.enableZoom = true;
  28141. if (document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0"))) {
  28142. document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mousedown", function (event) {
  28143. return _this2.onMouseDown(event);
  28144. });
  28145. document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mouseup", function (event) {
  28146. return _this2.onMouseUp(event);
  28147. });
  28148. document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mouseout", function (event) {
  28149. return _this2.onMouseOut(event);
  28150. });
  28151. } else if (document.getElementById("".concat(this.jSPlugin.id, "-player"))) {
  28152. document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mousedown", function (event) {
  28153. return _this2.onMouseDown(event);
  28154. });
  28155. document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mouseup", function (event) {
  28156. return _this2.onMouseUp(event);
  28157. });
  28158. document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mouseout", function (event) {
  28159. return _this2.onMouseOut(event);
  28160. });
  28161. }
  28162. }
  28163. }, {
  28164. key: "stopZoom",
  28165. value: function stopZoom() {
  28166. var _this3 = this;
  28167. this.currentScale = 1;
  28168. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
  28169. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
  28170. this.renderDot();
  28171. this.enableZoom = false;
  28172. document.getElementById(this.jSPlugin.id).removeEventListener("mousedown", function (event) {
  28173. return _this3.onMouseDown(event);
  28174. });
  28175. document.getElementById(this.jSPlugin.id).removeEventListener("mouseup", function (event) {
  28176. return _this3.onMouseUp(event);
  28177. });
  28178. document.getElementById(this.jSPlugin.id).removeEventListener("mouseout", function (event) {
  28179. return _this3.onMouseOut(event);
  28180. });
  28181. }
  28182. // scrollFunc(e) {
  28183. // e = e || window.event;
  28184. // if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件
  28185. // if (e.wheelDelta > 0) { //当滑轮向上滚动时
  28186. // this.isScrollOverVideo(e, 'up');
  28187. // }
  28188. // if (e.wheelDelta < 0) { //当滑轮向下滚动时
  28189. // this.isScrollOverVideo(e, 'down');
  28190. // }
  28191. // } else if (e.detail) { //Firefox滑轮事件
  28192. // if (e.detail > 0) { //当滑轮向下滚动时
  28193. // this.isScrollOverVideo(e, 'down');
  28194. // }
  28195. // if (e.detail < 0) { //当滑轮向上滚动时
  28196. // this.isScrollOverVideo(e, 'up');
  28197. // }
  28198. // }
  28199. // }
  28200. // isScrollOverVideo(e, type) {
  28201. // const { clientRect } = this;
  28202. // if (e.clientX > clientRect.x && e.clientX < (clientRect.x + clientRect.width)) {
  28203. // if (e.clientY > clientRect.y && e.clientY < (clientRect.y + clientRect.height)) {
  28204. // if (type == 'up' && currentScale < 8) {
  28205. // this.currentScale++;
  28206. // console.log("当前放大尺度", currentScale)
  28207. // this.calCurrentPosition(e);
  28208. // }
  28209. // if (type == 'down' && currentScale > 1) {
  28210. // this.currentScale--;
  28211. // console.log("当前放大尺度", currentScale)
  28212. // this.calCurrentPosition(e);
  28213. // }
  28214. // return;
  28215. // }
  28216. // }
  28217. // return false
  28218. // }
  28219. }, {
  28220. key: "doScale",
  28221. value: function doScale() {
  28222. console.log("执行放大");
  28223. var currentPosition = this.currentPosition,
  28224. currentScale = this.currentScale;
  28225. currentPosition.left = currentPosition.left + currentPosition.xPercent * (currentPosition.right - currentPosition.left) - 1 / 2 * (this.videoWidth / currentScale);
  28226. if (currentPosition.left < 0) {
  28227. currentPosition.left = 0;
  28228. } else if (currentPosition.left > this.videoWidth - this.videoWidth / currentScale) {
  28229. currentPosition.left = this.videoWidth - this.videoWidth / currentScale;
  28230. }
  28231. currentPosition.right = currentPosition.left + this.videoWidth / currentScale;
  28232. currentPosition.top = currentPosition.top + currentPosition.yPercent * (currentPosition.bottom - currentPosition.top) - 1 / 2 * (this.videoHeight / currentScale);
  28233. if (currentPosition.top < 0) {
  28234. currentPosition.top = 0;
  28235. } else if (currentPosition.top > this.videoHeight - this.videoHeight / currentScale) {
  28236. currentPosition.top = this.videoHeight - this.videoHeight / currentScale;
  28237. }
  28238. currentPosition.bottom = currentPosition.top + this.videoHeight / currentScale;
  28239. //整数化
  28240. currentPosition.left = parseInt(currentPosition.left, 10);
  28241. currentPosition.right = parseInt(currentPosition.right, 10);
  28242. currentPosition.top = parseInt(currentPosition.top, 10);
  28243. currentPosition.bottom = parseInt(currentPosition.bottom, 10);
  28244. console.log("计算后,", this.jSPlugin.jSPlugin, currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom, currentPosition.xPercent, currentPosition.yPercent);
  28245. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom);
  28246. this.renderDot();
  28247. }
  28248. }, {
  28249. key: "calCurrentPosition",
  28250. value: function calCurrentPosition(e) {
  28251. var currentPosition = this.currentPosition,
  28252. clientRect = this.clientRect;
  28253. currentPosition.x = e.clientX;
  28254. currentPosition.y = e.clientY;
  28255. currentPosition.xPercent = (e.clientX - clientRect.x) / clientRect.width;
  28256. currentPosition.yPercent = (e.clientY - clientRect.y) / clientRect.height;
  28257. this.doScale();
  28258. return;
  28259. }
  28260. }, {
  28261. key: "addScale",
  28262. value: function addScale() {
  28263. var currentScale = this.currentScale,
  28264. currentPosition = this.currentPosition;
  28265. if (currentScale >= 8) {
  28266. console.log("达到最大倍率了");
  28267. if (this.jSPlugin.Message) {
  28268. this.jSPlugin.Message["default"]("已经放大到最大倍数8.0X");
  28269. }
  28270. return false;
  28271. }
  28272. this.currentScale++;
  28273. currentPosition.xPercent = 0.5;
  28274. currentPosition.yPercent = 0.5;
  28275. this.doScale();
  28276. }
  28277. }, {
  28278. key: "subScale",
  28279. value: function subScale() {
  28280. var currentScale = this.currentScale,
  28281. currentPosition = this.currentPosition;
  28282. if (currentScale <= 1) {
  28283. console.log("达到最小倍率了");
  28284. return false;
  28285. }
  28286. this.currentScale--;
  28287. currentPosition.xPercent = 0.5;
  28288. currentPosition.yPercent = 0.5;
  28289. this.doScale();
  28290. }
  28291. }]);
  28292. return Zoom;
  28293. }();
  28294. function lineLength(point1, point2) {
  28295. return Math.abs(point2.clientX - point1.clientX) * Math.abs(point2.clientX - point1.clientX) + Math.abs(point2.clientY - point1.clientY) * Math.abs(point2.clientY - point1.clientY);
  28296. }
  28297. var MobileZoom = /*#__PURE__*/function () {
  28298. function MobileZoom(jSPlugin) {
  28299. var _this = this;
  28300. _classCallCheck$1(this, MobileZoom);
  28301. this.jSPlugin = jSPlugin;
  28302. this.enableZoom = false;
  28303. this.isDubboTouch = false, this.videoWidth = 0;
  28304. this.videoHeight = 0;
  28305. this.currentScale = 1;
  28306. this.currentPosition = {
  28307. x: 0,
  28308. //操作点 -x
  28309. y: 0,
  28310. //
  28311. xPercent: 0.10,
  28312. // 百分比 -x
  28313. yPercent: 0.10,
  28314. // 百分比
  28315. xCurrentVideo: 0,
  28316. // 当前放大后可视视频左上角起点
  28317. yCurrentVideo: 0,
  28318. left: 0,
  28319. top: 0,
  28320. right: 1920,
  28321. bottom: 1080
  28322. };
  28323. this.DOM = document.getElementById(jSPlugin.id);
  28324. this.clientRect = document.getElementById(jSPlugin.id).getBoundingClientRect();
  28325. this.point1 = {
  28326. clientX: 0,
  28327. clientY: 0
  28328. };
  28329. this.point2 = {
  28330. clientX: 0,
  28331. clientY: 0
  28332. };
  28333. this.touchLineLength = 0;
  28334. this.inited = false;
  28335. var scaleDOMContainer = document.createElement('div');
  28336. scaleDOMContainer.id = "".concat(jSPlugin.id, "-zoom-container");
  28337. scaleDOMContainer.style = "display:none;\n position: absolute;\n left: 10px;\n top: -30px;\n border: 1px solid rgba(0,0,0,0.6);\n color: #FFFFFF;\n background: rgba(0,0,0,0.6);\n border-radius: 10px;\n width: 36px;\n font-size: 12px;\n text-align: center;\n height: 22px;\n line-height: 22px;";
  28338. var scaleDOMHTML = "1X";
  28339. scaleDOMContainer.innerHTML = scaleDOMHTML;
  28340. document.getElementById("".concat(jSPlugin.id, "-audioControls-left")).parentNode.appendChild(scaleDOMContainer);
  28341. // document.getElementById(this.jSPlugin.id).addEventListener("mousedown",(event)=>this.onMouseDown(event));
  28342. // document.getElementById(this.jSPlugin.id).addEventListener("mouseup",(event)=>this.onMouseUp(event));
  28343. // document.getElementById(this.jSPlugin.id).addEventListener("mouseout",(event)=>this.onMouseOut(event));
  28344. document.getElementById(this.jSPlugin.id).addEventListener("touchstart", function (event) {
  28345. return _this.onTouchstart(event);
  28346. });
  28347. document.getElementById(this.jSPlugin.id).addEventListener("touchmove", function (event) {
  28348. return _this.onTouchmove(event);
  28349. });
  28350. // var info = jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
  28351. // this.videoWidth = info.width;
  28352. // this.videoHeight = info.height;
  28353. // this.currentPosition.right = info.width;
  28354. // this.currentPosition.bottom = info.height;
  28355. }
  28356. _createClass$1(MobileZoom, [{
  28357. key: "onTouchstart",
  28358. value: function onTouchstart(event) {
  28359. //xuehb 开始手机端电子放大前校验回调状态
  28360. var verifyStatus = this.jSPlugin.beforeMobileZoomVerify();
  28361. if (!verifyStatus) {
  28362. return false;
  28363. }
  28364. if (!this.inited) {
  28365. var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
  28366. this.videoWidth = info.width;
  28367. this.videoHeight = info.height;
  28368. this.currentPosition.right = info.width;
  28369. this.currentPosition.bottom = info.height;
  28370. this.inited = true;
  28371. }
  28372. var currentPosition = this.currentPosition;
  28373. this.currentScale;
  28374. console.log("双指按下", currentPosition);
  28375. var touches = event.touches;
  28376. var events = touches[0];
  28377. var events2 = touches[1];
  28378. if (events) {
  28379. this.point1.clientX = events.clientX;
  28380. this.point1.clientY = events.clientY;
  28381. }
  28382. if (events2) {
  28383. this.point2.clientX = events2.clientX;
  28384. this.point2.clientY = events2.clientY;
  28385. this.touchLineLength = lineLength(this.point1, this.point2);
  28386. this.isDubboTouch = true;
  28387. this.moveX = events.clientX;
  28388. this.moveY = events.clientY;
  28389. }
  28390. console.log("双指按下2", currentPosition);
  28391. }
  28392. }, {
  28393. key: "onTouchmove",
  28394. value: function onTouchmove(event) {
  28395. var isDubboTouch = this.isDubboTouch,
  28396. currentPosition = this.currentPosition,
  28397. clientRect = this.clientRect;
  28398. //xuehb 开始手机端电子放大前校验回调状态
  28399. var verifyStatus = this.jSPlugin.beforeMobileZoomVerify();
  28400. if (!verifyStatus) {
  28401. return false;
  28402. }
  28403. // console.log("event.touches.lenght",event.touches.length);
  28404. if (event.touches.length === 1) {
  28405. var events = event.touches[0];
  28406. //console.log("currentPosition.xPercent",event.touches)
  28407. currentPosition.xPercent = currentPosition.xPercent + (this.point1.clientX - events.clientX) / clientRect.width / this.currentScale;
  28408. currentPosition.yPercent = currentPosition.yPercent + (this.point1.clientY - events.clientY) / clientRect.height / this.currentScale;
  28409. this.doScale();
  28410. this.point1.clientX = events.clientX;
  28411. this.point1.clientY = events.clientY;
  28412. return false;
  28413. }
  28414. if (!isDubboTouch) {
  28415. return false;
  28416. }
  28417. var touches = event.touches;
  28418. var events = touches[0];
  28419. var events2 = touches[1];
  28420. if (events) {
  28421. this.point1.clientX = events.clientX;
  28422. this.point1.clientY = events.clientY;
  28423. }
  28424. if (events2) {
  28425. this.point2.clientX = events2.clientX;
  28426. this.point2.clientY = events2.clientY;
  28427. var newtTouchLineLength = lineLength(this.point1, this.point2);
  28428. if (newtTouchLineLength !== this.touchLineLength) {
  28429. if (newtTouchLineLength > this.touchLineLength) {
  28430. if (this.currentScale < 8) {
  28431. ++this.currentScale;
  28432. currentPosition.xPercent = (this.point1.clientX + this.point2.clientX) / 2 / clientRect.width;
  28433. currentPosition.yPercent = (this.point1.clientY + this.point2.clientY) / 2 / clientRect.height;
  28434. this.doScale();
  28435. } else {
  28436. console.log("已经是最大8倍率了");
  28437. }
  28438. } else {
  28439. if (this.currentScale > 1) {
  28440. --this.currentScale;
  28441. currentPosition.xPercent = (this.point1.clientX + this.point2.clientX) / 2 / clientRect.width;
  28442. currentPosition.yPercent = (this.point1.clientY + this.point2.clientY) / 2 / clientRect.height;
  28443. this.doScale();
  28444. } else {
  28445. console.log("已经是最小1倍率了");
  28446. }
  28447. }
  28448. this.isDubboTouch = false;
  28449. }
  28450. }
  28451. }
  28452. }, {
  28453. key: "startZoom",
  28454. value: function startZoom() {
  28455. var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
  28456. this.videoWidth = info.width;
  28457. this.videoHeight = info.height;
  28458. this.currentPosition.right = info.width;
  28459. this.currentPosition.bottom = info.height;
  28460. this.currentScale = 1;
  28461. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "block";
  28462. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
  28463. this.renderDot();
  28464. }
  28465. }, {
  28466. key: "stopZoom",
  28467. value: function stopZoom() {
  28468. this.currentScale = 1;
  28469. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
  28470. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
  28471. this.renderDot();
  28472. }
  28473. //xuehb 重置放大
  28474. }, {
  28475. key: "resetZoom",
  28476. value: function resetZoom() {
  28477. this.currentScale = 1;
  28478. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
  28479. }
  28480. }, {
  28481. key: "doScale",
  28482. value: function doScale() {
  28483. var currentPosition = this.currentPosition,
  28484. currentScale = this.currentScale;
  28485. currentPosition.left = currentPosition.left + currentPosition.xPercent * (currentPosition.right - currentPosition.left) - 1 / 2 * (this.videoWidth / currentScale);
  28486. if (currentPosition.left < 0) {
  28487. currentPosition.left = 0;
  28488. } else if (currentPosition.left > this.videoWidth - this.videoWidth / currentScale) {
  28489. currentPosition.left = this.videoWidth - this.videoWidth / currentScale;
  28490. }
  28491. currentPosition.right = currentPosition.left + this.videoWidth / currentScale;
  28492. currentPosition.top = currentPosition.top + currentPosition.yPercent * (currentPosition.bottom - currentPosition.top) - 1 / 2 * (this.videoHeight / currentScale);
  28493. if (currentPosition.top < 0) {
  28494. currentPosition.top = 0;
  28495. } else if (currentPosition.top > this.videoHeight - this.videoHeight / currentScale) {
  28496. currentPosition.top = this.videoHeight - this.videoHeight / currentScale;
  28497. }
  28498. currentPosition.bottom = currentPosition.top + this.videoHeight / currentScale;
  28499. //整数化
  28500. currentPosition.left = parseInt(currentPosition.left, 10);
  28501. currentPosition.right = parseInt(currentPosition.right, 10);
  28502. currentPosition.top = parseInt(currentPosition.top, 10);
  28503. currentPosition.bottom = parseInt(currentPosition.bottom, 10);
  28504. console.log("视频宽高", this.videoWidth, this.videoHeight);
  28505. console.log("计算后,", currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom, currentPosition.xPercent, currentPosition.yPercent);
  28506. // 注意,和PC
  28507. if (currentPosition.left < currentPosition.right && currentPosition.top < currentPosition.bottom && currentPosition.bottom <= this.videoHeight && currentPosition.right <= this.videoWidth) {
  28508. this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom);
  28509. }
  28510. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).innerHTML = "".concat(currentScale, ".0X");
  28511. document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = currentScale === 1 ? "none" : "inline-block";
  28512. }
  28513. }, {
  28514. key: "calCurrentPosition",
  28515. value: function calCurrentPosition(e) {
  28516. var currentPosition = this.currentPosition,
  28517. clientRect = this.clientRect;
  28518. currentPosition.x = e.clientX;
  28519. currentPosition.y = e.clientY;
  28520. currentPosition.xPercent = (e.clientX - clientRect.x) / clientRect.width;
  28521. currentPosition.yPercent = (e.clientY - clientRect.y) / clientRect.height;
  28522. this.doScale();
  28523. return;
  28524. }
  28525. }]);
  28526. return MobileZoom;
  28527. }();
  28528. var styleToString = function styleToString(obj) {
  28529. var styleString = "";
  28530. Object.keys(obj).map(function (item, index) {
  28531. styleString += "".concat(item, ":").concat(obj[item]).concat(index < Object.keys(obj).length - 1 ? ';' : "");
  28532. });
  28533. return styleString;
  28534. };
  28535. var MEDIAWIDTH = 500;
  28536. var Theme = /*#__PURE__*/function () {
  28537. function Theme(jSPlugin) {
  28538. var _this = this;
  28539. _classCallCheck$1(this, Theme);
  28540. this.jSPlugin = jSPlugin;
  28541. this.isNeedRenderHeader = false;
  28542. this.isNeedRenderFooter = false;
  28543. this.autoFocus = 0;
  28544. this.autoFocusTimer = null;
  28545. this.recordTimer = null;
  28546. this.nextRate = 1;
  28547. this.showHD = false;
  28548. this.themeInited = false;
  28549. this.decoderState = {
  28550. state: {
  28551. isEditing: false,
  28552. play: false,
  28553. sound: false,
  28554. recordvideo: false,
  28555. recordCount: "00:00",
  28556. talk: false,
  28557. zoom: false,
  28558. pantile: false,
  28559. hd: false,
  28560. speed: false,
  28561. expend: false,
  28562. webExpend: false,
  28563. cloudRec: matchEzopenUrl(jSPlugin.url).type === 'cloud.rec',
  28564. rec: matchEzopenUrl(jSPlugin.url).type === 'rec',
  28565. type: matchEzopenUrl(jSPlugin.url).type
  28566. }
  28567. };
  28568. this.pluginStatus = new Status(this, this.jSPlugin.params.id);
  28569. console.log(" matchEzopenUrl(jSPlugin.url)", matchEzopenUrl(jSPlugin.url), this.decoderState.state);
  28570. this.inited = false;
  28571. this.isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
  28572. if (typeof jSPlugin.isMobile !== 'undefined') {
  28573. this.isMobile = jSPlugin.isMobile;
  28574. }
  28575. // 默认主题 - 按钮全部展示
  28576. this.themeData = emptyData.data;
  28577. // 自适应主题数据
  28578. /*
  28579. 移动端 & 直播 =》 mobileLive
  28580. 移动端 & 回放地址 => mobileRec
  28581. PC端 & 直播 =》 pcLive
  28582. PC端 & 回放地址 => pcRec
  28583. */
  28584. if (this.jSPlugin.themeId) {
  28585. switch (this.jSPlugin.themeId) {
  28586. case 'pcLive':
  28587. case 'pcRec':
  28588. case 'mobileLive':
  28589. case 'mobileRec':
  28590. case 'security':
  28591. case 'voice':
  28592. case 'simple':
  28593. var ezuikitTemplateDetail = lodash.find(officeTemplateList, function (item) {
  28594. return item.themeId === _this.jSPlugin.themeId;
  28595. });
  28596. if (ezuikitTemplateDetail) {
  28597. this.themeData = ezuikitTemplateDetail;
  28598. }
  28599. this.initThemeData();
  28600. this.renderThemeData();
  28601. break;
  28602. case 'themeData':
  28603. this.themeData = this.jSPlugin.params.themeData;
  28604. this.initThemeData();
  28605. this.renderThemeData();
  28606. break;
  28607. default:
  28608. this.fetchThemeData(this.jSPlugin.themeId);
  28609. break;
  28610. }
  28611. }
  28612. if (!this.jSPlugin.Talk) {
  28613. this.jSPlugin.Talk = new Talk(this.jSPlugin);
  28614. }
  28615. addCss("".concat(this.jSPlugin.staticPath, "/speed/speed.css"));
  28616. addCss("".concat(this.jSPlugin.staticPath, "/css/theme.css"));
  28617. }
  28618. _createClass$1(Theme, [{
  28619. key: "fetchThemeData",
  28620. value: function fetchThemeData(themeId) {
  28621. var _this2 = this;
  28622. var url = "".concat(this.jSPlugin.env.domain, "/console/jssdk/ezopen/template/getDetail?accessToken=").concat(this.jSPlugin.accessToken, "&id=").concat(themeId);
  28623. if (window.location.hostname === "test11open.ys7.com" || window.location.hostname === "127.0.0.1" || window.location.hostname === "jianboyu.top") {
  28624. url = url.replace("test12open.ys7.com/console/jssdk", "test11open.ys7.com/console/jssdk");
  28625. }
  28626. fetch(url, {
  28627. method: 'GET'
  28628. }).then(function (response) {
  28629. return response.json();
  28630. }).then(function (data) {
  28631. console.log("get theme data", data);
  28632. if (data.meta.code === 0 && data.data) {
  28633. _this2.themeData = data.data;
  28634. if (data.data.header) {
  28635. _this2.themeData.header = data.data.header;
  28636. _this2.themeData.header.btnList = _this2.themeData.header.btnList.sort(function (a, b) {
  28637. return a.btnKey.split("-")[3] - b.btnKey.split("-")[3];
  28638. });
  28639. }
  28640. if (data.data.footer) {
  28641. _this2.themeData.footer = data.data.footer;
  28642. _this2.themeData.footer.btnList = _this2.themeData.footer.btnList.sort(function (a, b) {
  28643. return a.btnKey.split("-")[3] - b.btnKey.split("-")[3];
  28644. });
  28645. }
  28646. _this2.initThemeData();
  28647. _this2.renderThemeData();
  28648. }
  28649. })["catch"](function (error) {
  28650. _this2.renderThemeData();
  28651. });
  28652. }
  28653. }, {
  28654. key: "changeTheme",
  28655. value: function changeTheme(options) {
  28656. var _this3 = this;
  28657. if (typeof options === 'string') {
  28658. this.jSPlugin.themeId = options;
  28659. switch (this.jSPlugin.themeId) {
  28660. case 'pcLive':
  28661. case 'pcRec':
  28662. case 'mobileLive':
  28663. case 'mobileRec':
  28664. case 'security':
  28665. case 'voice':
  28666. case 'simple':
  28667. var ezuikitTemplateDetail = lodash.find(officeTemplateList, function (item) {
  28668. return item.themeId === _this3.jSPlugin.themeId;
  28669. });
  28670. if (ezuikitTemplateDetail) {
  28671. this.themeData = ezuikitTemplateDetail;
  28672. }
  28673. this.initThemeData();
  28674. this.renderThemeData();
  28675. break;
  28676. default:
  28677. this.fetchThemeData(options);
  28678. break;
  28679. }
  28680. } else if (_typeof(options) === 'object') {
  28681. this.themeData = options;
  28682. this.initThemeData();
  28683. this.renderThemeData();
  28684. if (this.decoderState.state.isEditing) {
  28685. this.editStart();
  28686. }
  28687. }
  28688. if (this.jSPlugin && this.jSPlugin.handleThemeChange) {
  28689. this.jSPlugin.handleThemeChange(options);
  28690. }
  28691. }
  28692. }, {
  28693. key: "renderThemeData",
  28694. value: function renderThemeData() {
  28695. var _this4 = this;
  28696. var _this$themeData = this.themeData,
  28697. header = _this$themeData.header,
  28698. footer = _this$themeData.footer;
  28699. if (this.isNeedRenderHeader && header) {
  28700. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.background = header.backgroundColor.replace("-diy", "");
  28701. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.color = header.color.replace("-diy", "");
  28702. header.btnList.map(function (item, index) {
  28703. if (item.isrender) {
  28704. _this4.setDecoderState(_defineProperty({}, item.iconId, _this4.decoderState.state[item.iconId]));
  28705. }
  28706. });
  28707. }
  28708. if (this.isNeedRenderFooter && footer) {
  28709. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.background = footer.backgroundColor.replace("-diy", "");
  28710. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.color = footer.color.replace("-diy", "");
  28711. footer.btnList.map(function (item, index) {
  28712. if (item.isrender) {
  28713. _this4.setDecoderState(_defineProperty({}, item.iconId, _this4.decoderState.state[item.iconId]));
  28714. }
  28715. if (item.iconId === "play" && item.defaultActive && !_this4.themeInited) {
  28716. var checkTimer = setInterval(function () {
  28717. if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
  28718. clearInterval(checkTimer);
  28719. _this4.jSPlugin.play();
  28720. _this4.themeInited = true;
  28721. }
  28722. }, 50);
  28723. }
  28724. });
  28725. // 判断标清高清
  28726. if (this.jSPlugin.url.indexOf("hd.live") !== -1) {
  28727. this.setDecoderState({
  28728. hd: true
  28729. });
  28730. }
  28731. // 判断是否自动隐藏控件
  28732. if (this.themeData.autoFocus > 0) {
  28733. this.autoFocus = parseInt(this.themeData.autoFocus);
  28734. this.startAutoFocus();
  28735. document.getElementById("".concat(this.jSPlugin.id, "-wrap")).addEventListener("click", function () {
  28736. _this4.stopAutoFocus();
  28737. });
  28738. // document.getElementById(`${this.jSPlugin.id}-wrap`).addEventListener("mouseout", ()=>{
  28739. // console.log("开启自动隐藏")
  28740. // this.startAutoFocus();
  28741. // })
  28742. }
  28743. // 设置当前播放类型
  28744. this.setDecoderState({
  28745. cloudRec: matchEzopenUrl(this.jSPlugin.url).type === 'cloud.rec',
  28746. rec: matchEzopenUrl(this.jSPlugin.url).type === 'rec',
  28747. type: matchEzopenUrl(this.jSPlugin.url).type
  28748. });
  28749. } else {
  28750. if (!this.themeInited) {
  28751. var _checkTimer = setInterval(function () {
  28752. if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
  28753. clearInterval(_checkTimer);
  28754. _this4.jSPlugin.play();
  28755. _this4.themeInited = true;
  28756. }
  28757. }, 50);
  28758. }
  28759. }
  28760. var isNeedRoom = lodash.findIndex(this.themeData.footer.btnList, function (v) {
  28761. return v.iconId === 'zoom' && v.isrender > 0;
  28762. }) >= 0;
  28763. if (isNeedRoom) {
  28764. if (this.isMobile) {
  28765. //xuehb 开始手机端电子放大前校验回调,真正可以阻止放大的方法
  28766. this.jSPlugin.beforeMobileZoomVerify = function () {
  28767. //xuehb 播放状态才可以电子放大
  28768. var play = _this4.decoderState.state.play;
  28769. console.log('手机端电子放大前校验回调play------------', play);
  28770. if (!play) {
  28771. return false;
  28772. } else {
  28773. return true;
  28774. }
  28775. };
  28776. this.jSPlugin.Zoom = new MobileZoom(this.jSPlugin);
  28777. } else {
  28778. this.jSPlugin.Zoom = new Zoom(this.jSPlugin);
  28779. }
  28780. }
  28781. var checkTimer = setInterval(function () {
  28782. if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
  28783. clearInterval(checkTimer);
  28784. // 执行一次reSize
  28785. _this4.jSPlugin.reSize(_this4.jSPlugin.params.width, _this4.jSPlugin.params.height);
  28786. }
  28787. }, 50);
  28788. }
  28789. }, {
  28790. key: "setDecoderState",
  28791. value: function setDecoderState(options) {
  28792. var _this5 = this;
  28793. var _this$themeData2 = this.themeData,
  28794. header = _this$themeData2.header,
  28795. footer = _this$themeData2.footer;
  28796. Object.keys(options).map(function (item, index) {
  28797. var color = "#FFFFFF";
  28798. var activeColor = "#FFFFFF";
  28799. var _index = header.btnList.findIndex(function (i) {
  28800. return i.iconId === item;
  28801. });
  28802. if (_index === -1) {
  28803. color = footer.color.replace("-diy", "");
  28804. activeColor = footer.activeColor.replace("-diy", "");
  28805. } else {
  28806. color = header.color.replace("-diy", "");
  28807. // 按钮相关的激活颜色统一使用底部的
  28808. activeColor = footer.activeColor.replace("-diy", "");
  28809. }
  28810. switch (item) {
  28811. case 'play':
  28812. if (options[item]) {
  28813. if (document.getElementById("".concat(_this5.jSPlugin.id, "-play"))) {
  28814. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[0].style = "display:inline-block";
  28815. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[1].style = "display:none";
  28816. document.getElementById("".concat(_this5.jSPlugin.id, "-play")).className = options[item] ? 'active' : '';
  28817. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).childNodes[0].children[0].style.fill = options[item] ? activeColor : color;
  28818. }
  28819. } else {
  28820. if (document.getElementById("".concat(_this5.jSPlugin.id, "-play"))) {
  28821. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[1].style = "display:inline-block";
  28822. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[0].style = "display:none";
  28823. document.getElementById("".concat(_this5.jSPlugin.id, "-play")).className = options[item] ? 'active' : '';
  28824. document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).childNodes[0].children[1].style.fill = options[item] ? activeColor : color;
  28825. }
  28826. }
  28827. break;
  28828. case 'sound':
  28829. if (document.getElementById("".concat(_this5.jSPlugin.id, "-sound"))) {
  28830. if (options[item]) {
  28831. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[1].style = "display:inline-block";
  28832. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[0].style = "display:none";
  28833. document.getElementById("".concat(_this5.jSPlugin.id, "-sound")).className = options[item] ? 'active' : '';
  28834. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).childNodes[0].children[1].style.fill = options[item] ? activeColor : color;
  28835. } else {
  28836. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[0].style = "display:inline-block";
  28837. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[1].style = "display:none";
  28838. document.getElementById("".concat(_this5.jSPlugin.id, "-sound")).className = options[item] ? 'active' : '';
  28839. document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).childNodes[0].children[0].style.fill = options[item] ? activeColor : color;
  28840. }
  28841. }
  28842. break;
  28843. case 'recordvideo':
  28844. if (document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo"))) {
  28845. document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo")).className = options[item] ? 'active' : '';
  28846. document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
  28847. // 定时器处理
  28848. if (options[item]) {
  28849. _this5.countTime('add', 0);
  28850. // this.recordTimer = setInterval(() => {
  28851. // }, 1000);
  28852. } else {
  28853. _this5.countTime('destroy', 0);
  28854. // clearInterval(this.recordTimer);
  28855. }
  28856. }
  28857. break;
  28858. case 'talk':
  28859. if (document.getElementById("".concat(_this5.jSPlugin.id, "-talk"))) {
  28860. document.getElementById("".concat(_this5.jSPlugin.id, "-talk")).className = options[item] ? 'active' : '';
  28861. document.getElementById("".concat(_this5.jSPlugin.id, "-talk-content")).childNodes[1].style.fill = options[item] ? activeColor : color;
  28862. }
  28863. break;
  28864. case 'zoom':
  28865. if (document.getElementById("".concat(_this5.jSPlugin.id, "-zoom"))) {
  28866. document.getElementById("".concat(_this5.jSPlugin.id, "-zoom")).className = options[item] ? 'active' : '';
  28867. document.getElementById("".concat(_this5.jSPlugin.id, "-zoom-content")).childNodes[1].style.fill = options[item] ? activeColor : color;
  28868. }
  28869. break;
  28870. case 'pantile':
  28871. if (document.getElementById("".concat(_this5.jSPlugin.id, "-pantile"))) {
  28872. document.getElementById("".concat(_this5.jSPlugin.id, "-pantile")).className = options[item] ? 'active' : '';
  28873. document.getElementById("".concat(_this5.jSPlugin.id, "-pantile-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
  28874. }
  28875. break;
  28876. case 'webExpend':
  28877. if (options[item]) {
  28878. if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
  28879. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[1].style = "display:inline-block";
  28880. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[0].style = "display:none";
  28881. }
  28882. // 全屏置灰
  28883. if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
  28884. document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = "disabled";
  28885. }
  28886. } else {
  28887. if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
  28888. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[0].style = "display:inline-block";
  28889. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[1].style = "display:none";
  28890. }
  28891. // 全屏置灰
  28892. if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
  28893. document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = "";
  28894. }
  28895. }
  28896. if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
  28897. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = options[item] ? 'active' : '';
  28898. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).childNodes[0].childNodes[0].style.fill = options[item] ? activeColor : color;
  28899. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).childNodes[0].childNodes[1].style.fill = options[item] ? activeColor : color;
  28900. }
  28901. break;
  28902. case 'capturePicture':
  28903. if (document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture"))) {
  28904. document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture")).className = options[item] ? 'active' : '';
  28905. document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
  28906. }
  28907. break;
  28908. case 'expend':
  28909. if (options[item]) {
  28910. if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
  28911. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[1].style = "display:inline-block";
  28912. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[0].style = "display:none";
  28913. }
  28914. // 网站全屏置灰
  28915. if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
  28916. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = "disabled";
  28917. }
  28918. } else {
  28919. if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
  28920. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[0].style = "display:inline-block";
  28921. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[1].style = "display:none";
  28922. }
  28923. // 网站全屏置灰
  28924. if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
  28925. document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = "";
  28926. }
  28927. }
  28928. if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
  28929. document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = options[item] ? 'active' : '';
  28930. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).childNodes[0].childNodes[0].style.fill = options[item] ? activeColor : color;
  28931. document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).childNodes[0].childNodes[1].style.fill = options[item] ? activeColor : color;
  28932. }
  28933. break;
  28934. case 'hd':
  28935. if (options[item]) {
  28936. if (document.getElementById("".concat(_this5.jSPlugin.id, "-hd"))) {
  28937. document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[0].style = "display:block";
  28938. document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[1].style = "display:none";
  28939. }
  28940. } else {
  28941. if (document.getElementById("".concat(_this5.jSPlugin.id, "-hd"))) {
  28942. document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[1].style = "display:block";
  28943. document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[0].style = "display:none";
  28944. }
  28945. }
  28946. break;
  28947. case 'speed':
  28948. if (document.getElementById("".concat(_this5.jSPlugin.id, "-speed"))) {
  28949. document.getElementById("".concat(_this5.jSPlugin.id, "-speed-content")).children[1].children[0].style.color = options[item] ? activeColor : color;
  28950. document.getElementById("".concat(_this5.jSPlugin.id, "-speed-content")).children[1].children[0].style.borderColor = options[item] ? activeColor : color;
  28951. }
  28952. if (document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask"))) {
  28953. if (_this5.isMobile && options[item]) {
  28954. document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask")).style.display = "block";
  28955. } else {
  28956. document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask")).style.display = "none";
  28957. }
  28958. }
  28959. break;
  28960. case 'cloudRec':
  28961. if (document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec"))) {
  28962. console.log("document.getElementById(`${this.jSPlugin.id}-cloudRec-content`)", document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")));
  28963. document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")).className = options[item] ? 'active' : '';
  28964. document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec-content")).children[0].children[0].style.fill = options[item] ? activeColor : color;
  28965. }
  28966. if (document.getElementById("".concat(_this5.jSPlugin.id, "-rec"))) {
  28967. document.getElementById("".concat(_this5.jSPlugin.id, "-rec")).className = options[item] ? 'active' : '';
  28968. document.getElementById("".concat(_this5.jSPlugin.id, "-rec-content")).children[0].children[0].style.fill = options[item] ? color : activeColor;
  28969. }
  28970. break;
  28971. case 'rec':
  28972. if (document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec"))) {
  28973. document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")).className = options[item] ? 'active' : '';
  28974. document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec-content")).children[0].children[0].style.fill = options[item] ? color : activeColor;
  28975. }
  28976. if (document.getElementById("".concat(_this5.jSPlugin.id, "-rec"))) {
  28977. document.getElementById("".concat(_this5.jSPlugin.id, "-rec")).className = options[item] ? 'active' : '';
  28978. document.getElementById("".concat(_this5.jSPlugin.id, "-rec-content")).children[0].children[0].style.fill = options[item] ? activeColor : color;
  28979. }
  28980. break;
  28981. }
  28982. _this5.decoderState.state = Object.assign(_this5.decoderState.state, options);
  28983. });
  28984. }
  28985. }, {
  28986. key: "startAutoFocus",
  28987. value: function startAutoFocus() {
  28988. var _this6 = this;
  28989. //console.log("开始自动隐藏",this.autoFocus);
  28990. var autoFocus = this.autoFocus;
  28991. // if(document.getElementById(`${this.jSPlugin.id}-audioControls`)) {
  28992. if (this.autoFocusTimer) {
  28993. clearTimeout(this.autoFocusTimer);
  28994. }
  28995. this.autoFocusTimer = setTimeout(function () {
  28996. if (document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls"))) {
  28997. document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls")).style.opacity = 0;
  28998. document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls")).style.pointerEvents = 'none';
  28999. }
  29000. }, autoFocus * 1000);
  29001. }
  29002. }, {
  29003. key: "stopAutoFocus",
  29004. value: function stopAutoFocus() {
  29005. //console.log("结束自动隐藏")
  29006. if (document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
  29007. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.opacity = 1;
  29008. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.pointerEvents = 'all';
  29009. }
  29010. if (this.autoFocusTimer) {
  29011. clearTimeout(this.autoFocusTimer);
  29012. }
  29013. this.startAutoFocus();
  29014. }
  29015. }, {
  29016. key: "toString",
  29017. value: function toString() {
  29018. return "".concat(this.coreX, "-").concat(this.coreY);
  29019. }
  29020. }, {
  29021. key: "renderFooter",
  29022. value: function renderFooter(id, part) {
  29023. var _this7 = this;
  29024. // 播放停止
  29025. var objItem = this.matchBtn(id);
  29026. // 移动端不展示电子放大
  29027. if (this.isMobile && objItem.id === "zoom") {
  29028. return false;
  29029. }
  29030. var objDOM = document.createElement('div');
  29031. objDOM.className = "theme-icon-item";
  29032. objDOM.innerHTML = "".concat("<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "\" style=\"position:relative;\">") // +`<span id="${this.jSPlugin.id}-${objItem.id}-left" class="ezuikit-theme-icon" title="左移" style="position: absolute;top: calc(50% - 26px);left: -6px;display: none;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080;"><path d="M7.4,10V5.3c0-0.3-0.3-0.6-0.6-0.6c-0.1,0-0.3,0.1-0.4,0.2L3.7,7.4c-0.2,0.2-0.3,0.6,0,0.8 c0,0,0,0,0.1,0.1l2.7,2.2c0.2,0.2,0.6,0.2,0.8-0.1C7.3,10.3,7.4,10.2,7.4,10z"></path></svg></span>`
  29033. + "<div id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "-content\" title=\"").concat(objItem.title, "\" style=\"height:").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "px;display: flex;align-items: center;position:relative;\">")).concat(objItem.domString, "</div>") // +`<span id="${this.jSPlugin.id}-${objItem.id}-right" class="ezuikit-theme-icon" title="右移" style="position: absolute;top: calc(50% - 26px);left: calc(100% - 0px);display: none;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080"><path d="M3.4,5.2v4.7c0,0.3,0.3,0.6,0.6,0.6c0.1,0,0.3-0.1,0.4-0.2l2.7-2.5c0.2-0.2,0.3-0.6,0-0.8 c0,0,0,0-0.1-0.1L4.4,4.8C4.1,4.6,3.8,4.6,3.6,4.9C3.5,5,3.4,5.1,3.4,5.2z"></path></svg></span>`
  29034. + '</span>';
  29035. objDOM.onclick = function (e) {
  29036. if (_this7.decoderState.state.isEditing) {
  29037. return false;
  29038. }
  29039. objItem.onclick(e);
  29040. };
  29041. if (objItem.onmouseenter) {
  29042. objDOM.onmouseenter = function (e) {
  29043. if (_this7.decoderState.state.isEditing) {
  29044. return false;
  29045. }
  29046. objItem.onmouseenter(e);
  29047. };
  29048. }
  29049. if (objItem.onmouseleave) {
  29050. objDOM.onmouseleave = function (e) {
  29051. if (_this7.decoderState.state.isEditing) {
  29052. return false;
  29053. }
  29054. objItem.onmouseleave(e);
  29055. };
  29056. }
  29057. var toLeft = document.createElement('span');
  29058. toLeft.className = "icon-move left";
  29059. toLeft.innerHTML = "<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "-left\" title=\"\u5DE6\u79FB\" style=\"position: absolute;top: calc(50% - 10px);left: -4px;\"><svg fill=\"#ffffff\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"24\" viewBox=\"0 0 10 15\" style=\"background:#00000080;\"><path d=\"M7.4,10V5.3c0-0.3-0.3-0.6-0.6-0.6c-0.1,0-0.3,0.1-0.4,0.2L3.7,7.4c-0.2,0.2-0.3,0.6,0,0.8 c0,0,0,0,0.1,0.1l2.7,2.2c0.2,0.2,0.6,0.2,0.8-0.1C7.3,10.3,7.4,10.2,7.4,10z\"></path></svg></span>");
  29060. toLeft.onclick = function () {
  29061. _this7.editIcon(objItem.id, 'left', 'footer');
  29062. };
  29063. objDOM.appendChild(toLeft);
  29064. var toRight = document.createElement('span');
  29065. toRight.className = "icon-move right";
  29066. toRight.innerHTML = "<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "-right\" class=\"ezuikit-theme-icon\" title=\"\u53F3\u79FB\" style=\"position: absolute;top: calc(50% - 10px);left: calc(100% - 8px);\"><svg fill=\"#ffffff\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"24\" viewBox=\"0 0 10 15\" style=\"background:#00000080\"><path d=\"M3.4,5.2v4.7c0,0.3,0.3,0.6,0.6,0.6c0.1,0,0.3-0.1,0.4-0.2l2.7-2.5c0.2-0.2,0.3-0.6,0-0.8 c0,0,0,0-0.1-0.1L4.4,4.8C4.1,4.6,3.8,4.6,3.6,4.9C3.5,5,3.4,5.1,3.4,5.2z\"></path></svg></span>");
  29067. toRight.onclick = function () {
  29068. _this7.editIcon(objItem.id, 'right', 'footer');
  29069. };
  29070. objDOM.appendChild(toRight);
  29071. var toClose = document.createElement('span');
  29072. toClose.className = "icon-move close";
  29073. toClose.innerHTML = "<span id=\"".concat(objItem.id, "-remove\" class=\"ezuikit-theme-icon\" title=\"\u79FB\u9664\" style=\"position: absolute;top: -10px;right: -10px;\">") + '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 15 15">' + '<circle style="fill-rule:evenodd;clip-rule:evenodd;fill-opacity:0.8011;" cx="7.5" cy="7.6" r="7" />' + '<rect x="3.9" y="3.5" class="st1" style="fill:none;" width="8.1" height="8.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="5" x2="10" y2="10.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="10.1" x2="10" y2="5" />' + '</svg>' + '</span>';
  29074. toClose.onclick = function () {
  29075. _this7.editIcon(objItem.id, 'delete', 'footer');
  29076. };
  29077. objDOM.appendChild(toClose);
  29078. if (part === 'left') {
  29079. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).childNodes[0].appendChild(objDOM);
  29080. } else {
  29081. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).childNodes[1].appendChild(objDOM);
  29082. }
  29083. // 截图
  29084. }
  29085. }, {
  29086. key: "editIcon",
  29087. value: function editIcon(id, type, area) {
  29088. console.log("编辑组件", id, type, area);
  29089. var newThemeData = this.themeData;
  29090. console.log("themeData", this.themeData);
  29091. var btnList = this.themeData[area].btnList;
  29092. var _index = lodash.findIndex(btnList, function (item) {
  29093. return item.iconId === id;
  29094. });
  29095. var tmp = btnList[_index];
  29096. switch (type) {
  29097. case 'delete':
  29098. // btnList.splice(_index, 1);
  29099. // 限制回放必须选中一种介质
  29100. if (id === "rec") {
  29101. if (lodash.findIndex(btnList, function (item) {
  29102. return item.iconId === "cloudRec" && item.isrender == 1;
  29103. }) === -1) {
  29104. if (this.jSPlugin.Message) {
  29105. this.jSPlugin.Message["default"]("必须选中一种存储介质");
  29106. }
  29107. return false;
  29108. }
  29109. } else if (id === "cloudRec") {
  29110. if (lodash.findIndex(btnList, function (item) {
  29111. return item.iconId === "rec" && item.isrender == 1;
  29112. }) === -1) {
  29113. if (this.jSPlugin.Message) {
  29114. this.jSPlugin.Message["default"]("必须选中一种存储介质");
  29115. }
  29116. return false;
  29117. }
  29118. }
  29119. btnList[_index].isrender = 0;
  29120. break;
  29121. case 'right':
  29122. var nextRightBtnIndex = -1;
  29123. for (var i = _index + 1; i < btnList.length; i++) {
  29124. if (btnList[i].part === btnList[_index].part && btnList[i].isrender == 1) {
  29125. nextRightBtnIndex = i;
  29126. break;
  29127. }
  29128. }
  29129. if (nextRightBtnIndex !== -1) {
  29130. btnList[_index] = btnList[nextRightBtnIndex];
  29131. btnList[nextRightBtnIndex] = tmp;
  29132. }
  29133. break;
  29134. case 'left':
  29135. var nextLeftBtnIndex = -1;
  29136. for (var _i = _index - 1; _i >= 0; _i--) {
  29137. if (btnList[_i].part === btnList[_index].part && btnList[_i].isrender == 1) {
  29138. nextLeftBtnIndex = _i;
  29139. break;
  29140. }
  29141. }
  29142. if (nextLeftBtnIndex !== -1) {
  29143. btnList[_index] = btnList[nextLeftBtnIndex];
  29144. btnList[nextLeftBtnIndex] = tmp;
  29145. }
  29146. break;
  29147. }
  29148. console.log("new btnList", btnList);
  29149. newThemeData[area].btnList = btnList;
  29150. //this.renderThemeData();
  29151. this.changeTheme(newThemeData);
  29152. }
  29153. }, {
  29154. key: "renderHeader",
  29155. value: function renderHeader(id, part) {
  29156. var _this8 = this;
  29157. // 播放停止
  29158. var objItem = this.matchBtn(id);
  29159. var objDOM = document.createElement('div');
  29160. objDOM.className = "theme-icon-item";
  29161. objDOM.style = "max-width:50%;";
  29162. objDOM.innerHTML = "".concat("<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "\" style=\"position:relative;\";>") // +`<span id="${this.jSPlugin.id}-${objItem.id}-left" title="左移" style="position: absolute;top: calc(50% - 10px);left: -6px;display: none;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080;"><path d="M7.4,10V5.3c0-0.3-0.3-0.6-0.6-0.6c-0.1,0-0.3,0.1-0.4,0.2L3.7,7.4c-0.2,0.2-0.3,0.6,0,0.8 c0,0,0,0,0.1,0.1l2.7,2.2c0.2,0.2,0.6,0.2,0.8-0.1C7.3,10.3,7.4,10.2,7.4,10z"></path></svg></span>`
  29163. + "<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "-content\" title=\"").concat(objItem.title, "\" style=\"display:inline-block;height:").concat(this.width > MEDIAWIDTH ? 48 : 32, "px;\">")).concat(objItem.domString, "</span>") //+`<span id="${this.jSPlugin.id}-${objItem.id}-right" title="右移" style="position: absolute;top: calc(50% - 10px);left: calc(100% - 6px);display: none;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080"><path d="M3.4,5.2v4.7c0,0.3,0.3,0.6,0.6,0.6c0.1,0,0.3-0.1,0.4-0.2l2.7-2.5c0.2-0.2,0.3-0.6,0-0.8 c0,0,0,0-0.1-0.1L4.4,4.8C4.1,4.6,3.8,4.6,3.6,4.9C3.5,5,3.4,5.1,3.4,5.2z"></path></svg></span>`
  29164. + "<span id=\"".concat(this.jSPlugin.id, "-").concat(objItem.id, "-remove\" title=\"\u79FB\u9664\" style=\"position: absolute;top: -6px;left: 38px;display: none;\">") + '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 15 15">' + '<circle style="fill-rule:evenodd;clip-rule:evenodd;fill-opacity:0.8011;" cx="7.5" cy="7.6" r="7" />' + '<rect x="3.9" y="3.5" class="st1" style="fill:none;" width="8.1" height="8.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="5" x2="10" y2="10.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="10.1" x2="10" y2="5" />' + '</svg>' + '</span>' + '</span>';
  29165. // var toLeft = document.createElement('span');
  29166. // toLeft.innerHTML = +`<span id="${this.jSPlugin.id}-${objItem.id}-left" title="左移" style="position: absolute;top: calc(50% - 10px);left: -6px;display: none;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080;"><path d="M7.4,10V5.3c0-0.3-0.3-0.6-0.6-0.6c-0.1,0-0.3,0.1-0.4,0.2L3.7,7.4c-0.2,0.2-0.3,0.6,0,0.8 c0,0,0,0,0.1,0.1l2.7,2.2c0.2,0.2,0.6,0.2,0.8-0.1C7.3,10.3,7.4,10.2,7.4,10z"></path></svg></span>`;
  29167. // toLeft.onclick = () => {console.log("左移动")};
  29168. objDOM.onclick = function (e) {
  29169. if (_this8.decoderState.state.isEditing) {
  29170. return false;
  29171. }
  29172. objItem.onclick(e);
  29173. };
  29174. // var toLeft = document.createElement('span');
  29175. // toLeft.className = "icon-move left";
  29176. // toLeft.innerHTML = `<span id="${this.jSPlugin.id}-${objItem.id}-left" title="左移" style="position: absolute;top: calc(50% - 10px);left: -4px;"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080;"><path d="M7.4,10V5.3c0-0.3-0.3-0.6-0.6-0.6c-0.1,0-0.3,0.1-0.4,0.2L3.7,7.4c-0.2,0.2-0.3,0.6,0,0.8 c0,0,0,0,0.1,0.1l2.7,2.2c0.2,0.2,0.6,0.2,0.8-0.1C7.3,10.3,7.4,10.2,7.4,10z"></path></svg></span>`;
  29177. // toLeft.onclick = () => {this.editIcon(objItem.id,'left','header')};
  29178. // objDOM.appendChild(toLeft);
  29179. // var toRight = document.createElement('span');
  29180. // toRight.className = "icon-move right";
  29181. // toRight.innerHTML = `<span id="${this.jSPlugin.id}-${objItem.id}-right" class="ezuikit-theme-icon" title="右移" style="position: absolute;top: calc(50% - 10px);left: calc(100% - 8px);"><svg fill="#ffffff" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 10 15" style="background:#00000080"><path d="M3.4,5.2v4.7c0,0.3,0.3,0.6,0.6,0.6c0.1,0,0.3-0.1,0.4-0.2l2.7-2.5c0.2-0.2,0.3-0.6,0-0.8 c0,0,0,0-0.1-0.1L4.4,4.8C4.1,4.6,3.8,4.6,3.6,4.9C3.5,5,3.4,5.1,3.4,5.2z"></path></svg></span>`;
  29182. // toRight.onclick = () => {this.editIcon(objItem.id,'right','header')};
  29183. // objDOM.appendChild(toRight);
  29184. var toClose = document.createElement('span');
  29185. toClose.className = "icon-move close";
  29186. toClose.innerHTML = "<span id=\"".concat(objItem.id, "-remove\" class=\"ezuikit-theme-icon\" title=\"\u79FB\u9664\" style=\"position: absolute;top: -6px;right: -6px;\">") + '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 15 15">' + '<circle style="fill-rule:evenodd;clip-rule:evenodd;fill-opacity:0.8011;" cx="7.5" cy="7.6" r="7" />' + '<rect x="3.9" y="3.5" class="st1" style="fill:none;" width="8.1" height="8.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="5" x2="10" y2="10.1" />' + '<line style="fill:none;stroke:#ffffff;stroke-width:0.5833;stroke-linecap:round;" x1="4.9" y1="10.1" x2="10" y2="5" />' + '</svg>' + '</span>';
  29187. toClose.onclick = function () {
  29188. _this8.editIcon(objItem.id, 'delete', 'header');
  29189. };
  29190. objDOM.appendChild(toClose);
  29191. // objDOM.appendChild(toLeft);
  29192. if (part === 'left') {
  29193. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).childNodes[0].appendChild(objDOM);
  29194. } else {
  29195. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).childNodes[1].appendChild(objDOM);
  29196. }
  29197. }
  29198. }, {
  29199. key: "countTime",
  29200. value: function countTime(type) {
  29201. var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  29202. var that = this;
  29203. if (!document.getElementById(this.jSPlugin.id + "time-area")) {
  29204. var recordDOM = document.createElement("div");
  29205. recordDOM.id = this.jSPlugin.id + "time-area";
  29206. recordDOM.className = "time-area";
  29207. recordDOM.innerHTML = "<span class=\"dot\"></span><span class=\"value\">00:00</span>";
  29208. if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
  29209. document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).appendChild(recordDOM);
  29210. }
  29211. }
  29212. if (this.countTimer) {
  29213. clearInterval(this.countTimer);
  29214. }
  29215. if (type === 'add') {
  29216. var i = start;
  29217. document.getElementById(that.jSPlugin.id + "time-area").style.display = 'flex';
  29218. this.countTimer = setInterval(function () {
  29219. ++i;
  29220. document.getElementById(that.jSPlugin.id + "time-area").children[1].innerHTML = formatSeconds(i);
  29221. }, 1000);
  29222. } else if (type === 'destroy') {
  29223. if (this.countTimer) {
  29224. clearInterval(this.countTimer);
  29225. }
  29226. this.countTimer = undefined;
  29227. if (document.getElementById(that.jSPlugin.id + "time-area")) {
  29228. document.getElementById(that.jSPlugin.id + "time-area").children[1].innerHTML = '00:00';
  29229. document.getElementById(that.jSPlugin.id + "time-area").style.display = 'none';
  29230. }
  29231. }
  29232. //将秒数转换为时分秒格式
  29233. function formatSeconds(value) {
  29234. var theTime = parseInt(value); // 秒
  29235. var middle = 0; // 分
  29236. var hour = 0; // 小时
  29237. var secondV = '00';
  29238. var minV = '00';
  29239. var hourV = '00';
  29240. if (theTime > 59) {
  29241. middle = parseInt(theTime / 60);
  29242. theTime = parseInt(theTime % 60);
  29243. if (middle > 59) {
  29244. hour = parseInt(middle / 60);
  29245. middle = parseInt(middle % 60);
  29246. }
  29247. }
  29248. secondV = parseInt(theTime) > 9 ? parseInt(theTime) : '0' + parseInt(theTime);
  29249. minV = parseInt(middle) > 9 ? parseInt(middle) : '0' + parseInt(middle);
  29250. hourV = parseInt(hour) > 9 ? parseInt(hour) : '0' + parseInt(hour);
  29251. if (hour > 0) {
  29252. return hourV + ':' + minV + ':' + secondV;
  29253. } else if (middle > 0) {
  29254. return minV + ':' + secondV;
  29255. } else {
  29256. return '00:' + secondV;
  29257. }
  29258. }
  29259. }
  29260. }, {
  29261. key: "setDisabled",
  29262. value: function setDisabled(status) {
  29263. var _this$decoderState$st = this.decoderState.state,
  29264. sound = _this$decoderState$st.sound,
  29265. hd = _this$decoderState$st.hd;
  29266. //设置按钮禁止点击状态
  29267. document.getElementById(sound ? "".concat(this.jSPlugin.id, "-sound-icon") : "".concat(this.jSPlugin.id, "-nosound-icon")) != null && document.getElementById(sound ? "".concat(this.jSPlugin.id, "-sound-icon") : "".concat(this.jSPlugin.id, "-nosound-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29268. document.getElementById("".concat(this.jSPlugin.id, "-recordvideo-icon")) != null && document.getElementById("".concat(this.jSPlugin.id, "-recordvideo-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29269. document.getElementById("".concat(this.jSPlugin.id, "-capturePicture-icon")) != null && document.getElementById("".concat(this.jSPlugin.id, "-capturePicture-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29270. document.getElementById("".concat(this.jSPlugin.id, "-talk-icon")) != null && document.getElementById("".concat(this.jSPlugin.id, "-talk-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29271. document.getElementById("".concat(this.jSPlugin.id, "-zoom-icon")) != null && document.getElementById("".concat(this.jSPlugin.id, "-zoom-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29272. document.getElementById("".concat(this.jSPlugin.id, "-pantile-icon")) != null && document.getElementById("".concat(this.jSPlugin.id, "-pantile-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29273. // document.getElementById(`${this.jSPlugin.id}-expend-icon`).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29274. // document.getElementById(`${this.jSPlugin.id}-webExpend-icon`).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29275. document.getElementById(hd ? "".concat(this.jSPlugin.id, "-hdSelect-icon") : "".concat(this.jSPlugin.id, "-sdSelect-icon")) != null && document.getElementById(hd ? "".concat(this.jSPlugin.id, "-hdSelect-icon") : "".concat(this.jSPlugin.id, "-sdSelect-icon")).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
  29276. document.getElementById("".concat(this.jSPlugin.id, "-speed-text")) != null && document.getElementById("".concat(this.jSPlugin.id, "-speed-text")).setAttribute('style', document.getElementById("".concat(this.jSPlugin.id, "-speed-text")).getAttribute('style') + ';' + (status ? 'cursor: not-allowed;color: gray;border-color: gray;' : 'cursor: default;color: #ffffff;border-color: #ffffff;'));
  29277. }
  29278. }, {
  29279. key: "matchBtn",
  29280. value: function matchBtn(btnId) {
  29281. var _this9 = this;
  29282. var _this$themeData3 = this.themeData,
  29283. header = _this$themeData3.header,
  29284. footer = _this$themeData3.footer;
  29285. var btnItem = {
  29286. title: "",
  29287. id: "",
  29288. domString: "",
  29289. color: "#FFFFFF",
  29290. activeColor: "#FFFFFF",
  29291. onclick: function onclick() {},
  29292. onmoveleft: function onmoveleft() {},
  29293. onmoveright: function onmoveright() {},
  29294. onremove: function onremove() {}
  29295. };
  29296. var _index = header.btnList.findIndex(function (item) {
  29297. return item.iconId === btnId;
  29298. });
  29299. if (_index === -1) {
  29300. btnItem.color = footer.color;
  29301. btnItem.backgroundColor = footer.backgroundColor;
  29302. btnItem.activeColor = footer.activeColor;
  29303. } else {
  29304. btnItem.color = header.color;
  29305. btnItem.backgroundColor = header.backgroundColor;
  29306. btnItem.activeColor = header.activeColor;
  29307. }
  29308. switch (btnId) {
  29309. case 'play':
  29310. btnItem.title = "播放/结束播放";
  29311. btnItem.id = btnId;
  29312. btnItem.domString = '<div style="height: 100%">' + "<svg id=\"".concat(this.jSPlugin.id + '-play-icon', "\" class=\"theme-icon-item-icon\" style=\"display:none\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" fill=\"").concat(btnItem.color, "\" viewBox=\"-6 -6 32 32\">\n <path id=\"Stroke-1\" class=\"st1\" d=\"M10.5,1.7c-4.9,0-8.8,4-8.8,8.8s4,8.8,8.8,8.8s8.8-4,8.8-8.8S15.4,1.7,10.5,1.7z M10.5,2.7\n c4.3,0,7.8,3.5,7.8,7.8s-3.5,7.8-7.8,7.8s-7.8-3.5-7.8-7.8S6.2,2.7,10.5,2.7z\"/>\n <path class=\"st2\" d=\"M8.7,8C9,8,9.3,8.3,9.3,8.6v3.8C9.3,12.7,9,13,8.7,13C8.3,13,8,12.7,8,12.4V8.6C8,8.3,8.3,8,8.7,8z\"/>\n <path id=\"Rectangle-Copy-10\" class=\"st2\" d=\"M12.8,8c0.3,0,0.6,0.3,0.6,0.6v3.8c0,0.3-0.3,0.6-0.6,0.6c-0.3,0-0.6-0.3-0.6-0.6V8.6\n C12.2,8.3,12.5,8,12.8,8z\"/>\n </svg>") + "<svg id=\"".concat(this.jSPlugin.id + '-stop-icon', "\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M13,9.8L10.1,8C9.9,7.9,9.7,7.9,9.5,7.9c-0.6,0-1,0.4-1,1v3.7c0,0.2,0.1,0.4,0.2,0.5c0.3,0.5,0.9,0.6,1.4,0.3 l2.9-1.8c0.1-0.1,0.2-0.2,0.3-0.3C13.6,10.7,13.4,10.1,13,9.8z" />' + '<path d="M10.5,1.9c-4.9,0-8.8,4-8.8,8.8c0,4.9,4,8.8,8.8,8.8s8.8-4,8.8-8.8C19.4,5.8,15.4,1.9,10.5,1.9z M10.5,18.5 c-4.3,0-7.8-3.5-7.8-7.8s3.5-7.8,7.8-7.8c4.3,0,7.8,3.5,7.8,7.8S14.9,18.5,10.5,18.5z" />' + '</svg>' + '</div>';
  29313. btnItem.onclick = function () {
  29314. var _this9$decoderState$s = _this9.decoderState.state,
  29315. play = _this9$decoderState$s.play,
  29316. isEditing = _this9$decoderState$s.isEditing,
  29317. rec = _this9$decoderState$s.rec,
  29318. cloudRec = _this9$decoderState$s.cloudRec,
  29319. recordvideo = _this9$decoderState$s.recordvideo;
  29320. if (isEditing) {
  29321. return false;
  29322. }
  29323. if (play) {
  29324. if (rec || cloudRec) {
  29325. //回放时调用暂停,而不是结束播放
  29326. _this9.jSPlugin.pause();
  29327. } else {
  29328. _this9.jSPlugin.stop();
  29329. }
  29330. //停止录像并关闭录像计时
  29331. if (recordvideo) {
  29332. // this.jSPlugin.stopSave();
  29333. _this9.setDecoderState({
  29334. recordvideo: false
  29335. });
  29336. }
  29337. _this9.jSPlugin.Zoom.stopZoom();
  29338. } else {
  29339. if (rec || cloudRec) {
  29340. //回放时调用恢复播放状态
  29341. _this9.jSPlugin.resume();
  29342. } else {
  29343. _this9.jSPlugin.play();
  29344. }
  29345. //xuehb 重置手机端电子放大状态
  29346. _this9.resetMobileZoomStatus();
  29347. }
  29348. _this9.setDecoderState({
  29349. zoom: false,
  29350. play: !play
  29351. });
  29352. _this9.setDisabled(play);
  29353. };
  29354. return btnItem;
  29355. case 'sound':
  29356. btnItem.title = "声音";
  29357. btnItem.id = btnId;
  29358. btnItem.domString = '<span style="height: 100%">' + "<svg class=\"theme-icon-item-icon\" id=\"".concat(this.jSPlugin.id, "-nosound-icon\" style=\"display:none\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">\n <path d=\"M8.5,4.2c0.8-0.7,2.1-0.2,2.2,0.9l0,0.1v10c0,1.1-1.2,1.7-2.1,1.1l-0.1-0.1l-3.3-2.8C5,13.2,5,12.9,5.1,12.7 c0.2-0.2,0.4-0.2,0.6-0.1l0.1,0.1l3.3,2.8c0.2,0.2,0.5,0.1,0.5-0.2l0-0.1v-10c0-0.3-0.3-0.4-0.5-0.3L9.2,5L5.9,7.8 C5.6,7.9,5.3,7.9,5.1,7.7C5,7.5,5,7.3,5.1,7.1L5.2,7L8.5,4.2z\"/>\n <path d=\"M5.5,6.9C5.8,6.9,6,7.1,6,7.4c0,0.2-0.2,0.4-0.4,0.5l-0.1,0h-2C3.4,7.9,3.3,8,3.2,8.2l0,0.1v4 c0,0.2,0.1,0.3,0.3,0.3l0.1,0h2C5.8,12.5,6,12.7,6,13c0,0.2-0.2,0.4-0.4,0.5l-0.1,0h-2c-0.7,0-1.3-0.5-1.3-1.2l0-0.1v-4 c0-0.7,0.5-1.3,1.2-1.3l0.1,0H5.5z\"/>\n <path d=\"M17.4,7.9c0.2-0.2,0.5-0.2,0.7,0c0.2,0.2,0.2,0.4,0.1,0.6l-0.1,0.1l-3.8,3.8c-0.2,0.2-0.5,0.2-0.7,0 c-0.2-0.2-0.2-0.4-0.1-0.6l0.1-0.1L17.4,7.9z\"/>\n <path d=\"M13.7,7.9c0.2-0.2,0.4-0.2,0.6-0.1l0.1,0.1l3.8,3.8c0.2,0.2,0.2,0.5,0,0.7c-0.2,0.2-0.4,0.2-0.6,0.1l-0.1-0.1 l-3.7-3.8C13.5,8.4,13.5,8.1,13.7,7.9z\"/>\n </svg>") + "<svg class=\"theme-icon-item-icon\" id=\"".concat(this.jSPlugin.id, "-sound-icon\" style=\"display:inline-block\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" fill=\"").concat(btnItem.color, "\" viewBox=\"-6 -6 32 32\">\n <path d=\"M13.2,7.1c0.1-0.2,0.5-0.3,0.7-0.2c1.1,0.7,1.9,2.2,1.9,3.7c0,1.6-0.7,3-1.9,3.7\n c-0.2,0.1-0.5,0.1-0.7-0.2c-0.1-0.2-0.1-0.5,0.2-0.7c0.8-0.5,1.4-1.6,1.4-2.9c0-1.3-0.6-2.4-1.4-2.9C13.1,7.6,13,7.3,13.2,7.1z\"/>\n <path d=\"M15.7,4.5c0.2-0.2,0.5-0.2,0.7-0.1C18,5.8,19,8.2,19,10.7c0,2.5-1,4.8-2.7,6.3\n c-0.2,0.2-0.5,0.2-0.7-0.1c-0.2-0.2-0.2-0.5,0.1-0.7c1.4-1.2,2.3-3.3,2.3-5.5c0-2.2-0.9-4.3-2.3-5.5C15.5,5,15.5,4.7,15.7,4.5z\"/>\n <path id=\"Stroke-5\" class=\"st1\" d=\"M8.5,4.7c0.8-0.7,2.1-0.2,2.2,0.9l0,0.1v10c0,1.1-1.2,1.7-2.1,1.1l-0.1-0.1l-3.3-2.8\n C5,13.7,5,13.4,5.1,13.2c0.2-0.2,0.4-0.2,0.6-0.1l0.1,0.1l3.3,2.8c0.2,0.2,0.5,0.1,0.5-0.2l0-0.1v-10c0-0.3-0.3-0.4-0.5-0.3l-0.1,0\n L5.9,8.3C5.6,8.4,5.3,8.4,5.1,8.2C5,8,5,7.7,5.1,7.6l0.1-0.1L8.5,4.7z\"/>\n <path d=\"M5.5,7.4C5.8,7.4,6,7.6,6,7.9c0,0.2-0.2,0.4-0.4,0.5l-0.1,0h-2c-0.2,0-0.3,0.1-0.3,0.3l0,0.1v4\n c0,0.2,0.1,0.3,0.3,0.3l0.1,0h2C5.8,13,6,13.2,6,13.5c0,0.2-0.2,0.4-0.4,0.5l-0.1,0h-2c-0.7,0-1.3-0.5-1.3-1.2l0-0.1v-4\n c0-0.7,0.5-1.3,1.2-1.3l0.1,0H5.5z\"/>\n </svg>") + '</span>';
  29359. btnItem.onclick = function () {
  29360. var _this9$decoderState$s2 = _this9.decoderState.state,
  29361. play = _this9$decoderState$s2.play,
  29362. sound = _this9$decoderState$s2.sound,
  29363. talk = _this9$decoderState$s2.talk;
  29364. if (play) {
  29365. if (sound) {
  29366. _this9.jSPlugin.closeSound();
  29367. _this9.setDecoderState({
  29368. sound: false
  29369. });
  29370. } else {
  29371. //xuehb 判断是否打开对讲了,对讲情况下不可以打开声音
  29372. if (!talk) {
  29373. _this9.jSPlugin.openSound();
  29374. _this9.setDecoderState({
  29375. sound: true
  29376. });
  29377. }
  29378. }
  29379. }
  29380. };
  29381. return btnItem;
  29382. case 'recordvideo':
  29383. btnItem.title = "录屏";
  29384. btnItem.id = btnId;
  29385. btnItem.domString = "<svg id=\"".concat(this.jSPlugin.id, "-recordvideo-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M11.6,5.3H4.7c-1.4,0-2.5,1.1-2.5,2.5v5.9c0,1.4,1.1,2.5,2.5,2.5h6.9c1.4,0,2.5-1.1,2.5-2.5V7.7 C14.1,6.4,13,5.3,11.6,5.3z M4.7,6.3h6.9c0.8,0,1.5,0.7,1.5,1.5v5.9c0,0.8-0.7,1.5-1.5,1.5H4.7c-0.8,0-1.5-0.7-1.5-1.5V7.7 C3.3,6.9,3.9,6.3,4.7,6.3z" />' + '<path d="M16.6,6.7c0.9-0.8,2.3-0.1,2.4,1l0,0.1v5.7c0,1.2-1.3,1.9-2.3,1.2l-0.1-0.1L13.3,12 c-0.2-0.2-0.2-0.5-0.1-0.7c0.2-0.2,0.4-0.2,0.6-0.1l0.1,0.1l3.3,2.7c0.3,0.2,0.7,0.1,0.8-0.3l0-0.1V7.8c0-0.4-0.4-0.6-0.7-0.4 l-0.1,0l-3.3,2.7c-0.2,0.2-0.5,0.1-0.7-0.1c-0.2-0.2-0.1-0.5,0-0.6l0.1-0.1L16.6,6.7z" />' + '</svg>';
  29386. btnItem.onclick = function () {
  29387. var _this9$decoderState$s3 = _this9.decoderState.state,
  29388. play = _this9$decoderState$s3.play,
  29389. recordvideo = _this9$decoderState$s3.recordvideo;
  29390. if (play) {
  29391. if (recordvideo) {
  29392. _this9.jSPlugin.stopSave();
  29393. _this9.setDecoderState({
  29394. recordvideo: false
  29395. });
  29396. } else {
  29397. _this9.jSPlugin.startSave("".concat(new Date().getTime()));
  29398. _this9.setDecoderState({
  29399. recordvideo: true
  29400. });
  29401. }
  29402. }
  29403. };
  29404. return btnItem;
  29405. case 'capturePicture':
  29406. btnItem.title = "截图";
  29407. btnItem.id = btnId;
  29408. btnItem.domString = "<svg id=\"".concat(this.jSPlugin.id, "-capturePicture-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M10.8,7.7c-2,0-3.7,1.6-3.7,3.7S8.7,15,10.8,15c2,0,3.7-1.6,3.7-3.7S12.8,7.7,10.8,7.7z M10.8,8.7c1.5,0,2.7,1.2,2.7,2.7S12.2,14,10.8,14c-1.5,0-2.7-1.2-2.7-2.7S9.3,8.7,10.8,8.7z" />' + '<path d="M8.6,3.7l-0.1,0C8,3.7,7.7,4,7.5,4.3l-1,1.7l-1.3,0C4,6.1,3.1,7,3.1,8.2v7.1 c0,1.2,0.9,2.1,2.1,2.1h11.1c1.2,0,2.1-0.9,2.1-2.1V8.2l0-0.1c-0.1-1.1-1-1.9-2.1-1.9l-1.3,0l-1.1-1.8c-0.2-0.4-0.7-0.6-1.1-0.6H8.6 z M8.6,4.7h4.2c0.1,0,0.2,0.1,0.3,0.1l1.2,2c0.1,0.2,0.3,0.2,0.4,0.2h1.6c0.6,0,1.1,0.5,1.1,1.1v7.1c0,0.6-0.5,1.1-1.1,1.1H5.1 c-0.6,0-1.1-0.5-1.1-1.1V8.2c0-0.6,0.5-1.1,1.1-1.1h1.6c0.2,0,0.3-0.1,0.4-0.2l1.2-2C8.4,4.7,8.5,4.7,8.6,4.7z" />' + '</svg>';
  29409. btnItem.onclick = function () {
  29410. var play = _this9.decoderState.state.play;
  29411. if (play) {
  29412. _this9.jSPlugin.capturePicture("".concat(new Date().getTime()));
  29413. } else {
  29414. console.log("视频未播放,无法截图");
  29415. }
  29416. };
  29417. return btnItem;
  29418. case 'talk':
  29419. btnItem.title = "对讲";
  29420. btnItem.id = btnId;
  29421. btnItem.domString = '<div></div>' + "<svg id=\"".concat(this.jSPlugin.id, "-talk-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M10.1,2.7C8.5,2.7,7.2,4,7.2,5.6v5.2c0,1.6,1.3,2.9,2.9,2.9l0.2,0c1.5-0.1,2.7-1.4,2.7-2.9V5.6 C13,4,11.7,2.7,10.1,2.7z M10.1,3.7c1.1,0,1.9,0.9,1.9,1.9v5.2c0,1-0.8,1.8-1.8,1.9l-0.1,0c-1,0-1.9-0.9-1.9-1.9V5.6 C8.2,4.5,9,3.7,10.1,3.7z" />' + '<path d="M15.1,8.5c0.2,0,0.4,0.2,0.5,0.4l0,0.1v1.7c0,3-2.5,5.5-5.5,5.5c-3,0-5.4-2.3-5.5-5.3l0-0.2V9 c0-0.3,0.2-0.5,0.5-0.5c0.2,0,0.4,0.2,0.5,0.4l0,0.1v1.7c0,2.5,2,4.5,4.5,4.5c2.4,0,4.4-1.9,4.5-4.3l0-0.2V9 C14.6,8.7,14.8,8.5,15.1,8.5z" />' + '<path d="M13.5,17.7c0.3,0,0.5,0.2,0.5,0.5c0,0.2-0.2,0.4-0.4,0.5l-0.1,0h-7c-0.3,0-0.5-0.2-0.5-0.5 c0-0.2,0.2-0.4,0.4-0.5l0.1,0H13.5z" />' + '<path d="M10.1,15.2c0.2,0,0.4,0.2,0.5,0.4l0,0.1v2.5c0,0.3-0.2,0.5-0.5,0.5c-0.2,0-0.4-0.2-0.5-0.4l0-0.1 v-2.5C9.6,15.4,9.8,15.2,10.1,15.2z" />' + '</svg>';
  29422. btnItem.onclick = function () {
  29423. var _this9$decoderState$s4 = _this9.decoderState.state,
  29424. talk = _this9$decoderState$s4.talk,
  29425. sound = _this9$decoderState$s4.sound,
  29426. play = _this9$decoderState$s4.play;
  29427. if (play) {
  29428. if (talk) {
  29429. console.log('结束对讲');
  29430. _this9.setDecoderState({
  29431. talk: false
  29432. });
  29433. _this9.jSPlugin.Talk.stopTalk();
  29434. var isReOpenSound = lodash.findIndex(_this9.themeData.footer.btnList, function (v) {
  29435. return v.iconId === 'sound' && v.isrender === 1 && v.defaultActive === 1;
  29436. }) > -1;
  29437. if (_this9.themeData && isReOpenSound) {
  29438. _this9.jSPlugin.openSound();
  29439. _this9.setDecoderState({
  29440. sound: true
  29441. });
  29442. }
  29443. } else {
  29444. console.log('开始对讲');
  29445. _this9.setDecoderState({
  29446. talk: true
  29447. });
  29448. if (sound) {
  29449. _this9.jSPlugin.closeSound();
  29450. _this9.setDecoderState({
  29451. sound: false
  29452. });
  29453. }
  29454. _this9.jSPlugin.Talk.startTalk();
  29455. }
  29456. }
  29457. };
  29458. return btnItem;
  29459. case 'zoom':
  29460. btnItem.title = "电子放大";
  29461. btnItem.id = btnId;
  29462. btnItem.domString = '<div></div>' + "<svg id=\"".concat(this.jSPlugin.id, "-zoom-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" id=\"\u56FE\u5C42_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"5 -6 5 32\" style=\"enable-background:new 0 0 20 20.1;\" xml:space=\"preserve\">\n <path class=\"st1\" d=\"M8.8,2.6c3.5,0,6.2,2.8,6.2,6.2s-2.8,6.2-6.2,6.2s-6.2-2.8-6.2-6.2S5.3,2.6,8.8,2.6z M8.8,3.9\n c-2.8,0-5,2.2-5,5s2.2,5,5,5s5-2.2,5-5S11.5,3.9,8.8,3.9z M12.7,12.7l3.9,3.9\"/>\n <path class=\"st2\" d=\"M11.2,9.5h-5c-0.3,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h5c0.3,0,0.6,0.3,0.6,0.6S11.6,9.5,11.2,9.5z\"/>\n <path class=\"st2\" d=\"M8.7,12c-0.3,0-0.6-0.3-0.6-0.6v-5c0-0.3,0.3-0.6,0.6-0.6s0.6,0.3,0.6,0.6v5C9.3,11.8,9.1,12,8.7,12z\"/>\n <path class=\"st2\" d=\"M16.9,17.6c-0.1,0-0.3-0.1-0.4-0.2l-3.9-3.9c-0.2-0.2-0.2-0.6,0-0.8s0.6-0.2,0.8,0l3.9,3.9\n c0.2,0.2,0.2,0.6,0,0.8C17.2,17.5,17,17.6,16.9,17.6z\"/>\n </svg>");
  29463. btnItem.onclick = function () {
  29464. var _this9$decoderState$s5 = _this9.decoderState.state,
  29465. zoom = _this9$decoderState$s5.zoom,
  29466. play = _this9$decoderState$s5.play;
  29467. if (!play) {
  29468. return false;
  29469. }
  29470. if (zoom) {
  29471. console.log('结束电子放大');
  29472. _this9.setDecoderState({
  29473. zoom: false
  29474. });
  29475. _this9.jSPlugin.Zoom.stopZoom();
  29476. } else {
  29477. console.log('开始电子放大');
  29478. _this9.jSPlugin.Zoom.startZoom();
  29479. _this9.setDecoderState({
  29480. zoom: true
  29481. });
  29482. }
  29483. };
  29484. return btnItem;
  29485. case 'pantile':
  29486. btnItem.title = "云台控制";
  29487. btnItem.id = btnId;
  29488. btnItem.domString = "<svg id=\"".concat(this.jSPlugin.id, "-pantile-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M10.2,7.8c1.6,0,2.9,1.3,2.9,2.9s-1.3,2.9-2.9,2.9s-2.9-1.3-2.9-2.9S8.5,7.8,10.2,7.8z M10.2,8.8c-1.1,0-1.9,0.9-1.9,1.9s0.9,1.9,1.9,1.9s1.9-0.9,1.9-1.9S11.2,8.8,10.2,8.8z" />' + '<path d="M8.8,3.5c0.7-0.6,1.8-0.6,2.5-0.1l0.1,0.1l1.4,1.1c0.2,0.2,0.3,0.5,0.1,0.7 c-0.2,0.2-0.4,0.2-0.6,0.1l-0.1,0l-1.4-1.1C10.5,3.9,10,3.9,9.6,4.2L9.4,4.3L8,5.4C7.8,5.5,7.5,5.5,7.3,5.3c-0.2-0.2-0.1-0.5,0-0.6 l0.1-0.1L8.8,3.5z" />' + '<path d="M2.5,12.3c-0.6-0.7-0.6-1.8-0.1-2.5l0.1-0.1l1.1-1.4c0.2-0.2,0.5-0.3,0.7-0.1 c0.2,0.2,0.2,0.4,0.1,0.6l0,0.1l-1.1,1.4C3,10.6,3,11.1,3.2,11.5l0.1,0.1L4.4,13c0.2,0.2,0.1,0.5-0.1,0.7c-0.2,0.2-0.5,0.1-0.6,0 l-0.1-0.1L2.5,12.3z" />' + '<path d="M17.7,12.3c0.6-0.7,0.6-1.8,0.1-2.5l-0.1-0.1l-1.1-1.4c-0.2-0.2-0.5-0.3-0.7-0.1 c-0.2,0.2-0.2,0.4-0.1,0.6l0,0.1l1.1,1.4c0.3,0.4,0.3,0.9,0.1,1.3l-0.1,0.1L15.8,13c-0.2,0.2-0.1,0.5,0.1,0.7c0.2,0.2,0.5,0.1,0.6,0 l0.1-0.1L17.7,12.3z" />' + '<path d="M8.8,18.2c0.7,0.6,1.8,0.6,2.5,0.1l0.1-0.1l1.4-1.1c0.2-0.2,0.3-0.5,0.1-0.7 c-0.2-0.2-0.4-0.2-0.6-0.1l-0.1,0l-1.4,1.1c-0.4,0.3-0.9,0.3-1.3,0.1l-0.1-0.1L8,16.3c-0.2-0.2-0.5-0.1-0.7,0.1 c-0.2,0.2-0.1,0.5,0,0.6l0.1,0.1L8.8,18.2z" />' + '</svg>';
  29489. btnItem.onclick = function () {
  29490. var _this9$decoderState$s6 = _this9.decoderState.state,
  29491. play = _this9$decoderState$s6.play,
  29492. pantile = _this9$decoderState$s6.pantile,
  29493. expend = _this9$decoderState$s6.expend;
  29494. if (play) {
  29495. if (!pantile) {
  29496. console.log('显示云台');
  29497. if (_this9.isMobile && !expend) {
  29498. console.log("移动端,非全屏状态不展示云台");
  29499. // 移动端,非全屏状态不展示云台
  29500. return false;
  29501. }
  29502. _this9.Ptz.show();
  29503. _this9.setDecoderState({
  29504. pantile: true
  29505. });
  29506. } else {
  29507. console.log('隐藏云台');
  29508. _this9.Ptz.hide();
  29509. _this9.setDecoderState({
  29510. pantile: false
  29511. });
  29512. }
  29513. }
  29514. };
  29515. return btnItem;
  29516. case 'expend':
  29517. btnItem.title = "全局全屏";
  29518. btnItem.id = btnId;
  29519. btnItem.domString = "<span><svg id=\"".concat(this.jSPlugin.id, "-expend-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M3.4,7.6c-0.3,0-0.5-0.2-0.5-0.5V5.3c0-1.2,1-2.3,2.2-2.3h1.8c0.3,0,0.5,0.2,0.5,0.5S7.2,4.1,6.9,4.1H5.2 c-0.7,0-1.2,0.6-1.2,1.3v1.8C3.9,7.4,3.7,7.6,3.4,7.6z" />' + '<path d="M6.9,18.1H5.2c-1.2,0-2.2-1-2.2-2.2v-1.8c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v1.8c0,0.7,0.6,1.2,1.2,1.2 h1.8c0.3,0,0.5,0.2,0.5,0.5S7.2,18.1,6.9,18.1z" />' + '<path d="M15.7,18.1h-1.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h1.8c0.7,0,1.2-0.6,1.2-1.2v-1.8 c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v1.8C17.9,17.1,16.9,18.1,15.7,18.1z" />' + '<path d="M17.4,7.6c-0.3,0-0.5-0.2-0.5-0.5V5.3c0-0.7-0.6-1.3-1.2-1.3h-1.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h1.8 c1.2,0,2.2,1,2.2,2.3v1.8C17.9,7.4,17.7,7.6,17.4,7.6z" />' + '</svg>' + "<svg class=\"theme-icon-item-icon\" style=\"display:none\" width=\"".concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" fill=\"").concat(btnItem.color, "\" viewBox=\"-6 -6 32 32\">\n <path class=\"st1\" d=\"M5.7,8.1H3.9c-0.3,0-0.6-0.2-0.6-0.6S3.6,7,3.9,7h1.9c0.7,0,1.3-0.6,1.3-1.3V3.8c0-0.3,0.2-0.6,0.6-0.6\n s0.6,0.2,0.6,0.6v1.9C8.2,7,7.1,8.1,5.7,8.1z\"/>\n <path class=\"st1\" d=\"M7.6,17.7c-0.3,0-0.6-0.2-0.6-0.6v-1.9c0-0.7-0.6-1.3-1.3-1.3H3.9c-0.3,0-0.6-0.2-0.6-0.6s0.2-0.6,0.6-0.6h1.9\n c1.3,0,2.4,1.1,2.4,2.4v1.9C8.2,17.5,7.9,17.7,7.6,17.7z\"/>\n <path class=\"st1\" d=\"M13.4,17.7c-0.3,0-0.6-0.2-0.6-0.6v-1.9c0-1.3,1.1-2.4,2.4-2.4h1.9c0.3,0,0.6,0.2,0.6,0.6S17.5,14,17.2,14\n h-1.9c-0.7,0-1.3,0.6-1.3,1.3v1.9C14,17.5,13.8,17.7,13.4,17.7z\"/>\n <path class=\"st1\" d=\"M17.2,8.1h-1.9c-1.3,0-2.4-1.1-2.4-2.4V3.8c0-0.3,0.2-0.6,0.6-0.6S14,3.5,14,3.8v1.9C14,6.4,14.6,7,15.3,7h1.9\n c0.3,0,0.6,0.2,0.6,0.6S17.5,8.1,17.2,8.1z\"/>\n </svg>\n </span>");
  29520. btnItem.onclick = function () {
  29521. var _this9$decoderState$s7 = _this9.decoderState.state,
  29522. webExpend = _this9$decoderState$s7.webExpend,
  29523. expend = _this9$decoderState$s7.expend;
  29524. _this9$decoderState$s7.play;
  29525. var pantile = _this9$decoderState$s7.pantile;
  29526. // if (!play) {
  29527. // return false;
  29528. // }
  29529. if (webExpend) {
  29530. console.log("正在网站全屏");
  29531. return false;
  29532. }
  29533. if (!expend) {
  29534. console.log("执行全局全屏");
  29535. if (_this9.isMobile) {
  29536. var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(_this9.jSPlugin.id)).height, 10);
  29537. requestMobileFullScreen(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")));
  29538. setTimeout(function () {
  29539. var width = document.documentElement.clientWidth;
  29540. var height = document.documentElement.clientHeight;
  29541. // 兼容微信浏览器footer被隐藏
  29542. // document.getElementById(`${this.jSPlugin.id}-ez-iframe-footer-container`).style.marginTop = "0px";
  29543. // document.getElementById(`${this.jSPlugin.id}-headControl`).style.position = "absolute";
  29544. document.getElementById("".concat(_this9.jSPlugin.id)).style["backface-visibility"] = "hidden";
  29545. _this9.jSPlugin.jSPlugin.JS_Resize(height, width - heightIntercept);
  29546. }, 100);
  29547. } else {
  29548. var width = window.screen.width;
  29549. var height = window.screen.height;
  29550. var promise = requestFullScreenPromise(document.getElementById("".concat(_this9.jSPlugin.id)));
  29551. promise.then(function (data) {
  29552. _this9.jSPlugin.jSPlugin.JS_Resize(width, height);
  29553. })["catch"](function (err) {
  29554. console.log(err);
  29555. });
  29556. }
  29557. } else {
  29558. if (_this9.isMobile) {
  29559. var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(_this9.jSPlugin.id)).height, 10);
  29560. if (document.getElementById("".concat(_this9.jSPlugin.id, "-ez-iframe-footer-container"))) {
  29561. document.getElementById("".concat(_this9.jSPlugin.id, "-ez-iframe-footer-container")).style.marginTop = "-32px";
  29562. }
  29563. if (document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))) {
  29564. document.getElementById("".concat(_this9.jSPlugin.id, "-headControl")).style.position = "relative";
  29565. }
  29566. cancelMobileFullScreen(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")), _this9.jSPlugin.width, _this9.jSPlugin.height + heightIntercept);
  29567. _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
  29568. // 移动端取消全屏,如果开启了云台,取消云台
  29569. if (pantile) {
  29570. _this9.Ptz.hide();
  29571. _this9.setDecoderState({
  29572. pantile: false
  29573. });
  29574. }
  29575. } else {
  29576. console.log("取消全局全屏");
  29577. var cancelPromise = cancelFullScreenPromise();
  29578. cancelPromise.then(function (data) {
  29579. console.log("取消全屏", data, _this9.jSPlugin);
  29580. _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
  29581. });
  29582. }
  29583. }
  29584. _this9.setDecoderState({
  29585. expend: !expend
  29586. });
  29587. };
  29588. return btnItem;
  29589. case 'webExpend':
  29590. btnItem.title = "网页全屏";
  29591. btnItem.id = btnId;
  29592. btnItem.domString = "<span><svg id=\"".concat(this.jSPlugin.id, "-webExpend-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M3.1,7.6c-0.3,0-0.5-0.2-0.5-0.5V5.3c0-1.2,1-2.3,2.2-2.3h1.8c0.3,0,0.5,0.2,0.5,0.5S6.8,4.1,6.6,4.1H4.8 c-0.7,0-1.2,0.6-1.2,1.3v1.8C3.6,7.4,3.3,7.6,3.1,7.6z" />' + '<path d="M15.3,18.1h-1.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h1.8c0.7,0,1.2-0.6,1.2-1.2v-1.8 c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v1.8C17.6,17.1,16.6,18.1,15.3,18.1z" />' + '<circle class="st2" cx="10.2" cy="10.4" r="1.1"/>' + '</svg>' + "<svg class=\"theme-icon-item-icon\" fill=\"".concat(btnItem.color, "\" style=\"display:none;\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">\n <path class=\"st1\" d=\"M5.4,8.1H3.5C3.2,8.1,3,7.9,3,7.6s0.2-0.5,0.5-0.5h1.9c0.8,0,1.4-0.6,1.4-1.4V3.8c0-0.3,0.2-0.5,0.5-0.5\n s0.5,0.2,0.5,0.5v1.9C7.7,7,6.7,8.1,5.4,8.1z\"/>\n <path class=\"st1\" d=\"M13.1,17.7c-0.3,0-0.5-0.2-0.5-0.5v-1.9c0-1.3,1.1-2.4,2.4-2.4h1.9c0.3,0,0.5,0.2,0.5,0.5s-0.2,0.5-0.5,0.5H15\n c-0.8,0-1.4,0.6-1.4,1.4v1.9C13.6,17.4,13.4,17.7,13.1,17.7z\"/>\n <circle class=\"st2\" cx=\"10.2\" cy=\"10.4\" r=\"1.1\"/>\n ") + '</svg></span>';
  29593. btnItem.onclick = function () {
  29594. var _this9$decoderState$s8 = _this9.decoderState.state,
  29595. webExpend = _this9$decoderState$s8.webExpend,
  29596. expend = _this9$decoderState$s8.expend;
  29597. _this9$decoderState$s8.play;
  29598. // if (!play) {
  29599. // return false;
  29600. // }
  29601. if (expend) {
  29602. console.log("正在全局全屏");
  29603. return false;
  29604. }
  29605. if (_this9.jSPlugin.recTimer) {
  29606. clearInterval(_this9.jSPlugin.recTimer);
  29607. }
  29608. if (!webExpend) {
  29609. console.log("执行网页全屏");
  29610. var footerDOMHeight = 0;
  29611. var headerDOMHeight = 0;
  29612. var that = _this9;
  29613. ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
  29614. // 监听全屏事件触发
  29615. window.addEventListener(item, function fullscreenchange(e) {
  29616. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  29617. if (isFullScreen) {
  29618. if (document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0"))) {
  29619. document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0")).style.height = window.screen.height - parseInt(window.getComputedStyle(document.getElementById("".concat(that.jSPlugin.id, "-headControl"))).height, 10) + 'px';
  29620. }
  29621. } else {
  29622. if (document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0"))) {
  29623. document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0")).style.height = that.jSPlugin.height + parseInt(window.getComputedStyle(document.getElementById("".concat(that.jSPlugin.id, "-headControl"))).height, 10) + 'px';
  29624. }
  29625. }
  29626. return isFullScreen;
  29627. });
  29628. });
  29629. var width = window.screen.width;
  29630. var height = window.screen.height;
  29631. var promise = requestFullScreenPromise(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")));
  29632. promise.then(function (data) {
  29633. if (document.getElementById("".concat(_this9.jSPlugin.id, "-canvas-container"))) {
  29634. footerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-canvas-container"))).height, 10);
  29635. }
  29636. if (document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))) {
  29637. headerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))).height, 10);
  29638. }
  29639. _this9.jSPlugin.jSPlugin.JS_Resize(width, height - footerDOMHeight - headerDOMHeight);
  29640. if (_this9.jSPlugin.Theme.Rec) {
  29641. _this9.jSPlugin.Theme.Rec.recAutoSize();
  29642. }
  29643. })["catch"](function (err) {
  29644. console.log(err);
  29645. });
  29646. } else {
  29647. console.log("取消网页全屏");
  29648. var cancelPromise = cancelFullScreenPromise();
  29649. cancelPromise.then(function (data) {
  29650. _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
  29651. if (_this9.jSPlugin.Theme.Rec) {
  29652. _this9.jSPlugin.Theme.Rec.recAutoSize();
  29653. }
  29654. });
  29655. }
  29656. _this9.setDecoderState({
  29657. webExpend: !webExpend
  29658. });
  29659. };
  29660. return btnItem;
  29661. case 'hd':
  29662. btnItem.title = "画面清晰度";
  29663. btnItem.id = btnId;
  29664. btnItem.domString = "<ul id=\"".concat(this.jSPlugin.id, "-hdSelect\" class=\"hd speed-select ").concat(this.isMobile ? "mobile" : "", "\" style=\"display:none;\">") // + `<li class="selectOption" style="width: 60px;height: 32px;text-align: center;line-height: 32px;list-style: none;cursor: pointer;font-size: 13px;color: rgba(0, 0, 0, .85);" name="option" id="${this.jSPlugin.id}-select-hd">高清</li>`
  29665. // + `<li class="selectOption" style="width: 60px;height: 32px;text-align: center;line-height: 32px;list-style: none;cursor: pointer;font-size: 13px;color: rgba(0, 0, 0, .85);" name="option" id="${this.jSPlugin.id}-select-sd">标清</li>`
  29666. + "<li class=\"selectOption default\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-hd\">\u9AD8\u6E05</li>") + "<li class=\"selectOption default\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-sd\">\u6807\u6E05</li>") + "<li class=\"selectOption cancel\" style=\"".concat(this.isMobile ? "" : "display:none;", "\" name=\"option\" id=\"").concat(this.jSPlugin.id, "-select-speed\">\u53D6\u6D88</li>") + '</ul>' + "<span><svg id=\"".concat(this.jSPlugin.id, "-hdSelect-icon\" class=\"theme-icon-item-icon\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -6 32 32\">") + '<path d="M17.4,16.5H3.1c-0.8,0-1.4-0.6-1.4-1.4V5.4c0-0.9,0.7-1.6,1.6-1.6h14.1c0.8,0,1.4,0.6,1.4,1.4v9.8 C18.8,15.9,18.2,16.5,17.4,16.5z M3.3,5C3.1,5,2.9,5.2,2.9,5.4v9.7c0,0.2,0.1,0.3,0.3,0.3h14.3c0.2,0,0.3-0.1,0.3-0.3V5.3 c0-0.2-0.1-0.3-0.3-0.3H3.3z" />' + '<path d="M13.3,13.6h-1.6c-0.4,0-0.7-0.3-0.7-0.7V7.4c0-0.4,0.3-0.7,0.7-0.7h1.6c1.2,0,2.2,1,2.2,2.2v2.4 C15.6,12.6,14.6,13.6,13.3,13.6z M12.2,12.5h1.1c0.6,0,1.1-0.5,1.1-1.1V9c0-0.6-0.5-1.1-1.1-1.1h-1.1V12.5z" />' + '<path d="M5.5,13.6c-0.3,0-0.6-0.2-0.6-0.6V7.3C5,7,5.2,6.8,5.5,6.8S6.1,7,6.1,7.3v5.7C6.1,13.4,5.8,13.6,5.5,13.6z" />' + '<path d="M9.2,13.6c-0.3,0-0.6-0.2-0.6-0.6V7.3c0-0.3,0.2-0.6,0.6-0.6S9.8,7,9.8,7.3v5.7C9.8,13.4,9.5,13.6,9.2,13.6z" />' + '<rect x="5.6" y="9.6" width="3.6" height="1.1" />' + '</svg>' + "<svg id=\"".concat(this.jSPlugin.id, "-sdSelect-icon\" class=\"theme-icon-item-icon\" style=\"display:none\" fill=\"").concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-6 -8 40 44\">\n <path d=\"M24.1,23.8h-20c-1.1,0-1.9-0.9-1.9-1.9V8.4c0-1.2,1-2.2,2.1-2.2h19.7c1.1,0,1.9,0.9,1.9,1.9v13.8\n C26,23,25.1,23.8,24.1,23.8z M4.3,7.7C4,7.7,3.7,8,3.7,8.4v13.5c0,0.2,0.2,0.4,0.4,0.4h20c0.2,0,0.4-0.2,0.4-0.4V8.2\n c0-0.2-0.2-0.4-0.4-0.4H4.3z\"/>\n <path d=\"M18.4,19.8h-2.2c-0.5,0-0.9-0.4-0.9-0.9v-7.8c0-0.5,0.4-0.9,0.9-0.9h2.2c1.7,0,3.1,1.4,3.1,3.1v3.3\n C21.5,18.4,20.1,19.8,18.4,19.8z M16.7,18.3h1.6c0.9,0,1.6-0.7,1.6-1.6v-3.3c0-0.9-0.7-1.6-1.6-1.6h-1.6V18.3z\"/>\n <path d=\"M10.5,19.8c1.2,0,2.1-0.3,2.7-0.9c0.6-0.6,0.9-1.3,0.9-2.1c0-0.8-0.3-1.4-0.9-1.8c-0.4-0.2-1.1-0.5-2.2-0.8\n l0,0l-1-0.2c-0.4-0.1-0.8-0.2-1-0.4c-0.4-0.2-0.6-0.5-0.6-0.9c0-0.4,0.1-0.6,0.4-0.9s0.7-0.3,1.3-0.3c0.8,0,1.4,0.2,1.8,0.6\n c0.2,0.3,0.3,0.6,0.4,0.9l0,0h1.4c0-0.6-0.2-1.1-0.5-1.6c-0.6-0.8-1.6-1.2-2.9-1.2c-1,0-1.8,0.3-2.4,0.8c-0.6,0.5-0.9,1.2-0.9,2\n c0,0.7,0.3,1.3,1,1.7c0.4,0.2,0.9,0.4,1.7,0.6l0,0l1.2,0.3c0.6,0.2,1.1,0.3,1.3,0.4c0.3,0.2,0.5,0.5,0.5,0.9c0,0.5-0.2,0.9-0.6,1.1\n s-0.9,0.4-1.5,0.4c-0.9,0-1.6-0.2-2-0.7c-0.2-0.3-0.3-0.6-0.4-1.1l0,0H6.8c0,0.9,0.3,1.6,0.9,2.2C8.2,19.5,9.2,19.8,10.5,19.8z\"/>\n <defs>\n <filter id=\"Adobe_OpacityMaskFilter\" filterUnits=\"userSpaceOnUse\" x=\"15.2\" y=\"10.3\" width=\"6.2\" height=\"9.5\">\n <feColorMatrix type=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"/>\n </filter>\n </defs>\n <mask maskUnits=\"userSpaceOnUse\" x=\"15.2\" y=\"10.3\" width=\"6.2\" height=\"9.5\" id=\"mask-2_2_\">\n <g class=\"st2\">\n <path id=\"path-1_2_\" class=\"st3\" d=\"M24.1,23.1h-20c-0.6,0-1.2-0.5-1.2-1.2V8.2C2.9,7.5,3.5,7,4.1,7h19.7c0.8,0,1.4,0.6,1.4,1.4\n v13.5C25.2,22.6,24.7,23.1,24.1,23.1z\"/>\n </g>\n </mask>\n <defs>\n <filter id=\"Adobe_OpacityMaskFilter_1_\" filterUnits=\"userSpaceOnUse\" x=\"6.8\" y=\"10.3\" width=\"7.3\" height=\"9.5\">\n <feColorMatrix type=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"/>\n </filter>\n </defs>\n <mask maskUnits=\"userSpaceOnUse\" x=\"6.8\" y=\"10.3\" width=\"7.3\" height=\"9.5\" id=\"mask-2_3_\">\n <g class=\"st5\">\n <path id=\"path-1_3_\" class=\"st3\" d=\"M24.1,23.1h-20c-0.6,0-1.2-0.5-1.2-1.2V8.2C2.9,7.5,3.5,7,4.1,7h19.7c0.8,0,1.4,0.6,1.4,1.4\n v13.5C25.2,22.6,24.7,23.1,24.1,23.1z\"/>\n </g>\n </mask>\n </svg>\n ") + "<span class='speed-select-mask' style=\"display:none\" id=\"".concat(this.jSPlugin.id, "-select-hd-mask\"></span>") + '</span>';
  29667. btnItem.onclick = function (e) {
  29668. var _this9$decoderState$s9 = _this9.decoderState.state,
  29669. hd = _this9$decoderState$s9.hd,
  29670. expend = _this9$decoderState$s9.expend,
  29671. recordvideo = _this9$decoderState$s9.recordvideo,
  29672. play = _this9$decoderState$s9.play;
  29673. if (play) {
  29674. // 选择清晰度选项时才触发事件
  29675. if (hd && e.target.id === "".concat(_this9.jSPlugin.id, "-select-sd")) {
  29676. //decoder.changePlayUrl({ hd: false });
  29677. console.log("切换到标清");
  29678. _this9.jSPlugin.changeVideoLevel(0);
  29679. _this9.setDecoderState({
  29680. hd: false
  29681. });
  29682. //xuehb 重置手机端电子放大状态
  29683. _this9.resetMobileZoomStatus();
  29684. //切换清晰度时停止录像并关闭录像计时
  29685. if (recordvideo) {
  29686. // this.jSPlugin.stopSave();
  29687. _this9.setDecoderState({
  29688. recordvideo: false
  29689. });
  29690. }
  29691. _this9.setDecoderState({
  29692. zoom: false
  29693. });
  29694. _this9.jSPlugin.Zoom.stopZoom();
  29695. } else if (!hd && e.target.id === "".concat(_this9.jSPlugin.id, "-select-hd")) {
  29696. _this9.jSPlugin.changeVideoLevel(1);
  29697. _this9.setDecoderState({
  29698. hd: true
  29699. });
  29700. //xuehb 重置手机端电子放大状态
  29701. _this9.resetMobileZoomStatus();
  29702. //切换清晰度时停止录像并关闭录像计时
  29703. if (recordvideo) {
  29704. // this.jSPlugin.stopSave();
  29705. _this9.setDecoderState({
  29706. recordvideo: false
  29707. });
  29708. }
  29709. _this9.setDecoderState({
  29710. zoom: false
  29711. });
  29712. _this9.jSPlugin.Zoom.stopZoom();
  29713. }
  29714. _this9.showHD = !_this9.showHD;
  29715. if (document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect"))) {
  29716. document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).style.display = document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).style.display === 'none' ? 'block' : 'none';
  29717. if (_this9.isMobile) {
  29718. document.getElementById("".concat(_this9.jSPlugin.id, "-select-hd-mask")).style.display = document.getElementById("".concat(_this9.jSPlugin.id, "-select-hd-mask")).style.display === 'none' ? 'block' : 'none';
  29719. }
  29720. }
  29721. if (_this9.isMobile && expend && _this9.showHD) {
  29722. document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).className = "hd speed-select mobile expend";
  29723. } else {
  29724. document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).className = _this9.isMobile ? "hd speed-select mobile" : "speed-select";
  29725. }
  29726. }
  29727. };
  29728. return btnItem;
  29729. case 'speed':
  29730. btnItem.title = "回放倍速";
  29731. btnItem.id = btnId;
  29732. btnItem.domString = "<ul id=\"".concat(this.jSPlugin.id, "-speedSelect\" class=\"speed speed-select ").concat(this.isMobile ? "mobile" : "", "\" style=\"display:none;\">") + "<li class=\"selectOption default\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;font-size: 13px;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-speed4\">4\u500D</li>") + "<li class=\"selectOption default\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;font-size: 13px;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-speed2\">2\u500D</li>") + "<li class=\"selectOption active\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;font-size: 13px;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-speed1\">1\u500D\uFF08\u6B63\u5E38\u64AD\u653E\uFF09</li>") + "<li class=\"selectOption default\" style=\"height: 45px;text-align: center;line-height: 45px;list-style: none;cursor: pointer;font-size: 13px;\" name=\"option\" id=\"".concat(this.jSPlugin.id, "-select-speed05\">0.5\u500D</li>") + "<li class=\"selectOption cancel\" style=\"".concat(this.isMobile ? "" : "display:none;", "\" name=\"option\" id=\"").concat(this.jSPlugin.id, "-select-speed\">\u53D6\u6D88</li>") + '</ul>' + "<span>\n <div style=\"font-size: 12px;\n vertical-align: bottom;\n display: inline-flex;\n padding: 0px 7px;\n width: 48px;\n line-height: 24px;\n justify-content: center;\n border: 1px solid ".concat(btnItem.color, ";\n text-align: center;border-radius: 12.5px;\"\n id=\"").concat(this.jSPlugin.id, "-speed-text\"\n >").concat(this.nextRate === 1 ? "倍速" : "".concat(this.nextRate, "\u500D").replace("3", "0.5"), "</div>\n ") + "<span class='speed-select-mask' style=\"display:none\" id=\"".concat(this.jSPlugin.id, "-select-mask\"></span>") + '</span>';
  29733. if (!this.isMobile) {
  29734. btnItem.onmouseenter = function (e) {
  29735. var play = _this9.decoderState.state.play;
  29736. if (!play) {
  29737. return false;
  29738. }
  29739. console.log("鼠标移入", e);
  29740. _this9.setDecoderState({
  29741. speed: true
  29742. });
  29743. if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
  29744. document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'block';
  29745. }
  29746. };
  29747. btnItem.onmouseleave = function (e) {
  29748. var play = _this9.decoderState.state.play;
  29749. if (!play) {
  29750. return false;
  29751. }
  29752. console.log("鼠标移出", e);
  29753. _this9.setDecoderState({
  29754. speed: false
  29755. });
  29756. if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
  29757. document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'none';
  29758. }
  29759. };
  29760. }
  29761. btnItem.onclick = function (e) {
  29762. var _this9$decoderState$s10 = _this9.decoderState.state,
  29763. speed = _this9$decoderState$s10.speed,
  29764. expend = _this9$decoderState$s10.expend,
  29765. play = _this9$decoderState$s10.play;
  29766. //xuehb 播放状态才可以设置倍数
  29767. if (!play) {
  29768. return false;
  29769. }
  29770. if (!speed && _this9.isMobile) {
  29771. document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).className = expend ? "speed speed-select mobile expend" : "speed speed-select mobile";
  29772. }
  29773. _this9.nextRate = 1;
  29774. // 选择清晰度选项时才触发事件
  29775. // if(this.isMobile) {
  29776. // console.log("请执行移动端倍速");
  29777. // return false;
  29778. // }
  29779. if (e.target.id) {
  29780. switch (e.target.id) {
  29781. case "".concat(_this9.jSPlugin.id, "-select-speed1"):
  29782. // case `${this.jSPlugin.id}-select-speed`:
  29783. console.log("倍速1");
  29784. _this9.nextRate = 1;
  29785. _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
  29786. _this9.changeRecSpeed(1);
  29787. _this9.jSPlugin.speed = 1;
  29788. _this9.setDecoderState({
  29789. speed: !speed
  29790. });
  29791. break;
  29792. case "".concat(_this9.jSPlugin.id, "-select-speed2"):
  29793. console.log("倍速2");
  29794. _this9.nextRate = 2;
  29795. _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
  29796. _this9.changeRecSpeed(2);
  29797. _this9.jSPlugin.speed = 2;
  29798. _this9.setDecoderState({
  29799. speed: !speed
  29800. });
  29801. break;
  29802. case "".concat(_this9.jSPlugin.id, "-select-speed4"):
  29803. console.log("倍速4");
  29804. _this9.nextRate = 4;
  29805. _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
  29806. _this9.changeRecSpeed(4);
  29807. _this9.jSPlugin.speed = 4;
  29808. _this9.setDecoderState({
  29809. speed: !speed
  29810. });
  29811. break;
  29812. case "".concat(_this9.jSPlugin.id, "-select-speed05"):
  29813. console.log("倍速05");
  29814. _this9.nextRate = 3;
  29815. _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
  29816. _this9.changeRecSpeed(0.5);
  29817. _this9.jSPlugin.speed = 0.5;
  29818. _this9.setDecoderState({
  29819. speed: !speed
  29820. });
  29821. break;
  29822. default:
  29823. // if(document.getElementById(`${this.jSPlugin.id}-speed-text`)){
  29824. // document.getElementById(`${this.jSPlugin.id}-speed-text`).innerHTML = this.nextRate +"倍";
  29825. // }
  29826. // pc 端点击不再隐藏,只通过移出隐藏
  29827. if (!_this9.isMobile) {
  29828. _this9.setDecoderState({
  29829. speed: true
  29830. });
  29831. } else {
  29832. _this9.setDecoderState({
  29833. speed: !speed
  29834. });
  29835. }
  29836. break;
  29837. }
  29838. }
  29839. // pc 端点击不再隐藏,只通过移出隐藏
  29840. if (!_this9.isMobile && e.target.id === "".concat(_this9.jSPlugin.id, "-speed-text")) {
  29841. document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'block';
  29842. } else {
  29843. if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
  29844. document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display === 'none' ? 'block' : 'none';
  29845. }
  29846. }
  29847. };
  29848. return btnItem;
  29849. case 'deviceName':
  29850. btnItem.title = "设备名称";
  29851. btnItem.id = btnId;
  29852. btnItem.domString = '<span>设备名称</span>';
  29853. btnItem.onclick = function () {};
  29854. return btnItem;
  29855. case 'deviceID':
  29856. btnItem.title = "设备序列号";
  29857. btnItem.id = btnId;
  29858. btnItem.domString = '<span>设备序列号</span>';
  29859. btnItem.onclick = function () {};
  29860. return btnItem;
  29861. case 'cloudRec':
  29862. btnItem.title = "云存储回放";
  29863. btnItem.id = btnId;
  29864. btnItem.domString = "\n <span>\n <svg class=\"theme-icon-item-icon\" fill=\"".concat(btnItem.color, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"-10 0 40 15\">\n\t<path d=\"M9.5,13.1c-0.3,0-0.5-0.2-0.5-0.5V8.8c0-0.3,0.2-0.5,0.5-0.5S10,8.5,10,8.8v3.8C10,12.8,9.8,13.1,9.5,13.1z\"/>\n\t<path d=\"M7.6,10.6c-0.1,0-0.3-0.1-0.4-0.2C7,10.2,7,9.9,7.3,9.7l1.9-1.7c0.2-0.2,0.5-0.2,0.7,0l1.8,1.7\n\t\tc0.2,0.2,0.2,0.5,0,0.7c-0.2,0.2-0.5,0.2-0.7,0L9.5,9.1l-1.6,1.4C7.8,10.6,7.7,10.6,7.6,10.6z\"/>\n\t<path d=\"M13.2,15.7H5.6c-2.1-0.1-3.8-1.8-3.8-3.9c0-1.8,1.3-3.4,3-3.8c0.4-2.2,2.3-3.9,4.6-3.9c2.3,0,4.2,1.7,4.6,3.8\n\t\tc1.8,0.4,3.1,1.9,3.1,3.8C17.1,13.9,15.4,15.7,13.2,15.7z M5.6,14.7h7.6c1.6,0,2.9-1.3,2.9-2.9c0-1.5-1.1-2.7-2.6-2.9l-0.4,0l0-0.4\n\t\tc-0.2-1.9-1.7-3.3-3.6-3.3C7.5,5.1,6,6.6,5.8,8.5l0,0.4l-0.4,0c-1.4,0.2-2.5,1.4-2.5,2.9C2.8,13.3,4.1,14.6,5.6,14.7z\"/>\n </svg>\n </span>\n ");
  29865. btnItem.onclick = function () {
  29866. console.log("点击云回放");
  29867. _this9.setDecoderState({
  29868. type: 'cloud.rec',
  29869. cloudRec: true,
  29870. rec: false
  29871. });
  29872. _this9.jSPlugin.changePlayUrl({
  29873. type: 'cloud.rec'
  29874. }, function () {
  29875. //xuehb changePlayUrl这个方法异步的,要在成功修改URL后再获取回放时间段
  29876. console.log(_this9.jSPlugin);
  29877. var initDate = getQueryString("begin", _this9.jSPlugin.url) || new Date().Format('yyyyMMdd');
  29878. _this9.Rec.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
  29879. //xuehb 重置放大倍数
  29880. var zoom = _this9.decoderState.state.zoom;
  29881. if (zoom) {
  29882. _this9.setDecoderState({
  29883. zoom: false
  29884. });
  29885. _this9.jSPlugin.Zoom.stopZoom();
  29886. }
  29887. });
  29888. console.log(_this9.jSPlugin);
  29889. // var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
  29890. // this.Rec.renderRec(`${initDate.slice(0, 4)}-${initDate.slice(4, 6)}-${initDate.slice(6, 8)}`);
  29891. };
  29892. return btnItem;
  29893. case 'rec':
  29894. btnItem.title = "本地存储";
  29895. btnItem.id = btnId;
  29896. btnItem.domString = "\n <span>\n <svg class=\"theme-icon-item-icon\" fill=".concat(btnItem.color, " version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" height=\"").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "\" viewBox=\"0 0 40 15\">\n <path d=\"M13,16.3H5.5c-1.1,0-2-0.9-2-2V3.8c0-1.1,0.9-2,2-2h5.4c0.5,0,1,0.2,1.4,0.6l2.1,2.1C14.8,4.8,15,5.3,15,5.9\n v8.4C15,15.4,14.1,16.3,13,16.3z M5.5,2.8c-0.6,0-1,0.4-1,1v10.5c0,0.6,0.4,1,1,1H13c0.6,0,1-0.4,1-1V5.9c0-0.3-0.1-0.5-0.3-0.7\n L11.6,3c-0.2-0.2-0.4-0.3-0.7-0.3H5.5z\"/>\n<path d=\"M6.3,7.3C6,7.3,5.8,7,5.8,6.8V4.5C5.8,4.2,6,4,6.3,4s0.5,0.2,0.5,0.5v2.2C6.8,7,6.6,7.3,6.3,7.3z\"/>\n<path d=\"M8.5,7.3C8.3,7.3,8,7,8,6.8V4.5C8,4.2,8.3,4,8.5,4S9,4.2,9,4.5v2.2C9,7,8.8,7.3,8.5,7.3z\"/>\n<path d=\"M10.8,7.3c-0.3,0-0.5-0.2-0.5-0.5V4.5c0-0.3,0.2-0.5,0.5-0.5s0.5,0.2,0.5,0.5v2.2C11.3,7,11.1,7.3,10.8,7.3z\"\n />\n </svg>\n </span>\n ");
  29897. btnItem.onclick = function () {
  29898. console.log("点击本地回放");
  29899. _this9.setDecoderState({
  29900. type: 'rec',
  29901. cloudRec: false,
  29902. rec: true
  29903. });
  29904. _this9.jSPlugin.changePlayUrl({
  29905. type: 'rec'
  29906. }, function () {
  29907. //xuehb 这个方法异步的,要在成功修改URL后再获取回放时间段
  29908. console.log('---------本地回放');
  29909. console.log(_this9.jSPlugin);
  29910. var initDate = getQueryString("begin", _this9.jSPlugin.url) || new Date().Format('yyyyMMdd');
  29911. _this9.Rec.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
  29912. //xuehb 重置放大倍数
  29913. var zoom = _this9.decoderState.state.zoom;
  29914. if (zoom) {
  29915. _this9.setDecoderState({
  29916. zoom: false
  29917. });
  29918. _this9.jSPlugin.Zoom.stopZoom();
  29919. }
  29920. });
  29921. console.log(_this9.jSPlugin);
  29922. // var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
  29923. // this.Rec.renderRec(`${initDate.slice(0, 4)}-${initDate.slice(4, 6)}-${initDate.slice(6, 8)}`);
  29924. };
  29925. return btnItem;
  29926. default:
  29927. return btnItem;
  29928. }
  29929. }
  29930. }, {
  29931. key: "changeRecSpeed",
  29932. value: function changeRecSpeed(speed) {
  29933. var _this10 = this;
  29934. var setLiActive = function setLiActive(index) {
  29935. console.log("setLiActive", index);
  29936. if (!document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect"))) {
  29937. return false;
  29938. }
  29939. document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[0].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[0].className.replace("active", "default");
  29940. document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[1].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[1].className.replace("active", "default");
  29941. document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[2].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[2].className.replace("active", "default");
  29942. document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[3].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[3].className.replace("active", "default");
  29943. document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[index].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[index].className.replace("default", "active");
  29944. };
  29945. var speedText = "1";
  29946. switch (speed) {
  29947. case 1:
  29948. setLiActive(2);
  29949. speedText = "倍速";
  29950. break;
  29951. case 2:
  29952. setLiActive(1);
  29953. speedText = "".concat(speed, "\u500D");
  29954. break;
  29955. case 4:
  29956. setLiActive(0);
  29957. speedText = "".concat(speed, "\u500D");
  29958. break;
  29959. case 0.5:
  29960. setLiActive(3);
  29961. speedText = "".concat(speed, "\u500D");
  29962. break;
  29963. default:
  29964. setLiActive(2);
  29965. speedText = "".concat(speed, "\u500D");
  29966. break;
  29967. }
  29968. if (document.getElementById("".concat(this.jSPlugin.id, "-speed-text"))) {
  29969. document.getElementById("".concat(this.jSPlugin.id, "-speed-text")).innerHTML = speedText;
  29970. }
  29971. }
  29972. }, {
  29973. key: "initThemeData",
  29974. value: function initThemeData() {
  29975. var _this11 = this;
  29976. var _this$themeData4 = this.themeData,
  29977. header = _this$themeData4.header,
  29978. footer = _this$themeData4.footer;
  29979. var videoId = this.jSPlugin.id;
  29980. this.header = defaultTheme.header;
  29981. this.footer = defaultTheme.footer;
  29982. this.isNeedRenderHeader = lodash.findIndex(header.btnList, function (v) {
  29983. return v.isrender > 0;
  29984. }) >= 0;
  29985. if (this.isMobile) {
  29986. // 移动端回放,需要判断设备序列号,设备名称
  29987. this.isNeedRenderHeader = lodash.findIndex(header.btnList, function (v) {
  29988. return v.isrender > 0 && v.iconId === "deviceID" || v.isrender > 0 && v.iconId === "deviceName";
  29989. }) >= 0;
  29990. }
  29991. this.isNeedRenderFooter = lodash.findIndex(footer.btnList, function (v) {
  29992. return v.isrender > 0;
  29993. }) >= 0;
  29994. this.isNeedRenderTimeLine = lodash.findIndex(header.btnList, function (v) {
  29995. return v.iconId === 'cloudRec' && v.isrender === 1 || v.iconId === 'rec' && v.isrender === 1;
  29996. }) >= 0 && !this.jSPlugin.disabledTimeLine;
  29997. ["date-switch-container-wrap", "rec-type-container-wrap", "mobile-rec-wrap", "mobile-ez-ptz-container"].forEach(function (item, index) {
  29998. if (document.getElementById(item)) {
  29999. document.getElementById(item).parentElement.removeChild(document.getElementById(item));
  30000. }
  30001. });
  30002. if (this.isNeedRenderHeader) {
  30003. if (!document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
  30004. var headerContainer = document.createElement('div');
  30005. headerContainer.setAttribute('id', "".concat(this.jSPlugin.id, "-headControl"));
  30006. headerContainer.setAttribute('class', 'header-controls');
  30007. headerContainer.innerHTML = "<div id='".concat(this.jSPlugin.id, "-headControl-left' class=\"header-controls-left\" style='display:flex;width:calc(100% - 100px);overflow:hidden;'></div><div id='").concat(this.jSPlugin.id, "-headControl-right' class=\"header-controls-right\" style='display:flex;'></div>");
  30008. var headerStyle = {
  30009. height: this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
  30010. "line-height": this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
  30011. display: "flex",
  30012. "justify-content": "space-between",
  30013. top: 0,
  30014. "z-index": 1,
  30015. background: "#000000",
  30016. color: "#FFFFFF",
  30017. width: "100%"
  30018. };
  30019. headerContainer.style = styleToString(headerStyle);
  30020. document.getElementById("".concat(videoId, "-wrap")).insertBefore(headerContainer, document.getElementById(videoId));
  30021. // 头部预留x像素空间
  30022. var _checkTimer2 = setInterval(function () {
  30023. if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
  30024. clearInterval(_checkTimer2);
  30025. // 检测到渲染头部,执行一次reSize
  30026. // this.jSPlugin.reSize(this.jSPlugin.params.width,this.jSPlugin.params.height);
  30027. }
  30028. }, 50);
  30029. } else {
  30030. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).innerHTML = "<div id='".concat(this.jSPlugin.id, "-headControl-left' style='display:flex;width: calc(100% - 100px);'></div><div id='").concat(this.jSPlugin.id, "-headControl-right' style='display:flex'></div>");
  30031. }
  30032. } else {
  30033. if (document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
  30034. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id, "-headControl")));
  30035. }
  30036. // this.jSPlugin.reSize(this.jSPlugin.params.width,this.jSPlugin.params.height);
  30037. }
  30038. if (this.isNeedRenderFooter) {
  30039. if (!document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
  30040. var footerContainer = document.createElement('div');
  30041. footerContainer.setAttribute('id', "".concat(this.jSPlugin.id, "-ez-iframe-footer-container"));
  30042. footerContainer.setAttribute('class', 'ez-iframe-footer-container');
  30043. var footerStyle = {
  30044. "min-height": this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
  30045. "max-height": this.jSPlugin.width > MEDIAWIDTH ? "96px" : "80px",
  30046. "position": "relative",
  30047. "margin-top": this.jSPlugin.width > MEDIAWIDTH ? "-48px" : "-32px",
  30048. display: "flex",
  30049. "flex-wrap": "wrap",
  30050. "justify-content": "space-between",
  30051. "z-index": 999,
  30052. top: 0,
  30053. color: "#FFFFFF",
  30054. width: "100%"
  30055. };
  30056. footerContainer.style = styleToString(footerStyle);
  30057. footerContainer.innerHTML = "<div id=\"".concat(this.jSPlugin.id, "-audioControls\" class=\"footer-controls\" style='display:flex;height:").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "px;justify-content: space-between;width:100%;z-index:999;position: relative;'><div id='").concat(this.jSPlugin.id, "-audioControls-left' class=\"footer-controls-left\" style='display:flex;margin-lefacti'></div><div id='").concat(this.jSPlugin.id, "-audioControls-right' class=\"footer-controls-right\" style='display:flex'></div></div>");
  30058. insertAfter$1(footerContainer, document.getElementById(videoId));
  30059. } else {
  30060. if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
  30061. document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).style.marginTop = "-".concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "px");
  30062. document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).innerHTML = "<div id=\"".concat(this.jSPlugin.id, "-audioControls\" class=\"footer-controls\" style='display:flex;justify-content: space-between;height: ").concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "px;width:100%;'><div id='").concat(this.jSPlugin.id, "-audioControls-left' class=\"footer-controls-left\" style='display:flex'></div><div id='").concat(this.jSPlugin.id, "-audioControls-right' class=\"footer-controls-right\" style='display:flex'></div></div>");
  30063. }
  30064. }
  30065. } else {
  30066. if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
  30067. document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")));
  30068. }
  30069. }
  30070. if (this.isNeedRenderHeader && document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
  30071. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.background = header.backgroundColor;
  30072. document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.color = header.color;
  30073. header.btnList.map(function (item, index) {
  30074. if (item.isrender) {
  30075. _this11.renderHeader(item.iconId, item.part);
  30076. }
  30077. });
  30078. }
  30079. if (this.isNeedRenderFooter && document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
  30080. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.background = footer.backgroundColor;
  30081. document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.color = footer.color;
  30082. footer.btnList.map(function (item, index) {
  30083. if (item.isrender) {
  30084. _this11.renderFooter(item.iconId, item.part);
  30085. }
  30086. });
  30087. }
  30088. if (this.isNeedRenderTimeLine) {
  30089. if (this.isMobile) {
  30090. if (document.getElementById("".concat(this.jSPlugin.id, "-headControl-right"))) {
  30091. document.getElementById("".concat(this.jSPlugin.id, "-headControl-right")).style.display = "none";
  30092. }
  30093. //xuehb changeRecSpeed传入,用来重置播放速度 resetMobileZoomStatus 重置手机放大状态方法
  30094. this.Rec = new MobileRec(this.jSPlugin, this.changeRecSpeed, this.resetMobileZoomStatus);
  30095. } else {
  30096. if (this.Rec) {
  30097. // 如果回放已经定义,只需要初始化渲染
  30098. this.Rec.unSyncTimeLine();
  30099. this.Rec.recInit();
  30100. } else {
  30101. this.jSPlugin.decoderState = this.decoderState;
  30102. this.jSPlugin.setDecoderState = this.setDecoderState;
  30103. this.Rec = new Rec(this.jSPlugin);
  30104. }
  30105. // 回放时间轴预留48像素空间
  30106. var _checkTimer3 = setInterval(function () {
  30107. if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
  30108. clearInterval(_checkTimer3);
  30109. // 检测到渲染回放时间轴,执行一次reSize
  30110. // this.jSPlugin.reSize(this.jSPlugin.params.width, this.jSPlugin.params.height);
  30111. }
  30112. }, 50);
  30113. }
  30114. }
  30115. var isNeedRenderPTZ = lodash.findIndex(this.themeData.footer.btnList, function (v) {
  30116. return v.iconId === 'pantile' && v.isrender === 1;
  30117. }) >= 0 && !this.jSPlugin.disabledPTZ;
  30118. if (isNeedRenderPTZ) {
  30119. if (this.isMobile) {
  30120. this.MobilePtz = new MobilePtz(this.jSPlugin);
  30121. }
  30122. this.Ptz = new Ptz(this.jSPlugin);
  30123. }
  30124. // 监听全屏事件触发
  30125. var fullscreenchange = function fullscreenchange() {
  30126. var _this11$decoderState$ = _this11.decoderState.state,
  30127. expend = _this11$decoderState$.expend,
  30128. webExpend = _this11$decoderState$.webExpend;
  30129. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  30130. if (!isFullScreen) {
  30131. _this11.jSPlugin.jSPlugin.JS_Resize(_this11.jSPlugin.width, _this11.jSPlugin.height);
  30132. if (expend) {
  30133. _this11.setDecoderState({
  30134. expend: false
  30135. });
  30136. }
  30137. if (webExpend) {
  30138. _this11.setDecoderState({
  30139. webExpend: false
  30140. });
  30141. }
  30142. }
  30143. if (_this11.jSPlugin.Theme.Rec) {
  30144. _this11.jSPlugin.Theme.Rec.recAutoSize();
  30145. }
  30146. };
  30147. ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
  30148. window.addEventListener(item, function (data) {
  30149. return fullscreenchange();
  30150. });
  30151. });
  30152. // // 判断是否配置封面
  30153. if (this.themeData.poster) {
  30154. this.jSPlugin.poster = this.themeData.poster;
  30155. var checkTimer = setInterval(function () {
  30156. if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
  30157. clearInterval(checkTimer);
  30158. _this11.jSPlugin.setPoster(_this11.themeData.poster);
  30159. }
  30160. }, 50);
  30161. }
  30162. this.inited = true;
  30163. //设备信息
  30164. this.getDeviceInfo();
  30165. }
  30166. //xuehb 重置手机端电子放大状态
  30167. }, {
  30168. key: "resetMobileZoomStatus",
  30169. value: function resetMobileZoomStatus() {
  30170. if (this.isMobile) {
  30171. var zoomidDom = document.getElementById("".concat(this.jSPlugin.id, "-zoom-container"));
  30172. if (zoomidDom && zoomidDom.style && zoomidDom.style.display != 'none') {
  30173. console.log('结束电子放大');
  30174. zoomidDom.style.display = "none";
  30175. }
  30176. //xuehb 重置放大倍数
  30177. this.jSPlugin.Zoom.resetZoom();
  30178. }
  30179. }
  30180. }, {
  30181. key: "getDeviceInfo",
  30182. value: function getDeviceInfo() {
  30183. var _this12 = this;
  30184. var deviceAPISuccess = function deviceAPISuccess(data) {
  30185. if (data.code == 200 && data.data) {
  30186. if (data.data.isEncrypt) {
  30187. setTimeout(function () {
  30188. _this12.pluginStatus.loadingClear();
  30189. _this12.pluginStatus.loadingSetText({
  30190. text: "设备已加密",
  30191. color: 'red'
  30192. });
  30193. }, 1500);
  30194. }
  30195. // 设备序列号
  30196. if (document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content"))) {
  30197. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.maxWidth = "100%";
  30198. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.overflow = "hidden";
  30199. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.textOverflow = "ellipsis";
  30200. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.whiteSpace = "nowrap";
  30201. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).innerHTML = data.data.deviceName;
  30202. }
  30203. // 设备序列号
  30204. if (document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content"))) {
  30205. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.maxWidth = "100%";
  30206. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.overflow = "hidden";
  30207. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.textOverflow = "ellipsis";
  30208. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.whiteSpace = "nowrap";
  30209. document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).innerHTML = matchEzopenUrl(_this12.jSPlugin.url).deviceSerial;
  30210. }
  30211. }
  30212. };
  30213. request(this.jSPlugin.env.domain + '/api/lapp/device/info', 'POST', {
  30214. accessToken: this.jSPlugin.accessToken,
  30215. deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial
  30216. }, '', deviceAPISuccess);
  30217. }
  30218. }, {
  30219. key: "editStart",
  30220. value: function editStart(callback) {
  30221. var audioControlsDOM = document.getElementById("".concat(this.jSPlugin.id, "-audioControls"));
  30222. var headerMessageDOM = document.getElementById("".concat(this.jSPlugin.id, "-headControl"));
  30223. if (headerMessageDOM) {
  30224. headerMessageDOM.setAttribute('class', 'header-controls themeEditing');
  30225. }
  30226. if (audioControlsDOM) {
  30227. audioControlsDOM.setAttribute('class', 'footer-controls themeEditing');
  30228. }
  30229. this.setDecoderState({
  30230. isEditing: true
  30231. });
  30232. }
  30233. }, {
  30234. key: "editEnd",
  30235. value: function editEnd(callback) {
  30236. var audioControlsDOM = document.getElementById("".concat(this.jSPlugin.id, "-audioControls"));
  30237. var headerMessageDOM = document.getElementById("".concat(this.jSPlugin.id, "-headControl"));
  30238. if (headerMessageDOM) {
  30239. headerMessageDOM.setAttribute('class', 'header-controls');
  30240. }
  30241. if (audioControlsDOM) {
  30242. audioControlsDOM.setAttribute('class', 'footer-controls');
  30243. }
  30244. this.setDecoderState({
  30245. isEditing: false
  30246. });
  30247. }
  30248. }, {
  30249. key: "webExpend",
  30250. value: function webExpend() {
  30251. var _this13 = this;
  30252. var _this$decoderState$st2 = this.decoderState.state;
  30253. _this$decoderState$st2.webExpend;
  30254. var expend = _this$decoderState$st2.expend,
  30255. play = _this$decoderState$st2.play;
  30256. if (!play) {
  30257. return false;
  30258. }
  30259. if (expend) {
  30260. console.log("正在全局全屏");
  30261. return false;
  30262. }
  30263. console.log("执行网页全屏");
  30264. var footerDOMHeight = 0;
  30265. var headerDOMHeight = 0;
  30266. // ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach((item) => {
  30267. // window.addEventListener(item, (data) => fullscreenchange("fullscreenchange", data));
  30268. // });
  30269. // // 监听全屏事件触发
  30270. // function fullscreenchange() {
  30271. // let isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  30272. // return isFullScreen;
  30273. // }
  30274. var promise = requestFullScreenPromise(document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
  30275. promise.then(function (data) {
  30276. console.log("全屏promise", window.screen.width);
  30277. if (document.getElementById("".concat(_this13.jSPlugin.id, "-canvas-container"))) {
  30278. footerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this13.jSPlugin.id, "-canvas-container"))).height, 10);
  30279. }
  30280. if (document.getElementById("".concat(_this13.jSPlugin.id, "-headControl"))) {
  30281. headerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this13.jSPlugin.id, "-headControl"))).height, 10);
  30282. }
  30283. console.log("this.jSPlugin.JS_Resiz", footerDOMHeight, headerDOMHeight, document.body.clientWidth);
  30284. _this13.jSPlugin.jSPlugin.JS_Resize(window.screen.width, window.screen.height - footerDOMHeight - headerDOMHeight);
  30285. })["catch"](function (err) {
  30286. console.log(err);
  30287. });
  30288. }
  30289. }, {
  30290. key: "expend",
  30291. value: function expend() {
  30292. var _this14 = this;
  30293. var _this$decoderState$st3 = this.decoderState.state,
  30294. webExpend = _this$decoderState$st3.webExpend;
  30295. _this$decoderState$st3.expend;
  30296. var play = _this$decoderState$st3.play;
  30297. _this$decoderState$st3.pantile;
  30298. if (!play) {
  30299. return false;
  30300. }
  30301. if (webExpend) {
  30302. console.log("正在网站全屏");
  30303. return false;
  30304. }
  30305. console.log("执行全局全屏");
  30306. if (this.isMobile) {
  30307. var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(this.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).height, 10);
  30308. requestMobileFullScreen(document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
  30309. setTimeout(function () {
  30310. var width = document.documentElement.clientWidth;
  30311. var height = document.documentElement.clientHeight;
  30312. // 兼容微信浏览器footer被隐藏
  30313. // document.getElementById(`${this.jSPlugin.id}-ez-iframe-footer-container`).style.marginTop = "0px";
  30314. // document.getElementById(`${this.jSPlugin.id}-headControl`).style.position = "absolute";
  30315. document.getElementById("".concat(_this14.jSPlugin.id)).style["backface-visibility"] = "hidden";
  30316. _this14.jSPlugin.jSPlugin.JS_Resize(height, width - heightIntercept);
  30317. }, 100);
  30318. } else {
  30319. var promise = requestFullScreenPromise(document.getElementById("".concat(this.jSPlugin.id)));
  30320. promise.then(function (data) {
  30321. _this14.jSPlugin.jSPlugin.JS_Resize(window.screen.width, window.screen.height);
  30322. })["catch"](function (err) {
  30323. console.log(err);
  30324. });
  30325. }
  30326. }
  30327. }]);
  30328. return Theme;
  30329. }();
  30330. Date.prototype.Format = function (fmt) {
  30331. //author: meizz
  30332. var o = {
  30333. "M+": this.getMonth() + 1,
  30334. //月份
  30335. "d+": this.getDate(),
  30336. //日
  30337. "h+": this.getHours(),
  30338. //小时
  30339. "m+": this.getMinutes(),
  30340. //分
  30341. "s+": this.getSeconds(),
  30342. //秒
  30343. "q+": Math.floor((this.getMonth() + 3) / 3),
  30344. //季度
  30345. "S": this.getMilliseconds() //毫秒
  30346. };
  30347. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  30348. for (var k in o) {
  30349. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  30350. }
  30351. return fmt;
  30352. };
  30353. var Monitor = /*#__PURE__*/function () {
  30354. function Monitor(params, jsPlugin) {
  30355. _classCallCheck$1(this, Monitor);
  30356. this.params = params;
  30357. this.state = {};
  30358. this.jsPlugin = jsPlugin;
  30359. this.url = "https://log.ys7.com/statistics.do?";
  30360. if (params.env) {
  30361. switch (params.env) {
  30362. case 'test12':
  30363. this.url = "https://test12dclog.ys7.com/statistics.do?";
  30364. break;
  30365. case 'online':
  30366. break;
  30367. default:
  30368. this.url = params.env;
  30369. break;
  30370. }
  30371. }
  30372. }
  30373. /** 生成uuid */
  30374. _createClass$1(Monitor, [{
  30375. key: "uuid",
  30376. value: function uuid() {
  30377. var s = [];
  30378. var hexDigits = "0123456789abcdef";
  30379. for (var i = 0; i < 36; i++) {
  30380. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  30381. }
  30382. s[14] = "4";
  30383. s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
  30384. s[8] = s[13] = s[18] = s[23] = "-";
  30385. var uuid = s.join("");
  30386. return uuid;
  30387. }
  30388. }, {
  30389. key: "dclog",
  30390. value: function dclog(dclogObj) {
  30391. var imgUrl = this.url;
  30392. var obj = Object.assign({}, {
  30393. systemName: "open_website_monitor"
  30394. }, {
  30395. bn: "ezuikit-js"
  30396. }, dclogObj, {
  30397. un: dclogObj.url
  30398. }, {
  30399. st: new Date().getTime(),
  30400. h: window.location.pathname
  30401. }); // usr_name 更改为un,兼容旧
  30402. Object.keys(obj).forEach(function (item, index) {
  30403. var value = obj[item];
  30404. if (typeof obj[item] === 'string') {
  30405. value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
  30406. }
  30407. if (typeof obj[item] === 'undefined') {
  30408. return;
  30409. }
  30410. imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
  30411. });
  30412. var img = new Image();
  30413. img.src = imgUrl;
  30414. }
  30415. }, {
  30416. key: "localInfoLog",
  30417. value: function localInfoLog(dclogObj) {
  30418. var imgUrl = this.url;
  30419. // var obj = Object.assign({}, { systemName: "open_netstream_localinfo" }, dclogObj, {un:dclogObj.url}, { st: new Date().getTime(), h: window.location.pathname }); // usr_name 更改为un,兼容旧
  30420. var domain = window.location.protocol + '//' + window.location.host;
  30421. var obj = {
  30422. systemName: "open_netstream_localinfo",
  30423. Ver: 'v6.0.0',
  30424. PlatAddr: domain,
  30425. ExterVer: 'v6.0.0',
  30426. OpId: this.uuid(),
  30427. CltType: 102,
  30428. AppId: "",
  30429. playurl: encodeURIComponent(this.jsPlugin.url),
  30430. StartTime: new Date().Format('yyyy-MM-dd hh:mm:ss.S'),
  30431. // 每个日志包含当前的时间
  30432. OS: navigator.platform
  30433. };
  30434. obj = Object.assign(obj, dclogObj);
  30435. Object.keys(obj).forEach(function (item, index) {
  30436. var value = obj[item];
  30437. if (typeof obj[item] === 'string') {
  30438. value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
  30439. }
  30440. if (typeof obj[item] === 'undefined') {
  30441. return;
  30442. }
  30443. imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
  30444. });
  30445. var img = new Image();
  30446. img.src = imgUrl;
  30447. }
  30448. }, {
  30449. key: "playLog",
  30450. value: function playLog(dclogObj) {
  30451. var url = this.url;
  30452. var imgUrl = url;
  30453. var obj = {
  30454. systemName: "open_netstream_play_main",
  30455. playurl: encodeURIComponent(this.jsPlugin.url),
  30456. Time: new Date().Format('yyyy-MM-dd hh:mm:ss.S'),
  30457. //Enc: 0, // 0 不加密 1 加密
  30458. //PlTp: PlTp, // 1 直播 2 回放
  30459. Via: 2,
  30460. // 2 服务端取流
  30461. //ErrCd: 0,
  30462. OpId: this.uuid()
  30463. //Cost: (new Date()).getTime() - _this.initTime, // 毫秒数
  30464. //Serial: getQueryString('dev', item),
  30465. //Channel: getQueryString('chn', item),
  30466. };
  30467. obj = Object.assign(obj, dclogObj);
  30468. Object.keys(obj).forEach(function (item, index) {
  30469. var value = obj[item];
  30470. if (typeof obj[item] === 'string') {
  30471. value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
  30472. }
  30473. if (typeof obj[item] === 'undefined') {
  30474. return;
  30475. }
  30476. imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
  30477. });
  30478. var img = new Image();
  30479. img.src = imgUrl;
  30480. }
  30481. }]);
  30482. return Monitor;
  30483. }();
  30484. (function (global, factory) {
  30485. if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  30486. module.exports = global.document ? factory(global, true) : function (w) {
  30487. if (!w.document) {
  30488. throw new Error("EZUIPlayer requires a window with a document");
  30489. }
  30490. return factory(w);
  30491. };
  30492. } else {
  30493. factory(global);
  30494. } // Pass this if window is not defined yet
  30495. })(typeof window !== "undefined" ? window : void 0, function (window, noGlobal) {
  30496. var _state;
  30497. // 加载js
  30498. function addJs(filepath, callback) {
  30499. var headerScript = document.getElementsByTagName('head')[0].getElementsByTagName("script");
  30500. var isReady = false;
  30501. for (var i = 0; i < headerScript.length; i++) {
  30502. if (headerScript[i].getAttribute("src") == filepath) {
  30503. isReady = true;
  30504. callback();
  30505. }
  30506. }
  30507. if (!isReady) {
  30508. var oJs = document.createElement("script");
  30509. oJs.setAttribute("src", filepath);
  30510. oJs.onload = callback;
  30511. document.getElementsByTagName("head")[0].appendChild(oJs);
  30512. }
  30513. } // 加载css
  30514. function addCss(filepath, callback) {
  30515. var headerLink = document.getElementsByTagName('head')[0].getElementsByTagName("link");
  30516. var isReady = false;
  30517. for (var i = 0; i < headerLink.length; i++) {
  30518. if (headerLink[i].getAttribute("href") == filepath) {
  30519. isReady = true;
  30520. callback();
  30521. }
  30522. }
  30523. if (!isReady) {
  30524. var oJs = document.createElement('link');
  30525. oJs.rel = 'stylesheet';
  30526. oJs.type = 'text/css';
  30527. oJs.href = filepath;
  30528. oJs.onload = callback;
  30529. document.getElementsByTagName("head")[0].appendChild(oJs);
  30530. }
  30531. } // 通用请求方法
  30532. function request(url, method, params, header, success, error) {
  30533. var _url = url;
  30534. var http_request = new XMLHttpRequest();
  30535. http_request.onreadystatechange = function () {
  30536. if (http_request.readyState == 4) {
  30537. if (http_request.status == 200) {
  30538. var _data = JSON.parse(http_request.responseText);
  30539. success(_data);
  30540. }
  30541. }
  30542. };
  30543. http_request.open(method, _url, true); // http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  30544. var data = new FormData();
  30545. for (var i in params) {
  30546. data.append(i, params[i]);
  30547. }
  30548. http_request.send(data);
  30549. }
  30550. var EZUIKit = {
  30551. EZUIKitPlayer: undefined,
  30552. EZUIKitTalk: undefined,
  30553. opt: {
  30554. apiDomain: 'https://open.ys7.com/api/lapp/live/talk/url',
  30555. filePath: 'https://open.ys7.com/assets/ezuikit_v2.6.4',
  30556. accessToken: '',
  30557. url: '',
  30558. deviceSerial: '',
  30559. channelNo: '',
  30560. id: '',
  30561. talkLink: '',
  30562. rtcUrl: '',
  30563. ttsUrl: '',
  30564. stream: '',
  30565. // 对讲插件依赖
  30566. isReliesReady: false,
  30567. template: 'simple',
  30568. plugin: [],
  30569. // 加载插件,talk-对讲
  30570. audio: 1,
  30571. // 声音id 0-不开启 1-开启
  30572. autoplay: 1,
  30573. videoLoading: false
  30574. },
  30575. state: (_state = {
  30576. countTimer: undefined,
  30577. // countTime 计时器
  30578. recodeTime: 0,
  30579. // 录音时间
  30580. recodeTimer: undefined
  30581. }, _defineProperty(_state, "recodeTime", 0), _defineProperty(_state, "fetchDefaultList", false), _defineProperty(_state, "page", 0), _defineProperty(_state, "pageSize", 5), _state),
  30582. handleTalkSuccess: function handleTalkSuccess() {},
  30583. handleTalkError: function handleTalkError() {}
  30584. };
  30585. /**
  30586. * 视频播放器-开始
  30587. */
  30588. var domain = "https://open.ys7.com";
  30589. var filePathDomain = domain;
  30590. var EZUIKitPlayer = function EZUIKitPlayer(params) {
  30591. var _this = this;
  30592. this.opt = {
  30593. id: params.id,
  30594. apiDomain: domain + '/api/lapp/live/talk/url',
  30595. filePath: filePathDomain + '/assets/ezuikit_v2.6.4',
  30596. decoderVersion: '',
  30597. accessToken: '',
  30598. url: '',
  30599. deviceSerial: '',
  30600. channelNo: '',
  30601. talkLink: '',
  30602. rtcUrl: '',
  30603. ttsUrl: '',
  30604. stream: '',
  30605. // 对讲插件依赖
  30606. isReliesReady: false,
  30607. template: 'simple',
  30608. plugin: [],
  30609. // 加载插件,talk-对讲
  30610. audio: 1,
  30611. // 声音id 0-不开启 1-开启
  30612. autoplay: 1,
  30613. fullScreenStatus: 0,
  30614. bSupporDoubleClickFull: true,
  30615. videoLoading: false
  30616. };
  30617. this.params = params;
  30618. if (params.id) {
  30619. this.opt.id = params.id;
  30620. }
  30621. if (params.accessToken) {
  30622. this.opt.accessToken = params.accessToken;
  30623. }
  30624. if (typeof params.audio !== 'undefined') {
  30625. this.opt.audio = params.audio;
  30626. }
  30627. if (typeof params.decoderVersion !== 'undefined') {
  30628. this.opt.decoderVersion = params.decoderVersion;
  30629. }
  30630. if (typeof params.env !== 'undefined') {
  30631. if (typeof params.env.domain !== 'undefined') {
  30632. domain = params.env.domain;
  30633. this.opt.apiDomain = domain + '/api/lapp/live/talk/url';
  30634. }
  30635. if (typeof params.env.filePathDomain !== 'undefined') {
  30636. filePathDomain = params.env.filePathDomain;
  30637. this.opt.filePathDomain = params.env.filePathDomain;
  30638. }
  30639. }
  30640. // if(typeof params.domain !== 'undefined'){
  30641. // this.opt.apiDomain = params.domain + '/api/lapp/live/talk/url';
  30642. // }
  30643. if (params.url) {
  30644. this.opt.url = params.url;
  30645. this.opt.deviceSerial = params.url.split("/")[3];
  30646. this.opt.channelNo = params.url.split("/")[4].split(".")[0];
  30647. }
  30648. if (typeof params.template !== 'undefined') {
  30649. this.opt.template = params.template;
  30650. }
  30651. if (params.plugin) {
  30652. this.opt.plugin = params.plugin;
  30653. }
  30654. if (typeof params.autoplay !== 'undefined') {
  30655. this.opt.autoplay = params.autoplay ? 1 : 0;
  30656. }
  30657. if (typeof params.bSupporDoubleClickFull !== 'undefined') {
  30658. this.opt.bSupporDoubleClickFull = params.bSupporDoubleClickFull;
  30659. }
  30660. if (typeof params.handleTalkSuccess !== 'undefined') {
  30661. window.EZUIKit.handleTalkSuccess = params.handleTalkSuccess;
  30662. }
  30663. if (typeof params.handleTalkError !== 'undefined') {
  30664. window.EZUIKit.handleTalkError = params.handleTalkError;
  30665. }
  30666. var id = this.opt.id;
  30667. var domElement = document.getElementById(id); // 间隙
  30668. domElement.style.fontSize = 0;
  30669. domElement.style.overflowY = 'auto';
  30670. domElement.style.position = 'relative';
  30671. /**
  30672. * 渲染iframe视频框
  30673. */
  30674. var iframe = document.createElement('iframe');
  30675. function matchIframeUrl() {
  30676. switch (_this.opt.template) {
  30677. case 'simple':
  30678. var iframeUrl = domain + "/ezopen/h5/iframe?bSupporDoubleClickFull=0&url=" + _this.opt.url.replace("?", "&") + "&autoplay=" + _this.opt.autoplay + "&audio=" + _this.opt.audio + "&accessToken=" + params.accessToken + "&templete=0" + "&id=" + id + "&decoderVersion=" + _this.opt.decoderVersion;
  30679. var controlsValue = "";
  30680. if (typeof params.controls !== 'undefined' && params.controls) {
  30681. console.log("typeof", _typeof(params.controls));
  30682. controlsValue = "play,voice,hd,fullScreen";
  30683. if (params.controls.length > 0) {
  30684. controlsValue = params.controls.join(",");
  30685. iframeUrl += '&controls=' + controlsValue;
  30686. }
  30687. }
  30688. if (params.websocketParams) {
  30689. iframeUrl += '&websocketParams=' + JSON.stringify(params.websocketParams);
  30690. }
  30691. return iframeUrl;
  30692. case 'standard':
  30693. return domain + "/ezopen/h5/iframe?bSupporDoubleClickFull=0&url=" + _this.opt.url.replace("?", "&") + "&autoplay=" + _this.opt.autoplay + "&audio=" + _this.opt.audio + "&accessToken=" + params.accessToken + "&templete=1" + "&id=" + id + "&decoderVersion=" + _this.opt.decoderVersion;
  30694. case 'security':
  30695. return domain + "/ezopen/h5/iframe_se?bSupporDoubleClickFull=0&url=" + _this.opt.url.replace("?", "&") + "&autoplay=" + _this.opt.autoplay + "&audio=" + _this.opt.audio + "&accessToken=" + params.accessToken + "&templete=0" + "&id=" + id + "&decoderVersion=" + _this.opt.decoderVersion;
  30696. case 'theme':
  30697. iframeUrl = domain + "/jssdk/theme.html?url=".concat(params.url, "&accessToken=").concat(params.accessToken, "&id=").concat(id, "&isMobile=").concat(params.isMobile);
  30698. if (typeof params.isMobile !== 'undefined') {
  30699. iframeUrl += '&isMobile=' + params.isMobile;
  30700. }
  30701. if (typeof params.autoplay !== 'undefined') {
  30702. iframeUrl += '&autoplay=' + params.autoplay;
  30703. }
  30704. if (typeof params.domain !== 'undefined') {
  30705. if (params.domain == 'https://test12open.ys7.com') iframeUrl += '&env=' + 'test12';
  30706. }
  30707. if (typeof params.env !== 'undefined') {
  30708. if (typeof params.env.domain !== 'undefined') {
  30709. if (params.env.domain == 'https://test12open.ys7.com') {
  30710. iframeUrl += '&env=' + 'test12';
  30711. }
  30712. }
  30713. }
  30714. if (typeof params.header !== 'undefined') {
  30715. iframeUrl += '&header=' + params.header;
  30716. }
  30717. return iframeUrl;
  30718. default:
  30719. return domain + "/ezopen/h5/iframe?bSupporDoubleClickFull=0&url=" + _this.opt.url.replace("?", "&") + "&autoplay=" + _this.opt.autoplay + "&audio=" + _this.opt.audio + "&accessToken=" + params.accessToken + "&templete=0" + "&id=" + id + "&decoderVersion=" + _this.opt.decoderVersion;
  30720. }
  30721. }
  30722. iframe.src = matchIframeUrl(); // 默认取容器宽高
  30723. var iframeHeight = document.getElementById(id).offsetHeight;
  30724. var iframeWidth = document.getElementById(id).offsetWidth;
  30725. if (params.height) {
  30726. iframeHeight = parseInt(params.height);
  30727. if (/\%$/.test(params.height)) {
  30728. iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.height) / 100);
  30729. }
  30730. }
  30731. if (params.width) {
  30732. iframeWidth = parseInt(params.width);
  30733. if (/\%$/.test(params.width)) {
  30734. iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.width) / 100);
  30735. }
  30736. }
  30737. iframe.width = iframeWidth;
  30738. iframe.height = iframeHeight;
  30739. iframe.id = 'EZUIKitPlayer-' + id; // 部分iframe属性
  30740. iframe.setAttribute("allowfullscreen", true);
  30741. iframe.setAttribute("allow", "autoplay");
  30742. iframe.setAttribute("frameborder", 0);
  30743. domElement.appendChild(iframe);
  30744. var jqueryJS = _this.opt.filePath + '/js/jquery.js';
  30745. var layerJs = 'https://open.ys7.com/assets/layer/layer.js';
  30746. addJs(jqueryJS, function () {
  30747. addJs(layerJs, function () {
  30748. // });
  30749. // });
  30750. /**
  30751. * 渲染header
  30752. */
  30753. if (matchHeaderOpt().headerContainer) {
  30754. // if (params.header && params.header instanceof Array) {
  30755. var headerContainer = document.createElement('div');
  30756. headerContainer.setAttribute('class', 'panel-top');
  30757. var controsDOM = document.createElement('div');
  30758. controsDOM.setAttribute('class', 'contros');
  30759. headerContainer.appendChild(controsDOM);
  30760. domElement.insertBefore(headerContainer, iframe);
  30761. if (matchHeaderOpt().capturePictureModule) {
  30762. // 截图
  30763. var capturePictureDOM = document.createElement('span');
  30764. capturePictureDOM.innerHTML = '<span title="截图">' + '<svg id="capturePicture" title="截图" t="1578882764585" class="icon" viewBox="0 0 1024 1024" version="1.1"' + ' xmlns="http://www.w3.org/2000/svg" p-id="5958" width="24" height="24">' + ' <path' + ' d="M887.296 315.904h-153.6c-51.2 0-68.096-102.4-119.296-102.4H392.704c-34.304 0-51.2 102.4-102.4 102.4h-153.6c-29.696 0-51.2 21.504-51.2 51.2v439.296c0 25.6 21.504 47.104 51.2 47.104h751.104c29.696 0 51.2-21.504 51.2-51.2v-435.2c-0.512-30.208-21.504-51.2-51.712-51.2zM512 768c-115.2 0-204.8-89.6-204.8-200.704s89.6-200.704 204.8-200.704 204.8 89.6 204.8 200.704-93.696 200.704-204.8 200.704z m247.296-354.304c-12.8 0-25.6-12.8-25.6-25.6s12.8-25.6 25.6-25.6 25.6 12.8 25.6 25.6c0 17.408-12.8 25.6-25.6 25.6zM256 264.704c0-8.704-8.704-16.896-16.896-16.896h-51.2c-8.704 0-16.896 8.704-16.896 16.896V281.6H256v-16.896z m256 148.992c-85.504 0-153.6 68.096-153.6 153.6s68.096 153.6 153.6 153.6 153.6-68.096 153.6-153.6-68.096-153.6-153.6-153.6z"' + ' fill="#ffffff" p-id="5959"></path>' + '</svg>' + '</span>';
  30765. capturePictureDOM.onclick = function () {
  30766. _this.capturePicture();
  30767. };
  30768. controsDOM.appendChild(capturePictureDOM);
  30769. }
  30770. console.log("matchHeaderOpt().saveModule", matchHeaderOpt().saveModule);
  30771. if (matchHeaderOpt().saveModule) {
  30772. var startSaveDOM = document.createElement('span');
  30773. startSaveDOM.innerHTML = '<span title="开始录像">' + ' <svg id="startSave" t="1578882716693" class="icon" viewBox="0 0 1024 1024" version="1.1"' + ' xmlns="http://www.w3.org/2000/svg" p-id="3782" width="24" height="24">' + ' <path' + ' d="M915.2 729.6l-128-76.8c-25.6-12.8-44.8-32-44.8-51.2V435.2c0-25.6 19.2-38.4 44.8-51.2l128-76.8c25.6-12.8 44.8 0 44.8 19.2V704c0 32-19.2 38.4-44.8 25.6z m-332.8 89.6H96c-51.2 0-89.6-38.4-89.6-89.6V332.8c0-51.2 38.4-89.6 89.6-89.6h486.4c51.2 0 89.6 38.4 89.6 89.6v396.8c0 51.2-38.4 89.6-89.6 89.6zM192 364.8c-32 6.4-57.6 32-64 64-12.8 57.6 38.4 115.2 96 102.4 32-6.4 57.6-32 64-70.4 12.8-57.6-38.4-108.8-96-96z m0 0"' + ' p-id="3783" fill="#ffffff"></path>' + ' </svg>' + '</span>';
  30774. startSaveDOM.onclick = function () {
  30775. _this.startSave();
  30776. document.getElementById('startSave').setAttribute('class', 'icon hide');
  30777. document.getElementById('stopSave').setAttribute('class', 'icon');
  30778. };
  30779. controsDOM.appendChild(startSaveDOM);
  30780. var stopSaveDOM = document.createElement('span');
  30781. stopSaveDOM.innerHTML = '<span title="结束录像">' + ' <svg id="stopSave" t="1578882716693" class="icon hide" viewBox="0 0 1024 1024" version="1.1"' + ' xmlns="http://www.w3.org/2000/svg" p-id="3782" width="24" height="24">' + ' <path' + ' d="M915.2 729.6l-128-76.8c-25.6-12.8-44.8-32-44.8-51.2V435.2c0-25.6 19.2-38.4 44.8-51.2l128-76.8c25.6-12.8 44.8 0 44.8 19.2V704c0 32-19.2 38.4-44.8 25.6z m-332.8 89.6H96c-51.2 0-89.6-38.4-89.6-89.6V332.8c0-51.2 38.4-89.6 89.6-89.6h486.4c51.2 0 89.6 38.4 89.6 89.6v396.8c0 51.2-38.4 89.6-89.6 89.6zM192 364.8c-32 6.4-57.6 32-64 64-12.8 57.6 38.4 115.2 96 102.4 32-6.4 57.6-32 64-70.4 12.8-57.6-38.4-108.8-96-96z m0 0"' + ' p-id="3783" fill="red"></path>' + ' </svg>' + ' </span>';
  30782. stopSaveDOM.onclick = function () {
  30783. _this.stopSave();
  30784. document.getElementById('stopSave').setAttribute('class', 'icon hide');
  30785. document.getElementById('startSave').setAttribute('class', 'icon');
  30786. };
  30787. controsDOM.appendChild(stopSaveDOM);
  30788. }
  30789. if (matchHeaderOpt().zoomModule) {
  30790. var enableZoomDOM = document.createElement('span');
  30791. enableZoomDOM.innerHTML = '<span title="开启电子放大">' + ' <svg id="enableZoom" t="1578882639834" class="icon" viewBox="0 0 1000 1000" version="1.1"' + ' xmlns="http://www.w3.org/2000/svg" p-id="2227" width="24" height="24">' + ' <path' + ' d="M830.6119 441.1089c0-193.7756-157.0939-350.8641-350.8775-350.8641S128.8559 247.3333 128.8559 441.1089 285.9508 791.972 479.7344 791.972 830.6119 634.8845 830.6119 441.1089zM483.2821 710.4863c-146.7975 0-265.8187-118.9953-265.8187-265.8088S336.4847 178.8697 483.2821 178.8697s265.8197 118.9953 265.8197 265.8078S630.0796 710.4863 483.2821 710.4863zM770.6031 653.5739l-72.6417 75.9485 141.6917 160.1814 82.0737-90.0739L770.6031 653.5739zM527.5849 267.4727h-88.60655762279428v132.90489048425167H306.0690340253259v88.60292721534799h132.90933675248866v132.9038911617923h88.60655762279428V488.9794719180395h132.90933675248866v-88.60292721534799H527.5849284006089V267.4726535408993z"' + ' p-id="2228" fill="#ffffff"></path>' + ' </svg>' + '</span>';
  30792. enableZoomDOM.onclick = function () {
  30793. _this.enableZoom();
  30794. document.getElementById('enableZoom').setAttribute('class', 'icon hide');
  30795. document.getElementById('closeZoom').setAttribute('class', 'icon');
  30796. };
  30797. controsDOM.appendChild(enableZoomDOM);
  30798. var closeZoomDOM = document.createElement('span');
  30799. closeZoomDOM.innerHTML = '<span title="关闭电子放大">' + ' <svg id="closeZoom" t="1578882639834" class="icon hide" viewBox="0 0 1000 1000" version="1.1"' + ' xmlns="http://www.w3.org/2000/svg" p-id="2227" width="24" height="24">' + ' <path' + ' d="M830.6119 441.1089c0-193.7756-157.0939-350.8641-350.8775-350.8641S128.8559 247.3333 128.8559 441.1089 285.9508 791.972 479.7344 791.972 830.6119 634.8845 830.6119 441.1089zM483.2821 710.4863c-146.7975 0-265.8187-118.9953-265.8187-265.8088S336.4847 178.8697 483.2821 178.8697s265.8197 118.9953 265.8197 265.8078S630.0796 710.4863 483.2821 710.4863zM770.6031 653.5739l-72.6417 75.9485 141.6917 160.1814 82.0737-90.0739L770.6031 653.5739zM527.5849 267.4727h-88.60655762279428v132.90489048425167H306.0690340253259v88.60292721534799h132.90933675248866v132.9038911617923h88.60655762279428V488.9794719180395h132.90933675248866v-88.60292721534799H527.5849284006089V267.4726535408993z"' + ' p-id="2228" fill="red"></path>' + ' </svg>' + '</span>';
  30800. closeZoomDOM.onclick = function () {
  30801. _this.closeZoom();
  30802. document.getElementById('closeZoom').setAttribute('class', 'icon hide');
  30803. document.getElementById('enableZoom').setAttribute('class', 'icon');
  30804. };
  30805. controsDOM.appendChild(closeZoomDOM);
  30806. }
  30807. }
  30808. /**
  30809. * 渲染footer
  30810. */
  30811. /** 根据配置匹配底部渲染 */
  30812. function matchFooterOpt() {
  30813. var result = {
  30814. footerContainer: false,
  30815. talkModule: false,
  30816. broadcastModule: false,
  30817. hdModule: false,
  30818. fullScreenModule: false
  30819. };
  30820. var template = _this.opt.template;
  30821. switch (template) {
  30822. case 'simple':
  30823. if (params.footer && params.footer instanceof Array) {
  30824. var footer = params.footer;
  30825. result = {
  30826. footerContainer: true,
  30827. talkModule: footer.indexOf('talk') !== -1,
  30828. broadcastModule: footer.indexOf('broadcast') !== -1,
  30829. hdModule: footer.indexOf('hd') !== -1,
  30830. fullScreenModule: footer.indexOf('fullScreen') !== -1
  30831. };
  30832. }
  30833. break;
  30834. case 'standard':
  30835. if (params.footer && params.footer instanceof Array) {
  30836. var footer = params.footer;
  30837. result = {
  30838. footerContainer: true,
  30839. talkModule: footer.indexOf('talk') !== -1,
  30840. broadcastModule: footer.indexOf('broadcast') !== -1,
  30841. hdModule: footer.indexOf('hd') !== -1,
  30842. fullScreenModule: footer.indexOf('fullScreen') !== -1
  30843. };
  30844. }
  30845. break;
  30846. case 'security':
  30847. break;
  30848. case 'voice':
  30849. result = {
  30850. footerContainer: true,
  30851. talkModule: true,
  30852. broadcastModule: true,
  30853. hdModule: true,
  30854. fullScreenModule: true
  30855. };
  30856. break;
  30857. }
  30858. return result;
  30859. }
  30860. /** 根据配置匹配底部渲染 */
  30861. function matchHeaderOpt() {
  30862. var result = {
  30863. headerContainer: false,
  30864. capturePictureModule: false,
  30865. saveModule: false,
  30866. zoomModule: false
  30867. };
  30868. var template = _this.opt.template;
  30869. switch (template) {
  30870. case 'simple':
  30871. if (params.header && params.header instanceof Array) {
  30872. var header = params.header;
  30873. result = {
  30874. headerContainer: true,
  30875. capturePictureModule: header.indexOf('capturePicture') !== -1,
  30876. saveModule: header.indexOf('save') !== -1,
  30877. zoomModule: header.indexOf('zoom') !== -1
  30878. };
  30879. }
  30880. break;
  30881. case 'standard':
  30882. break;
  30883. case 'security':
  30884. break;
  30885. case 'voice':
  30886. result = {
  30887. headerContainer: true,
  30888. capturePictureModule: true,
  30889. saveModule: true,
  30890. zoomModule: true
  30891. };
  30892. break;
  30893. }
  30894. return result;
  30895. }
  30896. if (matchFooterOpt().footerContainer || _this.opt.plugin.indexOf('talk') !== -1) {
  30897. var recoderCSS = _this.opt.filePath + '/npm/css/recoder.css';
  30898. var recoderJs = _this.opt.filePath + '/npm/js/recoder.js';
  30899. var recorderJs = _this.opt.filePath + '/recorder.js'; // addCss()
  30900. addCss(recoderCSS, function () {});
  30901. addJs(recoderJs, function () {
  30902. addJs(recorderJs, function () {});
  30903. }); // 对讲模块
  30904. if (_this.opt.plugin.indexOf('talk') !== -1 || matchFooterOpt().talkModule) {
  30905. var apiSuccess = function apiSuccess(data) {
  30906. console.log("data", data);
  30907. if (data.code == 200) {
  30908. var apiResult = data.data;
  30909. if (apiResult) {
  30910. // 临时将https转换为websocket
  30911. var rtcTrunk = apiResult.rtcUrl;
  30912. if (rtcTrunk.indexOf("ws") === -1) {
  30913. rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
  30914. }
  30915. _this.opt.rtcUrl = rtcTrunk;
  30916. _this.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
  30917. var talk = "talk://" + _this.opt.deviceSerial + ":0:" + _this.opt.channelNo + ":cas.ys7.com:6500";
  30918. _this.opt.talkLink = _this.opt.ttsUrl + "/" + talk;
  30919. _this.opt.stream = apiResult.stream;
  30920. console.log("_this.opt", _this.opt); // 加载依赖
  30921. if (!_this.opt.isReliesReady) {
  30922. var adapeterJS = _this.opt.filePath + '/npm/js/adapeter.js';
  30923. var janusJS = _this.opt.filePath + '/npm/js/janus.js';
  30924. var ttsJS = _this.opt.filePath + '/npm/js/tts.js';
  30925. console.log("加载jquery.js");
  30926. addJs(adapeterJS, function () {
  30927. console.log("加载adapeter.js");
  30928. addJs(janusJS, function () {
  30929. console.log("加载janus.js");
  30930. addJs(ttsJS, function () {
  30931. console.log("加载tts.js"); // 文件加载完毕;
  30932. _this.opt.isReliesReady = true;
  30933. });
  30934. });
  30935. }, function () {
  30936. return !!window.adapter;
  30937. });
  30938. } // 创建DOM
  30939. if (!document.getElementById("audioleft")) {
  30940. var audioleft = document.createElement('div');
  30941. audioleft.style.display = 'none';
  30942. audioleft.id = 'audioleft';
  30943. document.body.appendChild(audioleft);
  30944. }
  30945. if (!document.getElementById("audioright")) {
  30946. var audioright = document.createElement('div');
  30947. audioright.style.display = 'none';
  30948. audioright.id = 'audioright';
  30949. document.body.appendChild(audioright);
  30950. }
  30951. }
  30952. }
  30953. EZUIKit.opt = _this.opt;
  30954. if (window.EZUIKit) {
  30955. window.EZUIKit.opt = _this.opt;
  30956. }
  30957. };
  30958. request(_this.opt.apiDomain, 'POST', {
  30959. accessToken: _this.opt.accessToken,
  30960. deviceSerial: _this.opt.deviceSerial,
  30961. channelNo: _this.opt.channelNo
  30962. }, '', apiSuccess);
  30963. }
  30964. if (matchFooterOpt().footerContainer) {
  30965. /* 时间计数 */
  30966. var countTime = function countTime(type, start) {
  30967. clearInterval(EZUIKit.state.countTimer);
  30968. if (type === 'add') {
  30969. var i = start;
  30970. EZUIKit.state.countTimer = setInterval(function () {
  30971. ++i;
  30972. document.getElementById("time-area").innerHTML = formatSeconds(i);
  30973. }, 1000);
  30974. } else if (type === 'sub') {
  30975. var i = start;
  30976. EZUIKit.state.countTimer = setInterval(function () {
  30977. if (i > 0) {
  30978. i--;
  30979. document.getElementById("time-area").innerHTML = formatSeconds(i);
  30980. } else {
  30981. clearInterval(EZUIKit.state.countTimer);
  30982. EZUIKit.state.countTimer = undefined;
  30983. console.log("倒计时结束,开启声音"); // decoder.openSound(0);
  30984. }
  30985. }, 1000);
  30986. } else if (type === 'destory') {
  30987. clearInterval(EZUIKit.state.countTimer);
  30988. EZUIKit.state.countTimer = undefined;
  30989. document.getElementById("time-area").innerHTML = '00:00';
  30990. } //将秒数转换为时分秒格式
  30991. function formatSeconds(value) {
  30992. var theTime = parseInt(value); // 秒
  30993. var middle = 0; // 分
  30994. var hour = 0; // 小时
  30995. var secondV = '00';
  30996. var minV = '00';
  30997. var hourV = '00';
  30998. if (theTime > 59) {
  30999. middle = parseInt(theTime / 60);
  31000. theTime = parseInt(theTime % 60);
  31001. if (middle > 59) {
  31002. hour = parseInt(middle / 60);
  31003. middle = parseInt(middle % 60);
  31004. }
  31005. }
  31006. secondV = parseInt(theTime) > 9 ? parseInt(theTime) : '0' + parseInt(theTime);
  31007. minV = parseInt(middle) > 9 ? parseInt(middle) : '0' + parseInt(middle);
  31008. hourV = parseInt(hour) > 9 ? parseInt(hour) : '0' + parseInt(hour);
  31009. if (hour > 0) {
  31010. return hourV + ':' + minV + ':' + secondV;
  31011. } else if (middle > 0) {
  31012. return minV + ':' + secondV;
  31013. } else {
  31014. return '00:' + secondV;
  31015. }
  31016. }
  31017. };
  31018. // 底部容器
  31019. var footerContainer = document.createElement('div');
  31020. footerContainer.setAttribute("class", 'audio-controls');
  31021. domElement.appendChild(footerContainer);
  31022. if (matchFooterOpt().hdModule || matchFooterOpt().fullScreenModule) {
  31023. // 底部右侧元素
  31024. var rightContros = document.createElement('div');
  31025. rightContros.setAttribute('class', 'contros');
  31026. footerContainer.appendChild(rightContros);
  31027. if (matchFooterOpt().hdModule) {
  31028. // 高清-标清切换
  31029. var hdDom = document.createElement('span');
  31030. hdDom.setAttribute('id', 'video-hd');
  31031. hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
  31032. hdDom.onclick = function () {
  31033. // 停止
  31034. if (_this.opt.videoLoading) {
  31035. layer.msg("视频加载中,请稍后");
  31036. return false;
  31037. } else {
  31038. var stopPromise = _this.stop();
  31039. _this.opt.videoLoading = true;
  31040. stopPromise.then(function (data) {
  31041. _this.opt.videoLoading = false;
  31042. if (_this.opt.url.indexOf('.hd') === -1) {
  31043. _this.opt.url = _this.opt.url.replace('.live', '.hd.live');
  31044. hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
  31045. } else {
  31046. _this.opt.url = _this.opt.url.replace('.hd.live', '.live');
  31047. hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
  31048. }
  31049. _this.play(_this.opt.url);
  31050. })["catch"](function (error) {
  31051. console.log("error", error);
  31052. });
  31053. }
  31054. //iframe.src = domain +"/ezopen/h5/iframe?url=" + _this.opt.url.replace('.hd.live', '.live') + "&autoplay=1&audio=" + _this.opt.audio + "&accessToken=" + _this.opt.accessToken + "&templete=" + 0;
  31055. };
  31056. rightContros.appendChild(hdDom);
  31057. }
  31058. if (matchFooterOpt().fullScreenModule) {
  31059. // 声音控制
  31060. var openSoundDOM = document.createElement('span');
  31061. openSoundDOM.setAttribute('class', 'hide');
  31062. openSoundDOM.setAttribute('id', 'ezuikit-open-sound');
  31063. openSoundDOM.setAttribute('title', '打开声音');
  31064. openSoundDOM.setAttribute('style', 'vertical-align: top;');
  31065. openSoundDOM.innerHTML = '<svg t="1590476263239" class="icon" viewBox="0 0 1178 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2273" width="16" height="16"><path d="M665.6 51.2 665.6 51.2c-10.24-30.72-40.96-51.2-71.68-51.2-5.12 0-15.36 0-20.48 5.12l0 0L358.4 153.6 51.2 209.92l0 0C20.48 220.16 0 250.88 0 281.6 0 286.72 0 291.84 0 307.2l0 0 0 409.6 0 0c0 15.36 0 20.48 0 25.6 0 30.72 20.48 61.44 51.2 71.68l0 0L358.4 870.4l97.28 71.68 107.52 76.8 0 0c5.12 5.12 15.36 5.12 25.6 5.12 40.96 0 76.8-35.84 76.8-76.8 0-10.24 0-10.24 0-25.6l0 0L665.6 51.2zM563.2 870.4l-153.6-102.4-307.2-51.2L102.4 307.2l307.2-51.2 153.6-102.4L563.2 870.4z" p-id="2274" fill="#FF0000"></path><path d="M1049.6 537.6l112.64-112.64c20.48-20.48 20.48-56.32 0-76.8-20.48-20.48-56.32-20.48-76.8 0L972.8 460.8l-112.64-112.64c0 0 0 0 0 0-20.48-20.48-56.32-20.48-76.8 0 0 0 0 0 0 0-20.48 20.48-20.48 56.32 0 76.8l112.64 112.64-112.64 112.64c-20.48 20.48-20.48 56.32 0 76.8 20.48 20.48 56.32 20.48 76.8 0L972.8 614.4l112.64 112.64c20.48 20.48 56.32 20.48 76.8 0s20.48-56.32 0-76.8L1049.6 537.6z" p-id="2275" fill="#FF0000"></path></svg>';
  31066. openSoundDOM.onclick = function () {
  31067. _this.openSound(0);
  31068. openSoundDOM.setAttribute('class', 'hide');
  31069. closeSoundDOM.setAttribute('class', '');
  31070. }; // 声音控制
  31071. var closeSoundDOM = document.createElement('span');
  31072. openSoundDOM.setAttribute('id', 'ezuikit-close-sound');
  31073. closeSoundDOM.setAttribute('class', 'hide');
  31074. closeSoundDOM.setAttribute('title', '关闭声音');
  31075. closeSoundDOM.setAttribute('style', 'vertical-align: top;');
  31076. closeSoundDOM.innerHTML = '<svg t="1590414410633" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="20545" width="16" height="16"><path d="M840.533333 98.133333c-17.066667-17.066667-42.666667-17.066667-59.733333 0-17.066667 17.066667-17.066667 42.666667 0 59.733334C883.2 256 938.666667 392.533333 938.666667 533.333333c0 140.8-55.466667 277.333333-157.866667 375.466667-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 21.333333 12.8 29.866667 12.8 8.533333 0 21.333333-4.266667 29.866666-12.8 115.2-110.933333 183.466667-268.8 183.466667-435.2 0-166.4-68.266667-324.266667-183.466667-435.2zM571.733333 12.8c-17.066667-8.533333-34.133333-4.266667-46.933333 8.533333L281.6 256H42.666667c-25.6 0-42.666667 17.066667-42.666667 42.666667v426.666666c0 25.6 17.066667 42.666667 42.666667 42.666667h238.933333l243.2 234.666667c8.533333 8.533333 17.066667 12.8 29.866667 12.8 4.266667 0 12.8 0 17.066666-4.266667 17.066667-8.533333 25.6-21.333333 25.6-38.4V51.2c0-17.066667-8.533333-34.133333-25.6-38.4zM512 870.4l-183.466667-179.2c-8.533333-4.266667-17.066667-8.533333-29.866666-8.533333H85.333333V341.333333h213.333334c12.8 0 21.333333-4.266667 29.866666-12.8L512 153.6v716.8z" p-id="20546" fill="#ffffff"></path><path d="M759.466667 349.866667c-12.8-21.333333-38.4-25.6-59.733334-8.533334-21.333333 12.8-25.6 38.4-8.533333 59.733334 21.333333 29.866667 34.133333 76.8 34.133333 123.733333 0 46.933333-12.8 93.866667-34.133333 123.733333-12.8 21.333333-8.533333 46.933333 8.533333 59.733334 8.533333 4.266667 17.066667 8.533333 25.6 8.533333 12.8 0 25.6-4.266667 34.133334-17.066667 34.133333-46.933333 51.2-106.666667 51.2-174.933333 0-68.266667-17.066667-128-51.2-174.933333z" p-id="20547" fill="#ffffff"></path></svg>';
  31077. closeSoundDOM.onclick = function () {
  31078. _this.closeSound(0);
  31079. openSoundDOM.setAttribute('class', '');
  31080. closeSoundDOM.setAttribute('class', 'hide');
  31081. };
  31082. rightContros.appendChild(openSoundDOM);
  31083. rightContros.appendChild(closeSoundDOM);
  31084. } // 根据当前音频配置展示
  31085. if (_this.opt.audio == 1) {
  31086. closeSoundDOM.setAttribute('class', '');
  31087. } else {
  31088. openSoundDOM.setAttribute('class', '');
  31089. _this.closeSound(0);
  31090. }
  31091. if (matchFooterOpt().fullScreenModule) {
  31092. // 全屏控制
  31093. var fullScreenDOM = document.createElement('span');
  31094. fullScreenDOM.setAttribute('title', '全屏');
  31095. fullScreenDOM.setAttribute('style', 'vertical-align: top;');
  31096. fullScreenDOM.innerHTML = '<svg id="fullScreen" t="1578020167938" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5035" width="16" height="16"> <path d="M348.373333 625.706667l-128 128-64 64v-128a33.28 33.28 0 0 0-35.413333-35.413334A33.493333 33.493333 0 0 0 85.333333 689.706667v213.333333A33.706667 33.706667 0 0 0 120.96 938.666667h213.333333a35.626667 35.626667 0 0 0 0-71.04h-128l64-64 128-128a35.2 35.2 0 0 0-49.92-49.92zM206.293333 156.373333h128a33.28 33.28 0 0 0 35.413334-35.413333A33.493333 33.493333 0 0 0 334.293333 85.333333H113.706667c-7.04 0-14.08 7.04-21.333334 14.293334a26.026667 26.026667 0 0 0-7.04 21.333333v213.333333a33.493333 33.493333 0 0 0 35.626667 35.413334 33.28 33.28 0 0 0 35.413333-35.413334v-128l192 192a35.2 35.2 0 0 0 49.92-49.92zM903.04 85.333333h-213.333333a33.493333 33.493333 0 0 0-35.413334 35.626667 33.28 33.28 0 0 0 35.413334 35.413333h128l-64 64-128 128a35.2 35.2 0 0 0 49.92 49.92l128-128 64-64v128a35.626667 35.626667 0 0 0 71.04 0v-213.333333A33.706667 33.706667 0 0 0 903.04 85.333333zM903.04 654.293333a33.28 33.28 0 0 0-35.413333 35.413334v128l-64-64-128-128a35.2 35.2 0 0 0-49.92 49.92l128 128 64 64h-128a35.626667 35.626667 0 0 0 0 71.04h213.333333A33.706667 33.706667 0 0 0 938.666667 903.04v-213.333333a33.493333 33.493333 0 0 0-35.626667-35.413334z" p-id="5036" fill="#ffffff"></path></svg>';
  31097. fullScreenDOM.onclick = function () {
  31098. _this.fullScreen();
  31099. };
  31100. rightContros.appendChild(fullScreenDOM);
  31101. }
  31102. }
  31103. if (matchFooterOpt().talkModule) {
  31104. // 对讲
  31105. var startTalkDOM = document.createElement('div');
  31106. var stopTalkDOM = document.createElement('div');
  31107. startTalkDOM.setAttribute("class", "ptp-talk off");
  31108. startTalkDOM.innerHTML = '<span title="对讲">' + '<svg t="1581930496966" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1641" width="16" height="16">' + ' <path' + ' d="M715.648 647.872c-30.208-22.336-61.568 39.36-100.992 77.44-39.36 38.08-34.112 31.488-123.392-17.088S311.488 540.224 280 491.648C248.448 443.072 265.472 424.704 265.472 424.704s78.72-62.976 97.152-81.344c18.368-18.368 13.12-30.208 13.12-30.208l-128.64-190.144c-23.616-5.184-64.32 5.12-128.576 57.6C54.208 233.088 30.592 353.856 151.296 575.68c120.768 221.824 347.84 330.752 485.568 374.08 137.856 43.328 228.416-61.696 249.408-103.68 21.056-41.984 13.12-85.312 13.12-85.312S745.856 670.208 715.648 647.872z"' + ' p-id="1642" fill="#ffffff"></path>' + ' <path' + ' d="M715.328 64C580.992 64 472.192 172.864 472.192 307.2s108.8 243.2 243.136 243.2 243.2-108.864 243.2-243.2S849.6 64 715.328 64zM715.328 461.056c-84.992 0-153.856-68.864-153.856-153.856s68.864-153.856 153.856-153.856 153.856 68.928 153.856 153.856S800.32 461.056 715.328 461.056z"' + ' p-id="1643" fill="#ffffff"></path>' + ' <path' + ' d="M777.472 277.376c-18.176 0-32.96-14.784-32.96-33.024 0-8.448 3.136-16.064 8.32-21.888-11.52-5.12-24.128-8-37.568-8-51.2 0-92.672 41.472-92.672 92.736s41.472 92.736 92.672 92.736S808.064 358.4 808.064 307.2c0-13.696-3.072-26.688-8.384-38.4C793.728 274.112 786.048 277.376 777.472 277.376zM715.328 340.928c-18.624 0-33.664-15.104-33.664-33.728 0-18.624 15.04-33.728 33.664-33.728 18.688 0 33.728 15.104 33.728 33.728C749.056 325.824 734.016 340.928 715.328 340.928z"' + ' p-id="1644" fill="#ffffff"></path>' + ' </svg>' + ' </span>' + ' <span>开启对讲</span>';
  31109. startTalkDOM.onclick = function () {
  31110. console.log("EZUIKit.state.countTimer", EZUIKit.state.countTimer);
  31111. if (EZUIKit.state.countTimer) {
  31112. window.layer.msg("语音设备正忙,请稍后重试");
  31113. return false;
  31114. }
  31115. countTime('add', 0);
  31116. console.log("开始对讲,关闭声音");
  31117. _this.closeSound(0);
  31118. console.log(_this.opt);
  31119. _this.startTalk();
  31120. this.setAttribute("class", "ptp-talk off hide");
  31121. stopTalkDOM.setAttribute("class", "ptp-talk on");
  31122. };
  31123. stopTalkDOM.setAttribute("class", "ptp-talk on hide");
  31124. stopTalkDOM.innerHTML = '<span title="对讲">' + ' <svg t="1581930496966" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1641" width="16" height="16">' + ' <path' + ' d="M715.648 647.872c-30.208-22.336-61.568 39.36-100.992 77.44-39.36 38.08-34.112 31.488-123.392-17.088S311.488 540.224 280 491.648C248.448 443.072 265.472 424.704 265.472 424.704s78.72-62.976 97.152-81.344c18.368-18.368 13.12-30.208 13.12-30.208l-128.64-190.144c-23.616-5.184-64.32 5.12-128.576 57.6C54.208 233.088 30.592 353.856 151.296 575.68c120.768 221.824 347.84 330.752 485.568 374.08 137.856 43.328 228.416-61.696 249.408-103.68 21.056-41.984 13.12-85.312 13.12-85.312S745.856 670.208 715.648 647.872z"' + ' p-id="1642" fill="#ff0000"></path>' + ' <path' + ' d="M715.328 64C580.992 64 472.192 172.864 472.192 307.2s108.8 243.2 243.136 243.2 243.2-108.864 243.2-243.2S849.6 64 715.328 64zM715.328 461.056c-84.992 0-153.856-68.864-153.856-153.856s68.864-153.856 153.856-153.856 153.856 68.928 153.856 153.856S800.32 461.056 715.328 461.056z"' + ' p-id="1643" fill="#ff0000"></path>' + ' <path' + ' d="M777.472 277.376c-18.176 0-32.96-14.784-32.96-33.024 0-8.448 3.136-16.064 8.32-21.888-11.52-5.12-24.128-8-37.568-8-51.2 0-92.672 41.472-92.672 92.736s41.472 92.736 92.672 92.736S808.064 358.4 808.064 307.2c0-13.696-3.072-26.688-8.384-38.4C793.728 274.112 786.048 277.376 777.472 277.376zM715.328 340.928c-18.624 0-33.664-15.104-33.664-33.728 0-18.624 15.04-33.728 33.664-33.728 18.688 0 33.728 15.104 33.728 33.728C749.056 325.824 734.016 340.928 715.328 340.928z"' + ' p-id="1644" fill="#ff0000"></path>' + ' </svg>' + ' </span>' + '<span>关闭对讲</span>';
  31125. stopTalkDOM.onclick = function () {
  31126. console.log(_this.opt);
  31127. _this.stopTalk();
  31128. countTime('destory', 0);
  31129. _this.openSound(0);
  31130. this.setAttribute("class", "ptp-talk on hide");
  31131. startTalkDOM.setAttribute("class", "ptp-talk off");
  31132. };
  31133. footerContainer.appendChild(startTalkDOM);
  31134. footerContainer.appendChild(stopTalkDOM);
  31135. }
  31136. if (matchFooterOpt().broadcastModule) {
  31137. var fetchVoiceList = function fetchVoiceList(page) {
  31138. function apiSuccess(data) {
  31139. console.log("data", data);
  31140. if (data.code == 200) {
  31141. randerVoliceList(data.data, 5);
  31142. EZUIKit.state.page = data.page.page; // 如果用户语音列表为空
  31143. if (page == 0 && data.data.length == 0 && !EZUIKit.state.fetchDefaultList) {
  31144. // 获取用户语音为空
  31145. EZUIKit.state.fetchDefaultList = true;
  31146. fetchVoiceList(0);
  31147. }
  31148. }
  31149. }
  31150. request(domain + '/api/lapp/voice/query', 'POST', {
  31151. accessToken: _this.opt.accessToken,
  31152. pageStart: page,
  31153. pageSize: EZUIKit.state.pageSize,
  31154. "default": EZUIKit.state.fetchDefaultList ? 'true' : 'false'
  31155. }, '', apiSuccess);
  31156. };
  31157. var randerVoliceList = function randerVoliceList(data) {
  31158. console.log("renderVoliceList", data);
  31159. if (data && data.length > 0) {
  31160. for (var i = 0; i < data.length; i++) {
  31161. var voiceItem = document.createElement('li');
  31162. voiceItem.innerHTML = "<li class='voice-item' id='voice-item-" + i + "' data-time=" + (data[i]["duration"] || 20) + " data-url=" + data[i]["fileUrl"] + ">" + (data[i]["voiceName"].length > 10 ? data[i]["voiceName"].substr(0, 10) + "..." : data[i]["voiceName"]) + "</li>";
  31163. document.getElementsByClassName('voice-list-ul')[0].append(voiceItem); // "<li class='voice-item' id='voice-item-" + i + "' data-time=" + (data[i]["duration"] || 20) + " data-url=" + data[i]["fileUrl"] + ">" + (data[i]["voiceName"].length > 10 ? (data[i]["voiceName"].substr(0, 10) + "...") : data[i]["voiceName"]) + "</li>";
  31164. // $("#voice-list ul").append("<li class='voice-item' id='voice-item-" + i + "' data-time=" + (data[i]["duration"] || 20) + " data-url=" + data[i]["fileUrl"] + ">" + (data[i]["voiceName"].length > 10 ? (data[i]["voiceName"].substr(0, 10) + "...") : data[i]["voiceName"]) + "</li>");
  31165. voiceItem.onclick = function (e) {
  31166. console.log("点击元素", e.target, e.target.dataset.url);
  31167. var voiceUrl = e.target.dataset.url;
  31168. var time = e.target.dataset.time;
  31169. playListOfVoice(voiceUrl, time);
  31170. };
  31171. }
  31172. if (data.length === EZUIKit.state.pageSize) {
  31173. document.getElementById('voice-list-end').innerHTML = "向下滚动加载更多";
  31174. } else {
  31175. document.getElementById('voice-list-end').innerHTML = "没有更多数据了";
  31176. }
  31177. }
  31178. };
  31179. var playListOfVoice = function playListOfVoice(voiceUrl, time) {
  31180. console.log("播放语音", voiceUrl, time); // decoder && decoder.closeSound(0);
  31181. function apiSuccess(data) {
  31182. console.log("data.data", data.data);
  31183. if (data.code == 200) {
  31184. // $("#startBroadcast").show();
  31185. // $("#stopBroadcast").hide();
  31186. countTime('sub', parseInt(time));
  31187. } else if (data.code == "10001") {
  31188. window.layer.msg("未找到当前语音");
  31189. } else {
  31190. window.layer.msg(data.msg || '发送失败,请稍后再试');
  31191. } // padding = false;
  31192. }
  31193. request(domain + '/api/lapp/voice/send', 'POST', {
  31194. accessToken: _this.opt.accessToken,
  31195. deviceSerial: _this.opt.deviceSerial,
  31196. channelNo: _this.opt.channelNo,
  31197. fileUrl: voiceUrl
  31198. }, '', apiSuccess);
  31199. }; // 自定义语音
  31200. // 对讲
  31201. var startBroadcastDOM = document.createElement('div');
  31202. var stopBroadcastDOM = document.createElement('div');
  31203. startBroadcastDOM.setAttribute("class", 'broadcast off');
  31204. stopBroadcastDOM.setAttribute("class", "broadcast on hide");
  31205. startBroadcastDOM.innerHTML = ' <span title="语音播报">' + ' <svg t="1583561695846" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1126" width="16" height="16">' + ' <path' + ' d="M513.82044445 964.38044445c-8.192 0-15.47377778-2.73066667-21.84533334-8.192 0 0-46.42133333-41.87022222-99.21422222-86.47111112-89.20177778-73.728-117.41866667-88.29155555-123.79022222-90.112H35.04355555c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666666V271.70133333c0-14.56355555 11.83288889-27.30666667 26.39644444-27.30666666H246.21511111c7.28177778-2.73066667 37.31911111-15.47377778 137.44355556-91.02222222 58.25422222-43.69066667 111.04711111-86.47111111 111.04711111-86.47111112 5.46133333-4.55111111 12.74311111-7.28177778 20.02488889-7.28177778 4.55111111 0 10.01244445 0.91022222 14.56355555 3.6408889 10.92266667 5.46133333 18.20444445 17.29422222 18.20444445 30.03733333v837.40444444c0 12.74311111-7.28177778 25.48622222-19.11466667 30.94755556-5.46133333 1.82044445-10.01244445 2.73066667-14.56355555 2.73066667zM270.79111111 724.992c19.11466667 0 48.24177778 8.192 167.48088889 106.496 16.384 13.65333333 33.67822222 28.21688889 51.88266667 43.69066667l5.46133333 4.55111111V139.71911111l-5.46133333 3.64088889c-22.75555555 17.29422222-44.60088889 34.58844445-65.536 50.06222222C293.54666667 291.72622222 264.41955555 299.008 245.30488889 299.008H82.37511111c-20.02488889 0-21.84533333 12.74311111-21.84533333 26.39644445V694.04444445c0 23.66577778 6.37155555 30.03733333 28.21688889 30.03733333h180.224l1.82044444 0.91022222z m520.64711111 162.01955555c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666666 0-11.83288889 8.192-20.02488889 16.384-24.576 112.86755555-67.35644445 182.04444445-191.14666667 182.04444444-324.03911111 0-132.89244445-70.08711111-256.68266667-182.04444444-324.03911111-10.01244445-5.46133333-15.47377778-14.56355555-15.47377778-24.576 0-14.56355555 11.83288889-27.30666667 26.39644445-27.30666667 5.46133333 0 10.01244445 1.82044445 16.384 5.46133333 128.34133333 76.45866667 207.53066667 218.45333333 207.53066666 369.55022222 0 152.00711111-80.09955555 293.09155555-208.44088889 369.55022223-6.37155555 5.46133333-10.92266667 7.28177778-16.384 7.28177777z m-90.112-152.91733333c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666667 0-10.01244445 4.55111111-18.20444445 12.74311111-23.66577777 61.89511111-34.58844445 100.12444445-100.12444445 100.12444444-171.12177778 0-70.08711111-37.31911111-134.71288889-96.48355555-170.21155555-8.192-4.55111111-12.74311111-13.65333333-12.74311111-23.66577778 0-14.56355555 11.83288889-27.30666667 26.39644444-27.30666667 4.55111111 0 11.83288889 2.73066667 15.47377778 4.55111111 74.63822222 44.60088889 121.96977778 127.43111111 121.96977778 215.72266667 0 90.112-48.24177778 173.85244445-125.61066667 218.45333333-1.82044445 0-9.10222222 4.55111111-15.47377778 4.55111111z"' + ' fill="#ffffff" p-id="1127"></path>' + ' </svg>' + '</span>' + '<span>语音播报</span>';
  31206. startBroadcastDOM.onclick = function () {
  31207. this.setAttribute("class", "broadcast off hide");
  31208. stopBroadcastDOM.setAttribute("class", "broadcast on");
  31209. };
  31210. stopBroadcastDOM.innerHTML = '<div class="pop-hover">' + ' <div class="pop-hover-content">' + ' <div class="vioce-list" id="voice-list">' + ' <ul class="voice-list-ul">' + ' </ul>' + ' <div id="voice-list-end"></div>' + ' </div>' + ' <div id="voice-custom" style="text-align: center;">自定义语音</div>' + ' </div>' + '</div>' + '<span title="语音播报">' + ' <svg t="1583561695846" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1126" width="16" height="16">' + ' <path' + ' d="M513.82044445 964.38044445c-8.192 0-15.47377778-2.73066667-21.84533334-8.192 0 0-46.42133333-41.87022222-99.21422222-86.47111112-89.20177778-73.728-117.41866667-88.29155555-123.79022222-90.112H35.04355555c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666666V271.70133333c0-14.56355555 11.83288889-27.30666667 26.39644444-27.30666666H246.21511111c7.28177778-2.73066667 37.31911111-15.47377778 137.44355556-91.02222222 58.25422222-43.69066667 111.04711111-86.47111111 111.04711111-86.47111112 5.46133333-4.55111111 12.74311111-7.28177778 20.02488889-7.28177778 4.55111111 0 10.01244445 0.91022222 14.56355555 3.6408889 10.92266667 5.46133333 18.20444445 17.29422222 18.20444445 30.03733333v837.40444444c0 12.74311111-7.28177778 25.48622222-19.11466667 30.94755556-5.46133333 1.82044445-10.01244445 2.73066667-14.56355555 2.73066667zM270.79111111 724.992c19.11466667 0 48.24177778 8.192 167.48088889 106.496 16.384 13.65333333 33.67822222 28.21688889 51.88266667 43.69066667l5.46133333 4.55111111V139.71911111l-5.46133333 3.64088889c-22.75555555 17.29422222-44.60088889 34.58844445-65.536 50.06222222C293.54666667 291.72622222 264.41955555 299.008 245.30488889 299.008H82.37511111c-20.02488889 0-21.84533333 12.74311111-21.84533333 26.39644445V694.04444445c0 23.66577778 6.37155555 30.03733333 28.21688889 30.03733333h180.224l1.82044444 0.91022222z m520.64711111 162.01955555c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666666 0-11.83288889 8.192-20.02488889 16.384-24.576 112.86755555-67.35644445 182.04444445-191.14666667 182.04444444-324.03911111 0-132.89244445-70.08711111-256.68266667-182.04444444-324.03911111-10.01244445-5.46133333-15.47377778-14.56355555-15.47377778-24.576 0-14.56355555 11.83288889-27.30666667 26.39644445-27.30666667 5.46133333 0 10.01244445 1.82044445 16.384 5.46133333 128.34133333 76.45866667 207.53066667 218.45333333 207.53066666 369.55022222 0 152.00711111-80.09955555 293.09155555-208.44088889 369.55022223-6.37155555 5.46133333-10.92266667 7.28177778-16.384 7.28177777z m-90.112-152.91733333c-14.56355555 0-26.39644445-11.83288889-26.39644444-27.30666667 0-10.01244445 4.55111111-18.20444445 12.74311111-23.66577777 61.89511111-34.58844445 100.12444445-100.12444445 100.12444444-171.12177778 0-70.08711111-37.31911111-134.71288889-96.48355555-170.21155555-8.192-4.55111111-12.74311111-13.65333333-12.74311111-23.66577778 0-14.56355555 11.83288889-27.30666667 26.39644444-27.30666667 4.55111111 0 11.83288889 2.73066667 15.47377778 4.55111111 74.63822222 44.60088889 121.96977778 127.43111111 121.96977778 215.72266667 0 90.112-48.24177778 173.85244445-125.61066667 218.45333333-1.82044445 0-9.10222222 4.55111111-15.47377778 4.55111111z"' + ' fill="#ff0000" p-id="1127"></path>' + ' </svg>' + '</span>' + '<span>语音播报</span>'; // //自定义语音唤起
  31211. // document.getElementById("voice-custom").onclick = function(){
  31212. // console.log("显示自定义语音");
  31213. // }
  31214. stopBroadcastDOM.onclick = function () {
  31215. this.setAttribute("class", "broadcast on hide");
  31216. startBroadcastDOM.setAttribute("class", "broadcast off");
  31217. };
  31218. footerContainer.appendChild(startBroadcastDOM);
  31219. footerContainer.appendChild(stopBroadcastDOM); // 召唤自定义语言
  31220. document.getElementById("voice-custom").onclick = function () {
  31221. console.log("显示自定义语音");
  31222. startSpeakDOM.setAttribute('class', 'speak off');
  31223. }; // 获取语音列表
  31224. fetchVoiceList(0);
  31225. var startSpeakDOM = document.createElement('div');
  31226. var stopSpeakDOM = document.createElement('div');
  31227. startSpeakDOM.setAttribute('class', 'speak off hide');
  31228. stopSpeakDOM.setAttribute('class', 'speak on hide');
  31229. startSpeakDOM.setAttribute('id', 'startSpeak');
  31230. stopSpeakDOM.setAttribute('id', 'stopSpeak');
  31231. startSpeakDOM.innerHTML = '<span title="按住说话">' + ' <svg t="1581994757678" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1639" width="16" height="16">' + ' <path' + ' d="M757.059829 393.846154v-52.512821h262.564103v52.512821H757.059829z m-420.102564 481.367521v96.273504h175.042735a8.752137 8.752137 0 0 1 8.752137 8.752137v35.008547a8.752137 8.752137 0 0 1-8.752137 8.752137H109.401709a8.752137 8.752137 0 0 1-8.752136-8.752137v-35.008547a8.752137 8.752137 0 0 1 8.752136-8.752137h175.042735v-96.273504C129.767932 875.213675 4.376068 749.821812 4.376068 595.145299V463.863248a26.25641 26.25641 0 1 1 52.512821 0v113.777778c0 140.174222 113.637744 253.811966 253.811966 253.811965s253.811966-113.637744 253.811966-253.811965V463.863248a26.25641 26.25641 0 1 1 52.51282 0v131.282051c0 154.676513-125.391863 280.068376-280.068376 280.068376z m-26.25641-96.273504c-111.178393 0-201.299145-90.120752-201.299146-201.299145V201.299145C109.401709 90.120752 199.522462 0 310.700855 0s201.299145 90.120752 201.299145 201.299145v376.341881c0 111.178393-90.120752 201.299145-201.299145 201.299145z m691.418803-280.068376H757.059829v-52.512821h245.059829v52.512821z m-17.504273 105.025641H757.059829v-52.512821h227.555556v52.512821z m-17.504274 105.025641H757.059829v-52.512821h210.051282v52.512821z m-8.752137 105.025641H757.059829v-52.512821h201.299145v52.512821z m-17.504273 105.025641H757.059829v-52.512821h183.794872v52.512821z m-26.25641 105.025641H757.059829v-52.512821h157.538462v52.512821z"' + ' p-id="1640" fill="#ffffff"></path>' + ' </svg>' + '</span>' + '<span>按住说话</span>';
  31232. stopSpeakDOM.innerHTML = '<span title="按住说话">' + '<svg t="1581994757678" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"' + ' p-id="1639" width="16" height="16">' + ' <path' + ' d="M757.059829 393.846154v-52.512821h262.564103v52.512821H757.059829z m-420.102564 481.367521v96.273504h175.042735a8.752137 8.752137 0 0 1 8.752137 8.752137v35.008547a8.752137 8.752137 0 0 1-8.752137 8.752137H109.401709a8.752137 8.752137 0 0 1-8.752136-8.752137v-35.008547a8.752137 8.752137 0 0 1 8.752136-8.752137h175.042735v-96.273504C129.767932 875.213675 4.376068 749.821812 4.376068 595.145299V463.863248a26.25641 26.25641 0 1 1 52.512821 0v113.777778c0 140.174222 113.637744 253.811966 253.811966 253.811965s253.811966-113.637744 253.811966-253.811965V463.863248a26.25641 26.25641 0 1 1 52.51282 0v131.282051c0 154.676513-125.391863 280.068376-280.068376 280.068376z m-26.25641-96.273504c-111.178393 0-201.299145-90.120752-201.299146-201.299145V201.299145C109.401709 90.120752 199.522462 0 310.700855 0s201.299145 90.120752 201.299145 201.299145v376.341881c0 111.178393-90.120752 201.299145-201.299145 201.299145z m691.418803-280.068376H757.059829v-52.512821h245.059829v52.512821z m-17.504273 105.025641H757.059829v-52.512821h227.555556v52.512821z m-17.504274 105.025641H757.059829v-52.512821h210.051282v52.512821z m-8.752137 105.025641H757.059829v-52.512821h201.299145v52.512821z m-17.504273 105.025641H757.059829v-52.512821h183.794872v52.512821z m-26.25641 105.025641H757.059829v-52.512821h157.538462v52.512821z"' + ' p-id="1640" fill="#ff0000"></path>' + '</svg>' + '</span>' + '<span>松开发送</span>';
  31233. footerContainer.appendChild(startSpeakDOM);
  31234. footerContainer.appendChild(stopSpeakDOM);
  31235. document.getElementById("voice-list").onscroll = function (e) {
  31236. var sum = this.scrollHeight;
  31237. console.log("sum", sum, this.scrollTop, document.getElementById("voice-list").clientHeight);
  31238. if (sum <= this.scrollTop + this.clientHeight) {
  31239. console.log("拖动到底,执行加载", EZUIKit.state.page);
  31240. fetchVoiceList(++EZUIKit.state.page);
  31241. }
  31242. }; // $("#voice-list").unbind("scroll").bind("scroll", function (e) {
  31243. // // console.log("e",e,this.scrollHeight, $(this).scrollTop() + $(this).height())
  31244. // var sum = this.scrollHeight;
  31245. // if (sum <= $(this).scrollTop() + $(this).height()) {
  31246. // console.log("拖动到底,执行加载", page);
  31247. // fetchVoiceList(++page);
  31248. // }
  31249. // loading = false;
  31250. // });
  31251. // time-area
  31252. var timeAreaDOM = document.createElement('div');
  31253. timeAreaDOM.setAttribute('class', 'time-area');
  31254. timeAreaDOM.setAttribute('id', 'time-area');
  31255. timeAreaDOM.innerHTML = '00:00';
  31256. footerContainer.appendChild(timeAreaDOM); // 按住说话
  31257. var recorder;
  31258. document.getElementById('startSpeak').onmousedown = function () {
  31259. if (EZUIKit.state.countTimer) {
  31260. window.layer.msg("语音设备正忙,请稍后重试");
  31261. return false;
  31262. }
  31263. console.log("按住说话");
  31264. startSpeakDOM.setAttribute('class', 'speak off hide');
  31265. stopSpeakDOM.setAttribute('class', 'speak on'); // console.log("startRecording",startRecording);
  31266. // startRecording();
  31267. voiceInit();
  31268. countTime('add', 0);
  31269. setTimeout(function () {
  31270. EZUIKit.state.recodeTime = 0;
  31271. startRecording();
  31272. }, 1000);
  31273. if (EZUIKit.state.recodeTimer) {
  31274. // 先清空计数器
  31275. clearInterval(EZUIKit.state.recodeTimer);
  31276. }
  31277. EZUIKit.state.recodeTimer = setInterval(function () {
  31278. if (EZUIKit.state.recodeTime >= 59) {
  31279. _this.stopTalk();
  31280. countTime('destory', 0);
  31281. this.setAttribute("class", "ptp-talk on hide");
  31282. startTalkDOM.setAttribute("class", "ptp-talk off");
  31283. window.layer.msg("不超过1分钟");
  31284. } else {
  31285. EZUIKit.state.recodeTime = EZUIKit.state.recodeTime + 1;
  31286. }
  31287. }, 1000);
  31288. /** 录音控制 */
  31289. var audio_context;
  31290. function startUserMedia(stream) {
  31291. var input = audio_context.createMediaStreamSource(stream);
  31292. recorder = new window.Recorder(input);
  31293. }
  31294. function startRecording() {
  31295. recorder && recorder.record();
  31296. }
  31297. function voiceInit() {
  31298. console.log("run init");
  31299. try {
  31300. // webkit shim
  31301. window.AudioContext = window.AudioContext || window.webkitAudioContext;
  31302. navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
  31303. window.URL = window.URL || window.webkitURL;
  31304. audio_context = new AudioContext();
  31305. console.log('Audio context set up.');
  31306. console.log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
  31307. } catch (e) {
  31308. console.log("err", e);
  31309. window.layer.msg('No web audio support in this browser!');
  31310. }
  31311. navigator.getUserMedia({
  31312. audio: true
  31313. }, startUserMedia, function (e) {
  31314. console.log('No live audio input: ' + e);
  31315. });
  31316. }
  31317. }; // 松开发送
  31318. document.getElementById('stopSpeak').onmouseup = function () {
  31319. console.log("松开发送");
  31320. stopSpeakDOM.setAttribute('class', 'speak on hide');
  31321. stopSpeakFun();
  31322. function stopSpeakFun() {
  31323. countTime('destory', 0);
  31324. if (EZUIKit.state.recodeTime < 1) {
  31325. window.layer.msg("说话时间过短");
  31326. clearInterval(EZUIKit.state.recodeTimer);
  31327. return false;
  31328. }
  31329. clearInterval(EZUIKit.state.recodeTimer);
  31330. wavUpload();
  31331. }
  31332. function wavUpload() {
  31333. try {
  31334. recorder && recorder.stop(); // createAudioDom();
  31335. recorder && recorder.exportWAV(function (wav_file) {
  31336. console.log("wav_file", wav_file);
  31337. if (wav_file.size < 1000) {
  31338. window.layer.msg("录音失败,请重试"); // recodeTime = 0;
  31339. EZUIKit.state.recodeTime = 0;
  31340. return false;
  31341. } // 测试
  31342. countTime('sub', EZUIKit.state.recodeTime + 2); // 延时
  31343. var formdata = new FormData(); // form 表单 {key:value}
  31344. formdata.append("voiceFile", wav_file); // form input type="file"
  31345. formdata.append("accessToken", _this.opt.accessToken);
  31346. formdata.append("deviceSerial", _this.opt.deviceSerial);
  31347. formdata.append("channelNo", _this.opt.channelNo); // padding = true;
  31348. function apiSuccess(data) {
  31349. console.log("data.data", data.data);
  31350. if (data.code == 200) {
  31351. // $("#startBroadcast").show();
  31352. // $("#stopBroadcast").hide();
  31353. countTime('sub', EZUIKit.state.recodeTime + 2);
  31354. } else if (data.code == "10001") {
  31355. window.layer.msg("未找到当前语音");
  31356. } else {
  31357. window.layer.msg(data.msg || '发送失败,请稍后再试');
  31358. } // padding = false;
  31359. }
  31360. function apiError(err) {
  31361. console.log("err", err);
  31362. }
  31363. request(domain + '/api/lapp/voice/sendonce', 'POST', {
  31364. voiceFile: wav_file,
  31365. accessToken: _this.opt.accessToken,
  31366. deviceSerial: _this.opt.deviceSerial,
  31367. channelNo: _this.opt.channelNo
  31368. }, '', apiSuccess, apiError);
  31369. });
  31370. recorder && recorder.clear();
  31371. } catch (err) {
  31372. console.log(err);
  31373. }
  31374. }
  31375. };
  31376. }
  31377. }
  31378. }
  31379. });
  31380. });
  31381. // iframe 传递数据
  31382. var _this = this;
  31383. window.addEventListener("message", function (event) {
  31384. event.origin;
  31385. var id = _this.opt.id;
  31386. if (event.data.type) {
  31387. switch (event.data.type) {
  31388. case 'openSound':
  31389. if (id == event.data.id && params.openSoundCallBack) {
  31390. params.openSoundCallBack(event.data);
  31391. }
  31392. break;
  31393. case 'closeSound':
  31394. if (id == event.data.id && params.closeSoundCallBack) {
  31395. params.closeSoundCallBack(event.data);
  31396. }
  31397. break;
  31398. case 'capturePicture':
  31399. if (id == event.data.id && params.capturePictureCallBack) {
  31400. params.capturePictureCallBack(event.data);
  31401. }
  31402. break;
  31403. case 'startSave':
  31404. if (id == event.data.id && params.startSaveCallBack) {
  31405. params.startSaveCallBack(event.data);
  31406. }
  31407. break;
  31408. case 'stopSave':
  31409. if (id == event.data.id && params.stopSaveCallBack) {
  31410. params.stopSaveCallBack(event.data);
  31411. }
  31412. break;
  31413. case 'fullScreen':
  31414. if (id == event.data.id && params.fullScreenCallBack) {
  31415. params.fullScreenCallBack(event.data);
  31416. }
  31417. break;
  31418. case 'getOSDTime':
  31419. if (id == event.data.id && params.getOSDTimeCallBack) {
  31420. params.getOSDTimeCallBack(event.data);
  31421. }
  31422. break;
  31423. case 'handleSuccess':
  31424. if (id == event.data.id && params.handleSuccess) {
  31425. params.handleSuccess(event.data);
  31426. }
  31427. break;
  31428. case 'handleError':
  31429. if (id == event.data.id && params.handleError) {
  31430. params.handleError(event.data);
  31431. }
  31432. break;
  31433. case 'dblclick':
  31434. if (id == event.data.id && _this.opt.bSupporDoubleClickFull) {
  31435. if (_this.opt.fullScreenStatus === 0) {
  31436. _this.fullScreen();
  31437. } else {
  31438. _this.cancelFullScreen();
  31439. }
  31440. }
  31441. break;
  31442. case 'startTalk':
  31443. _this.startTalk();
  31444. // params.startTalk();
  31445. _this.closeSound();
  31446. break;
  31447. case 'stopTalk':
  31448. // window.stopTalk()
  31449. _this.stopTalk();
  31450. _this.openSound();
  31451. break;
  31452. case 'clickEventHandle':
  31453. console.log("event.data", event.data);
  31454. if (params.clickEventHandle) {
  31455. params.clickEventHandle(event.data);
  31456. }
  31457. break;
  31458. case 'removeEventHandle':
  31459. if (params.removeEventHandle) {
  31460. params.removeEventHandle(event.data);
  31461. }
  31462. break;
  31463. case 'esc':
  31464. if (params.clickEventHandle) {
  31465. params.clickEventHandle(event.data);
  31466. }
  31467. break;
  31468. case 'iframeFullScreen':
  31469. if (id == event.data.id) {
  31470. var requestFullScreen = function requestFullScreen(element) {
  31471. var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
  31472. if (requestMethod) {
  31473. requestMethod.call(element);
  31474. } else if (typeof window.ActiveXObject !== "undefined") {
  31475. var wscript = new ActiveXObject("WScript.Shell");
  31476. if (wscript !== null) {
  31477. wscript.SendKeys("{F11}");
  31478. }
  31479. }
  31480. };
  31481. requestFullScreen(document.getElementById("EZUIKitPlayer-" + event.data.id));
  31482. }
  31483. break;
  31484. }
  31485. }
  31486. });
  31487. // 全屏变化回调
  31488. function fullscreenchange(data) {
  31489. _this.opt.fullScreenStatus = data ? 1 : 0;
  31490. if (params.fullScreenChangeCallBack) {
  31491. params.fullScreenChangeCallBack({
  31492. data: data,
  31493. id: _this.opt.id
  31494. });
  31495. }
  31496. }
  31497. if (typeof document.fullScreen !== "undefined") {
  31498. document.addEventListener("fullscreenchange", function () {
  31499. var e = document.fullscreen || false;
  31500. fullscreenchange(e);
  31501. });
  31502. } else if (typeof document.webkitIsFullScreen !== "undefined") {
  31503. document.addEventListener("webkitfullscreenchange", function () {
  31504. var e = document.webkitIsFullScreen || false;
  31505. fullscreenchange(e);
  31506. });
  31507. } else if (typeof document.mozFullScreen !== "undefined") {
  31508. document.addEventListener("mozfullscreenchange", function () {
  31509. var e = document.mozFullScreen || false;
  31510. fullscreenchange(e);
  31511. });
  31512. }
  31513. }; // 播放相关API
  31514. EZUIKitPlayer.prototype.play = function (data) {
  31515. var id = 'EZUIKitPlayer-' + this.opt.id;
  31516. var player = document.getElementById(id).contentWindow;
  31517. if (_typeof(data) === 'object' && data.url) {
  31518. this.opt.url = data.url;
  31519. }
  31520. if (_typeof(data) === 'object' && data.accessToken) {
  31521. this.opt.accessToken = data.accessToken;
  31522. }
  31523. if (typeof data === 'string') {
  31524. this.opt.url = data;
  31525. }
  31526. player.postMessage({
  31527. action: "play",
  31528. accessToken: this.opt.accessToken,
  31529. url: this.opt.url
  31530. }, domain + "/ezopen/h5/iframe");
  31531. var _this = this;
  31532. this.opt.videoLoading = true;
  31533. var promise = new Promise(function (resolve, reject) {
  31534. window.addEventListener("message", function (event) {
  31535. var playId = _this.opt.id;
  31536. if (playId == event.data.id && event.data.type === 'handleSuccess') {
  31537. setTimeout(function () {
  31538. _this.opt.videoLoading = false;
  31539. }, 1000);
  31540. resolve(event.data);
  31541. }
  31542. });
  31543. });
  31544. return promise;
  31545. };
  31546. EZUIKitPlayer.prototype.stop = function () {
  31547. var id = 'EZUIKitPlayer-' + this.opt.id;
  31548. var player = document.getElementById(id).contentWindow;
  31549. player.postMessage("stop", domain + "/ezopen/h5/iframe");
  31550. var _this = this;
  31551. var promise = new Promise(function (resolve, reject) {
  31552. window.addEventListener("message", function (event) {
  31553. var playId = _this.opt.id;
  31554. if (playId == event.data.id && event.data.type === 'stop') {
  31555. resolve(event.data);
  31556. }
  31557. });
  31558. });
  31559. return promise;
  31560. };
  31561. EZUIKitPlayer.prototype.openSound = function () {
  31562. var id = 'EZUIKitPlayer-' + this.opt.id;
  31563. var player = document.getElementById(id).contentWindow;
  31564. player.postMessage("openSound", domain + "/ezopen/h5/iframe");
  31565. var _this = this;
  31566. var promise = new Promise(function (resolve, reject) {
  31567. window.addEventListener("message", function (event) {
  31568. var playId = _this.opt.id;
  31569. if (playId == event.data.id && event.data.type === 'openSound') {
  31570. resolve(event.data);
  31571. }
  31572. });
  31573. });
  31574. return promise;
  31575. };
  31576. EZUIKitPlayer.prototype.closeSound = function () {
  31577. var id = 'EZUIKitPlayer-' + this.opt.id;
  31578. var player = document.getElementById(id).contentWindow;
  31579. player.postMessage("closeSound", domain + "/ezopen/h5/iframe");
  31580. var _this = this;
  31581. var promise = new Promise(function (resolve, reject) {
  31582. window.addEventListener("message", function (event) {
  31583. var playId = _this.opt.id;
  31584. if (playId == event.data.id && event.data.type === 'closeSound') {
  31585. resolve(event.data);
  31586. }
  31587. });
  31588. });
  31589. return promise;
  31590. };
  31591. EZUIKitPlayer.prototype.startSave = function (fileName) {
  31592. var id = 'EZUIKitPlayer-' + this.opt.id;
  31593. var player = document.getElementById(id).contentWindow;
  31594. player.postMessage({
  31595. action: "startSave",
  31596. fileName: fileName || 'default'
  31597. }, domain + "/ezopen/h5/iframe");
  31598. var _this = this;
  31599. var promise = new Promise(function (resolve, reject) {
  31600. window.addEventListener("message", function (event) {
  31601. var playId = _this.opt.id;
  31602. if (playId == event.data.id && event.data.type === 'startSave') {
  31603. resolve(event.data);
  31604. }
  31605. });
  31606. });
  31607. return promise;
  31608. };
  31609. EZUIKitPlayer.prototype.stopSave = function () {
  31610. var id = 'EZUIKitPlayer-' + this.opt.id;
  31611. var player = document.getElementById(id).contentWindow;
  31612. player.postMessage("stopSave", domain + "/ezopen/h5/iframe");
  31613. var _this = this;
  31614. var promise = new Promise(function (resolve, reject) {
  31615. window.addEventListener("message", function (event) {
  31616. var playId = _this.opt.id;
  31617. if (playId == event.data.id && event.data.type === 'stopSave') {
  31618. resolve(event.data);
  31619. }
  31620. });
  31621. });
  31622. return promise;
  31623. };
  31624. EZUIKitPlayer.prototype.fullScreen = function () {
  31625. if (this.opt.fullScreenStatus === 1) {
  31626. return false;
  31627. }
  31628. var id = 'EZUIKitPlayer-' + this.opt.id;
  31629. var player = document.getElementById(id).contentWindow;
  31630. if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
  31631. // console.log('移动端全屏');
  31632. var width = document.documentElement.clientWidth;
  31633. var height = document.documentElement.clientHeight;
  31634. // wrapper = document.getElementById("test"),
  31635. var wrapper = document.body; //document.body 属性返回 <body> 元素, document.documentElement 属性返回 <html> 元素。
  31636. wrapper = document.getElementById(id);
  31637. var style = "";
  31638. style += "width:" + height + "px;"; // 注意旋转后的宽高切换
  31639. style += "height:" + width + "px;";
  31640. style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
  31641. // 注意旋转中点的处理
  31642. style += "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  31643. style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  31644. style += 'position: fixed;top: 0;left: 0;z-index:10';
  31645. wrapper.style.cssText = style;
  31646. // var cancelFullDOM = document.createElement('div');
  31647. // cancelFullDOM.id = id + "cancel-full-screen"
  31648. // var cancelFullDOMStyle="width:30px;height:"+height+"px;z-index:1000;position:fixed;top:0px;right:0px;";
  31649. // cancelFullDOMStyle += "background-image: url(https://resource.ys7cloud.com/group1/M00/00/7E/CtwQE1-01qeAH2wAAAABOliqQ5g167.png);"
  31650. // cancelFullDOMStyle += "background-size: contain;background-repeat:no-repeat;background-color:rgba(0,0,0,0.2)"
  31651. // cancelFullDOM.style = cancelFullDOMStyle;
  31652. // cancelFullDOM.onclick = function(){
  31653. // _this.cancelFullScreen();
  31654. // }
  31655. // document.body.appendChild(cancelFullDOM);
  31656. setTimeout(function () {
  31657. player.postMessage('autoResize', domain + "/ezopen/h5/iframe");
  31658. }, 500);
  31659. } else {
  31660. // console.log('pc端全屏');
  31661. var requestFullScreen = function requestFullScreen(element) {
  31662. var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
  31663. if (requestMethod) {
  31664. requestMethod.call(element);
  31665. } else if (typeof window.ActiveXObject !== "undefined") {
  31666. var wscript = new ActiveXObject("WScript.Shell");
  31667. if (wscript !== null) {
  31668. wscript.SendKeys("{F11}");
  31669. }
  31670. }
  31671. };
  31672. requestFullScreen(document.getElementById(id));
  31673. }
  31674. if (this.params.fullScreenCallBack) {
  31675. this.params.fullScreenCallBack(this.opt.id);
  31676. }
  31677. this.opt.fullScreenStatus = 1;
  31678. };
  31679. EZUIKitPlayer.prototype.cancelFullScreen = function () {
  31680. if (this.opt.fullScreenStatus === 0) {
  31681. return false;
  31682. }
  31683. var id = 'EZUIKitPlayer-' + this.opt.id;
  31684. var player = document.getElementById(id).contentWindow;
  31685. if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
  31686. var width = document.getElementById(id).width;
  31687. var height = document.getElementById(id).height;
  31688. // wrapper = document.getElementById("test"),
  31689. var wrapper = document.body; //document.body 属性返回 <body> 元素, document.documentElement 属性返回 <html> 元素。
  31690. wrapper = document.getElementById(id);
  31691. var style = "";
  31692. style += "width:" + width + "px;";
  31693. style += "height:" + height + "px;";
  31694. style += "-webkit-transform: none; transform: none;";
  31695. style += "-webkit-transform-origin: 0 0;";
  31696. style += "transform-origin: 0 0;";
  31697. wrapper.style.cssText = style;
  31698. setTimeout(function () {
  31699. player.postMessage("autoResize", domain + "/ezopen/h5/iframe");
  31700. }, 500);
  31701. var cancelFullDOMId = id + "cancel-full-screen";
  31702. var cancelFullDOM = document.getElementById(cancelFullDOMId);
  31703. if (cancelFullDOM) {
  31704. document.body.removeChild(cancelFullDOM);
  31705. }
  31706. } else {
  31707. if (document.exitFullscreen) {
  31708. document.exitFullscreen();
  31709. } else if (document.webkitCancelFullScreen) {
  31710. document.webkitCancelFullScreen();
  31711. } else if (document.mozCancelFullScreen) {
  31712. document.mozCancelFullScreen();
  31713. }
  31714. }
  31715. if (this.params.cancelFullScreenCallBack) {
  31716. this.params.cancelFullScreenCallBack(this.opt.id);
  31717. }
  31718. this.opt.fullScreenStatus = 0;
  31719. };
  31720. EZUIKitPlayer.prototype.capturePicture = function (fileName, isUndownload) {
  31721. var id = 'EZUIKitPlayer-' + this.opt.id;
  31722. var player = document.getElementById(id).contentWindow;
  31723. player.postMessage({
  31724. action: "capturePicture",
  31725. fileName: fileName || 'default',
  31726. isUndownload: isUndownload
  31727. }, domain + "/ezopen/h5/iframe");
  31728. var _this = this;
  31729. var promise = new Promise(function (resolve, reject) {
  31730. window.addEventListener("message", function (event) {
  31731. var playId = _this.opt.id;
  31732. if (playId == event.data.id && event.data.type === 'capturePicture') {
  31733. resolve(event.data);
  31734. }
  31735. });
  31736. });
  31737. return promise;
  31738. };
  31739. EZUIKitPlayer.prototype.enableZoom = function () {
  31740. var id = 'EZUIKitPlayer-' + this.opt.id;
  31741. var player = document.getElementById(id).contentWindow;
  31742. player.postMessage("enableZoom", domain + "/ezopen/h5/iframe");
  31743. };
  31744. EZUIKitPlayer.prototype.closeZoom = function () {
  31745. var id = 'EZUIKitPlayer-' + this.opt.id;
  31746. var player = document.getElementById(id).contentWindow;
  31747. player.postMessage("closeZoom", domain + "/ezopen/h5/iframe");
  31748. };
  31749. EZUIKitPlayer.prototype.getOSDTime = function () {
  31750. var id = 'EZUIKitPlayer-' + this.opt.id;
  31751. var player = document.getElementById(id).contentWindow;
  31752. player.postMessage("getOSDTime", domain + "/ezopen/h5/iframe");
  31753. var _this = this;
  31754. var promise = new Promise(function (resolve, reject) {
  31755. window.addEventListener("message", function (event) {
  31756. var playId = _this.opt.id;
  31757. if (playId == event.data.id && event.data.type === 'getOSDTime') {
  31758. resolve(event.data);
  31759. }
  31760. });
  31761. });
  31762. return promise;
  31763. };
  31764. EZUIKitPlayer.prototype.autoResize = function () {
  31765. var id = 'EZUIKitPlayer-' + this.opt.id;
  31766. var player = document.getElementById(id).contentWindow;
  31767. player.postMessage("autoResize", domain + "/ezopen/h5/iframe");
  31768. };
  31769. EZUIKitPlayer.prototype.reSize = function (width, height) {
  31770. var id = 'EZUIKitPlayer-' + this.opt.id;
  31771. var player = document.getElementById(id).contentWindow;
  31772. var containerDOM = document.getElementById(this.opt.id);
  31773. containerDOM.style.width = width + 'px';
  31774. containerDOM.style.height = height + 'px';
  31775. document.getElementById(this.opt.id).style.width = width + 'px';
  31776. document.getElementById(this.opt.id).style.height = height + 'px';
  31777. var playDOM = document.getElementById(id);
  31778. playDOM.setAttribute("width", width);
  31779. playDOM.setAttribute("height", height);
  31780. playDOM.style.width = width + 'px';
  31781. playDOM.style.height = height + 'px';
  31782. setTimeout(function () {
  31783. player.postMessage({
  31784. action: 'autoResize'
  31785. }, domain + "/ezopen/h5/iframe");
  31786. }, 500);
  31787. };
  31788. EZUIKitPlayer.prototype.startTalk = function () {
  31789. console.log("执行开始对讲");
  31790. console.log(this.opt);
  31791. var _this = this;
  31792. EZUIKit.opt = this.opt;
  31793. if (window.EZUIKit) {
  31794. window.EZUIKit.opt = this.opt;
  31795. }
  31796. var apiSuccess = function apiSuccess(data) {
  31797. if (data.code == 200) {
  31798. var apiResult = data.data;
  31799. if (apiResult) {
  31800. // 临时将https转换为websocket
  31801. var rtcTrunk = apiResult.rtcUrl;
  31802. if (rtcTrunk.indexOf("ws") === -1) {
  31803. rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
  31804. }
  31805. _this.opt.rtcUrl = rtcTrunk;
  31806. _this.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
  31807. var talk = "talk://" + _this.opt.deviceSerial + ":0:" + _this.opt.channelNo + ":cas.ys7.com:6500";
  31808. _this.opt.talkLink = _this.opt.ttsUrl + "/" + talk;
  31809. _this.opt.stream = apiResult.stream;
  31810. window.startTalk();
  31811. }
  31812. }
  31813. };
  31814. request(_this.opt.apiDomain, 'POST', {
  31815. accessToken: _this.opt.accessToken,
  31816. deviceSerial: _this.opt.deviceSerial,
  31817. channelNo: _this.opt.channelNo
  31818. }, '', apiSuccess);
  31819. };
  31820. EZUIKitPlayer.prototype.stopTalk = function () {
  31821. console.log("执行结束对讲");
  31822. window.stopTalk();
  31823. };
  31824. EZUIKitPlayer.prototype.edit = function () {
  31825. var id = 'EZUIKitPlayer-' + this.opt.id;
  31826. var player = document.getElementById(id).contentWindow;
  31827. player.postMessage("edit", domain + "/ezopen/h5/iframe");
  31828. };
  31829. EZUIKitPlayer.prototype.btnReRender = function (data) {
  31830. var id = 'EZUIKitPlayer-' + this.opt.id;
  31831. var player = document.getElementById(id).contentWindow;
  31832. player.postMessage({
  31833. action: "btnReRender",
  31834. data: data
  31835. }, domain + "/ezopen/h5/iframe");
  31836. };
  31837. EZUIKitPlayer.prototype.changePlayUrl = function (data) {
  31838. if (data.deviceSerial) {
  31839. this.opt.deviceSerial = data.deviceSerial;
  31840. }
  31841. if (data.channelNo) {
  31842. this.opt.channelNo = data.channelNo;
  31843. }
  31844. if (data.accessToken) {
  31845. this.opt.accessToken = data.accessToken;
  31846. }
  31847. var id = 'EZUIKitPlayer-' + this.opt.id;
  31848. var player = document.getElementById(id).contentWindow;
  31849. player.postMessage({
  31850. action: "changePlayUrl",
  31851. data: data
  31852. }, domain + "/ezopen/h5/iframe");
  31853. };
  31854. EZUIKitPlayer.prototype.fetchThemeData = function () {
  31855. var id = 'EZUIKitPlayer-' + this.opt.id;
  31856. var player = document.getElementById(id).contentWindow;
  31857. player.postMessage({
  31858. action: "fetchThemeData"
  31859. }, domain + "/ezopen/h5/iframe");
  31860. };
  31861. EZUIKitPlayer.prototype.setThemeData = function (accessToken, header, footer) {
  31862. var id = 'EZUIKitPlayer-' + this.opt.id;
  31863. var player = document.getElementById(id).contentWindow;
  31864. player.postMessage({
  31865. action: "setThemeData",
  31866. data: {
  31867. accessToken: accessToken,
  31868. header: header,
  31869. footer: footer
  31870. }
  31871. }, domain + "/ezopen/h5/iframe");
  31872. };
  31873. /**
  31874. * 视频播放器-结束
  31875. */
  31876. EZUIKit.EZUIKitPlayer = EZUIKitPlayer;
  31877. window.EZUIKitV3 = EZUIKit;
  31878. var EZUIKitV3 = EZUIKit;
  31879. return EZUIKitV3;
  31880. });
  31881. var EZUIKitV3$1 = EZUIKitV3;
  31882. /* global setTimeout, clearTimeout */
  31883. var dist = function debounce(fn) {
  31884. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  31885. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  31886. var lastCallAt = void 0;
  31887. var deferred = void 0;
  31888. var timer = void 0;
  31889. var pendingArgs = [];
  31890. return function debounced() {
  31891. var currentWait = getWait(wait);
  31892. var currentTime = new Date().getTime();
  31893. var isCold = !lastCallAt || currentTime - lastCallAt > currentWait;
  31894. lastCallAt = currentTime;
  31895. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  31896. args[_key] = arguments[_key];
  31897. }
  31898. if (isCold && options.leading) {
  31899. return options.accumulate ? Promise.resolve(fn.call(this, [args])).then(function (result) {
  31900. return result[0];
  31901. }) : Promise.resolve(fn.call.apply(fn, [this].concat(args)));
  31902. }
  31903. if (deferred) {
  31904. clearTimeout(timer);
  31905. } else {
  31906. deferred = defer();
  31907. }
  31908. pendingArgs.push(args);
  31909. timer = setTimeout(flush.bind(this), currentWait);
  31910. if (options.accumulate) {
  31911. var argsIndex = pendingArgs.length - 1;
  31912. return deferred.promise.then(function (results) {
  31913. return results[argsIndex];
  31914. });
  31915. }
  31916. return deferred.promise;
  31917. };
  31918. function flush() {
  31919. var thisDeferred = deferred;
  31920. clearTimeout(timer);
  31921. Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);
  31922. pendingArgs = [];
  31923. deferred = null;
  31924. }
  31925. };
  31926. function getWait(wait) {
  31927. return typeof wait === 'function' ? wait() : wait;
  31928. }
  31929. function defer() {
  31930. var deferred = {};
  31931. deferred.promise = new Promise(function (resolve, reject) {
  31932. deferred.resolve = resolve;
  31933. deferred.reject = reject;
  31934. });
  31935. return deferred;
  31936. }
  31937. (function () {
  31938. var h;
  31939. function l(a) {
  31940. var b = 0;
  31941. return function () {
  31942. return b < a.length ? {
  31943. done: !1,
  31944. value: a[b++]
  31945. } : {
  31946. done: !0
  31947. };
  31948. };
  31949. }
  31950. var m = "function" == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
  31951. if (a == Array.prototype || a == Object.prototype) return a;
  31952. a[b] = c.value;
  31953. return a;
  31954. };
  31955. function n(a) {
  31956. a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof commonjsGlobal && commonjsGlobal];
  31957. for (var b = 0; b < a.length; ++b) {
  31958. var c = a[b];
  31959. if (c && c.Math == Math) return c;
  31960. }
  31961. throw Error("Cannot find global object");
  31962. }
  31963. var q = n(this);
  31964. function r(a, b) {
  31965. if (b) a: {
  31966. var c = q;
  31967. a = a.split(".");
  31968. for (var d = 0; d < a.length - 1; d++) {
  31969. var e = a[d];
  31970. if (!(e in c)) break a;
  31971. c = c[e];
  31972. }
  31973. a = a[a.length - 1];
  31974. d = c[a];
  31975. b = b(d);
  31976. b != d && null != b && m(c, a, {
  31977. configurable: !0,
  31978. writable: !0,
  31979. value: b
  31980. });
  31981. }
  31982. }
  31983. r("Symbol", function (a) {
  31984. function b(f) {
  31985. if (this instanceof b) throw new TypeError("Symbol is not a constructor");
  31986. return new c(d + (f || "") + "_" + e++, f);
  31987. }
  31988. function c(f, g) {
  31989. this.A = f;
  31990. m(this, "description", {
  31991. configurable: !0,
  31992. writable: !0,
  31993. value: g
  31994. });
  31995. }
  31996. if (a) return a;
  31997. c.prototype.toString = function () {
  31998. return this.A;
  31999. };
  32000. var d = "jscomp_symbol_" + (1E9 * Math.random() >>> 0) + "_",
  32001. e = 0;
  32002. return b;
  32003. });
  32004. r("Symbol.iterator", function (a) {
  32005. if (a) return a;
  32006. a = Symbol("Symbol.iterator");
  32007. for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), c = 0; c < b.length; c++) {
  32008. var d = q[b[c]];
  32009. "function" === typeof d && "function" != typeof d.prototype[a] && m(d.prototype, a, {
  32010. configurable: !0,
  32011. writable: !0,
  32012. value: function () {
  32013. return u(l(this));
  32014. }
  32015. });
  32016. }
  32017. return a;
  32018. });
  32019. function u(a) {
  32020. a = {
  32021. next: a
  32022. };
  32023. a[Symbol.iterator] = function () {
  32024. return this;
  32025. };
  32026. return a;
  32027. }
  32028. function v(a) {
  32029. var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
  32030. return b ? b.call(a) : {
  32031. next: l(a)
  32032. };
  32033. }
  32034. var w;
  32035. if ("function" == typeof Object.setPrototypeOf) w = Object.setPrototypeOf;else {
  32036. var y;
  32037. a: {
  32038. var z = {
  32039. a: !0
  32040. },
  32041. A = {};
  32042. try {
  32043. A.__proto__ = z;
  32044. y = A.a;
  32045. break a;
  32046. } catch (a) {}
  32047. y = !1;
  32048. }
  32049. w = y ? function (a, b) {
  32050. a.__proto__ = b;
  32051. if (a.__proto__ !== b) throw new TypeError(a + " is not extensible");
  32052. return a;
  32053. } : null;
  32054. }
  32055. var B = w;
  32056. function C() {
  32057. this.m = !1;
  32058. this.j = null;
  32059. this.v = void 0;
  32060. this.h = 1;
  32061. this.u = this.C = 0;
  32062. this.l = null;
  32063. }
  32064. function D(a) {
  32065. if (a.m) throw new TypeError("Generator is already running");
  32066. a.m = !0;
  32067. }
  32068. C.prototype.o = function (a) {
  32069. this.v = a;
  32070. };
  32071. C.prototype.s = function (a) {
  32072. this.l = {
  32073. D: a,
  32074. F: !0
  32075. };
  32076. this.h = this.C || this.u;
  32077. };
  32078. C.prototype.return = function (a) {
  32079. this.l = {
  32080. return: a
  32081. };
  32082. this.h = this.u;
  32083. };
  32084. function E(a, b) {
  32085. a.h = 3;
  32086. return {
  32087. value: b
  32088. };
  32089. }
  32090. function F(a) {
  32091. this.g = new C();
  32092. this.G = a;
  32093. }
  32094. F.prototype.o = function (a) {
  32095. D(this.g);
  32096. if (this.g.j) return G(this, this.g.j.next, a, this.g.o);
  32097. this.g.o(a);
  32098. return H(this);
  32099. };
  32100. function I(a, b) {
  32101. D(a.g);
  32102. var c = a.g.j;
  32103. if (c) return G(a, "return" in c ? c["return"] : function (d) {
  32104. return {
  32105. value: d,
  32106. done: !0
  32107. };
  32108. }, b, a.g.return);
  32109. a.g.return(b);
  32110. return H(a);
  32111. }
  32112. F.prototype.s = function (a) {
  32113. D(this.g);
  32114. if (this.g.j) return G(this, this.g.j["throw"], a, this.g.o);
  32115. this.g.s(a);
  32116. return H(this);
  32117. };
  32118. function G(a, b, c, d) {
  32119. try {
  32120. var e = b.call(a.g.j, c);
  32121. if (!(e instanceof Object)) throw new TypeError("Iterator result " + e + " is not an object");
  32122. if (!e.done) return a.g.m = !1, e;
  32123. var f = e.value;
  32124. } catch (g) {
  32125. return a.g.j = null, a.g.s(g), H(a);
  32126. }
  32127. a.g.j = null;
  32128. d.call(a.g, f);
  32129. return H(a);
  32130. }
  32131. function H(a) {
  32132. for (; a.g.h;) try {
  32133. var b = a.G(a.g);
  32134. if (b) return a.g.m = !1, {
  32135. value: b.value,
  32136. done: !1
  32137. };
  32138. } catch (c) {
  32139. a.g.v = void 0, a.g.s(c);
  32140. }
  32141. a.g.m = !1;
  32142. if (a.g.l) {
  32143. b = a.g.l;
  32144. a.g.l = null;
  32145. if (b.F) throw b.D;
  32146. return {
  32147. value: b.return,
  32148. done: !0
  32149. };
  32150. }
  32151. return {
  32152. value: void 0,
  32153. done: !0
  32154. };
  32155. }
  32156. function J(a) {
  32157. this.next = function (b) {
  32158. return a.o(b);
  32159. };
  32160. this.throw = function (b) {
  32161. return a.s(b);
  32162. };
  32163. this.return = function (b) {
  32164. return I(a, b);
  32165. };
  32166. this[Symbol.iterator] = function () {
  32167. return this;
  32168. };
  32169. }
  32170. function K(a, b) {
  32171. b = new J(new F(b));
  32172. B && a.prototype && B(b, a.prototype);
  32173. return b;
  32174. }
  32175. function L(a, b) {
  32176. a instanceof String && (a += "");
  32177. var c = 0,
  32178. d = !1,
  32179. e = {
  32180. next: function () {
  32181. if (!d && c < a.length) {
  32182. var f = c++;
  32183. return {
  32184. value: b(f, a[f]),
  32185. done: !1
  32186. };
  32187. }
  32188. d = !0;
  32189. return {
  32190. done: !0,
  32191. value: void 0
  32192. };
  32193. }
  32194. };
  32195. e[Symbol.iterator] = function () {
  32196. return e;
  32197. };
  32198. return e;
  32199. }
  32200. r("Array.prototype.entries", function (a) {
  32201. return a ? a : function () {
  32202. return L(this, function (b, c) {
  32203. return [b, c];
  32204. });
  32205. };
  32206. });
  32207. if ("undefined" !== typeof Blob && ("undefined" === typeof FormData || !FormData.prototype.keys)) {
  32208. var M = function (a, b) {
  32209. for (var c = 0; c < a.length; c++) b(a[c]);
  32210. },
  32211. N = function (a) {
  32212. return a.replace(/\r?\n|\r/g, "\r\n");
  32213. },
  32214. O = function (a, b, c) {
  32215. if (b instanceof Blob) {
  32216. c = void 0 !== c ? String(c + "") : "string" === typeof b.name ? b.name : "blob";
  32217. if (b.name !== c || "[object Blob]" === Object.prototype.toString.call(b)) b = new File([b], c);
  32218. return [String(a), b];
  32219. }
  32220. return [String(a), String(b)];
  32221. },
  32222. P = function (a, b) {
  32223. if (a.length < b) throw new TypeError(b + " argument required, but only " + a.length + " present.");
  32224. },
  32225. Q = "object" === typeof globalThis ? globalThis : "object" === typeof window ? window : "object" === typeof self ? self : this,
  32226. R = Q.FormData,
  32227. S = Q.XMLHttpRequest && Q.XMLHttpRequest.prototype.send,
  32228. T = Q.Request && Q.fetch,
  32229. U = Q.navigator && Q.navigator.sendBeacon,
  32230. V = Q.Element && Q.Element.prototype,
  32231. W = Q.Symbol && Symbol.toStringTag;
  32232. W && (Blob.prototype[W] || (Blob.prototype[W] = "Blob"), "File" in Q && !File.prototype[W] && (File.prototype[W] = "File"));
  32233. try {
  32234. new File([], "");
  32235. } catch (a) {
  32236. Q.File = function (b, c, d) {
  32237. b = new Blob(b, d || {});
  32238. Object.defineProperties(b, {
  32239. name: {
  32240. value: c
  32241. },
  32242. lastModified: {
  32243. value: +(d && void 0 !== d.lastModified ? new Date(d.lastModified) : new Date())
  32244. },
  32245. toString: {
  32246. value: function () {
  32247. return "[object File]";
  32248. }
  32249. }
  32250. });
  32251. W && Object.defineProperty(b, W, {
  32252. value: "File"
  32253. });
  32254. return b;
  32255. };
  32256. }
  32257. var escape = function (a) {
  32258. return a.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
  32259. },
  32260. X = function (a) {
  32261. this.i = [];
  32262. var b = this;
  32263. a && M(a.elements, function (c) {
  32264. if (c.name && !c.disabled && "submit" !== c.type && "button" !== c.type && !c.matches("form fieldset[disabled] *")) if ("file" === c.type) {
  32265. var d = c.files && c.files.length ? c.files : [new File([], "", {
  32266. type: "application/octet-stream"
  32267. })];
  32268. M(d, function (e) {
  32269. b.append(c.name, e);
  32270. });
  32271. } else "select-multiple" === c.type || "select-one" === c.type ? M(c.options, function (e) {
  32272. !e.disabled && e.selected && b.append(c.name, e.value);
  32273. }) : "checkbox" === c.type || "radio" === c.type ? c.checked && b.append(c.name, c.value) : (d = "textarea" === c.type ? N(c.value) : c.value, b.append(c.name, d));
  32274. });
  32275. };
  32276. h = X.prototype;
  32277. h.append = function (a, b, c) {
  32278. P(arguments, 2);
  32279. this.i.push(O(a, b, c));
  32280. };
  32281. h.delete = function (a) {
  32282. P(arguments, 1);
  32283. var b = [];
  32284. a = String(a);
  32285. M(this.i, function (c) {
  32286. c[0] !== a && b.push(c);
  32287. });
  32288. this.i = b;
  32289. };
  32290. h.entries = function b() {
  32291. var c,
  32292. d = this;
  32293. return K(b, function (e) {
  32294. 1 == e.h && (c = 0);
  32295. if (3 != e.h) return c < d.i.length ? e = E(e, d.i[c]) : (e.h = 0, e = void 0), e;
  32296. c++;
  32297. e.h = 2;
  32298. });
  32299. };
  32300. h.forEach = function (b, c) {
  32301. P(arguments, 1);
  32302. for (var d = v(this), e = d.next(); !e.done; e = d.next()) {
  32303. var f = v(e.value);
  32304. e = f.next().value;
  32305. f = f.next().value;
  32306. b.call(c, f, e, this);
  32307. }
  32308. };
  32309. h.get = function (b) {
  32310. P(arguments, 1);
  32311. var c = this.i;
  32312. b = String(b);
  32313. for (var d = 0; d < c.length; d++) if (c[d][0] === b) return c[d][1];
  32314. return null;
  32315. };
  32316. h.getAll = function (b) {
  32317. P(arguments, 1);
  32318. var c = [];
  32319. b = String(b);
  32320. M(this.i, function (d) {
  32321. d[0] === b && c.push(d[1]);
  32322. });
  32323. return c;
  32324. };
  32325. h.has = function (b) {
  32326. P(arguments, 1);
  32327. b = String(b);
  32328. for (var c = 0; c < this.i.length; c++) if (this.i[c][0] === b) return !0;
  32329. return !1;
  32330. };
  32331. h.keys = function c() {
  32332. var d = this,
  32333. e,
  32334. f,
  32335. g,
  32336. k,
  32337. p;
  32338. return K(c, function (t) {
  32339. 1 == t.h && (e = v(d), f = e.next());
  32340. if (3 != t.h) {
  32341. if (f.done) {
  32342. t.h = 0;
  32343. return;
  32344. }
  32345. g = f.value;
  32346. k = v(g);
  32347. p = k.next().value;
  32348. return E(t, p);
  32349. }
  32350. f = e.next();
  32351. t.h = 2;
  32352. });
  32353. };
  32354. h.set = function (c, d, e) {
  32355. P(arguments, 2);
  32356. c = String(c);
  32357. var f = [],
  32358. g = O(c, d, e),
  32359. k = !0;
  32360. M(this.i, function (p) {
  32361. p[0] === c ? k && (k = !f.push(g)) : f.push(p);
  32362. });
  32363. k && f.push(g);
  32364. this.i = f;
  32365. };
  32366. h.values = function d() {
  32367. var e = this,
  32368. f,
  32369. g,
  32370. k,
  32371. p,
  32372. t;
  32373. return K(d, function (x) {
  32374. 1 == x.h && (f = v(e), g = f.next());
  32375. if (3 != x.h) {
  32376. if (g.done) {
  32377. x.h = 0;
  32378. return;
  32379. }
  32380. k = g.value;
  32381. p = v(k);
  32382. p.next();
  32383. t = p.next().value;
  32384. return E(x, t);
  32385. }
  32386. g = f.next();
  32387. x.h = 2;
  32388. });
  32389. };
  32390. X.prototype._asNative = function () {
  32391. for (var d = new R(), e = v(this), f = e.next(); !f.done; f = e.next()) {
  32392. var g = v(f.value);
  32393. f = g.next().value;
  32394. g = g.next().value;
  32395. d.append(f, g);
  32396. }
  32397. return d;
  32398. };
  32399. X.prototype._blob = function () {
  32400. var d = "----formdata-polyfill-" + Math.random(),
  32401. e = [],
  32402. f = "--" + d + '\r\nContent-Disposition: form-data; name="';
  32403. this.forEach(function (g, k) {
  32404. return "string" == typeof g ? e.push(f + escape(N(k)) + ('"\r\n\r\n' + N(g) + "\r\n")) : e.push(f + escape(N(k)) + ('"; filename="' + escape(g.name) + '"\r\nContent-Type: ' + (g.type || "application/octet-stream") + "\r\n\r\n"), g, "\r\n");
  32405. });
  32406. e.push("--" + d + "--");
  32407. return new Blob(e, {
  32408. type: "multipart/form-data; boundary=" + d
  32409. });
  32410. };
  32411. X.prototype[Symbol.iterator] = function () {
  32412. return this.entries();
  32413. };
  32414. X.prototype.toString = function () {
  32415. return "[object FormData]";
  32416. };
  32417. V && !V.matches && (V.matches = V.matchesSelector || V.mozMatchesSelector || V.msMatchesSelector || V.oMatchesSelector || V.webkitMatchesSelector || function (d) {
  32418. d = (this.document || this.ownerDocument).querySelectorAll(d);
  32419. for (var e = d.length; 0 <= --e && d.item(e) !== this;);
  32420. return -1 < e;
  32421. });
  32422. W && (X.prototype[W] = "FormData");
  32423. if (S) {
  32424. var Y = Q.XMLHttpRequest.prototype.setRequestHeader;
  32425. Q.XMLHttpRequest.prototype.setRequestHeader = function (d, e) {
  32426. Y.call(this, d, e);
  32427. "content-type" === d.toLowerCase() && (this.B = !0);
  32428. };
  32429. Q.XMLHttpRequest.prototype.send = function (d) {
  32430. d instanceof X ? (d = d._blob(), this.B || this.setRequestHeader("Content-Type", d.type), S.call(this, d)) : S.call(this, d);
  32431. };
  32432. }
  32433. T && (Q.fetch = function (d, e) {
  32434. e && e.body && e.body instanceof X && (e.body = e.body._blob());
  32435. return T.call(this, d, e);
  32436. });
  32437. U && (Q.navigator.sendBeacon = function (d, e) {
  32438. e instanceof X && (e = e._asNative());
  32439. return U.call(this, d, e);
  32440. });
  32441. Q.FormData = X;
  32442. }
  32443. })();
  32444. /**
  32445. * Created by wangweijie5 on 2016/12/16.
  32446. */
  32447. var _createClass = function () {
  32448. function defineProperties(target, props) {
  32449. for (var i = 0; i < props.length; i++) {
  32450. var descriptor = props[i];
  32451. descriptor.enumerable = descriptor.enumerable || false;
  32452. descriptor.configurable = true;
  32453. if ("value" in descriptor) descriptor.writable = true;
  32454. Object.defineProperty(target, descriptor.key, descriptor);
  32455. }
  32456. }
  32457. return function (Constructor, protoProps, staticProps) {
  32458. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  32459. if (staticProps) defineProperties(Constructor, staticProps);
  32460. return Constructor;
  32461. };
  32462. }();
  32463. function _classCallCheck(instance, Constructor) {
  32464. if (!(instance instanceof Constructor)) {
  32465. throw new TypeError("Cannot call a class as a function");
  32466. }
  32467. }
  32468. var __instance = function () {
  32469. var instance = void 0;
  32470. return function (newInstance) {
  32471. if (newInstance) instance = newInstance;
  32472. return instance;
  32473. };
  32474. }();
  32475. (function () {
  32476. function AudioRenderer() {
  32477. _classCallCheck(this, AudioRenderer);
  32478. if (__instance()) return __instance();
  32479. // 确保只有单例
  32480. if (AudioRenderer.unique !== undefined) {
  32481. return AudioRenderer.unique;
  32482. }
  32483. AudioRenderer.unique = this;
  32484. this.oAudioContext = null;
  32485. this.currentVolume = 80; // 初始音量
  32486. this.bSetVolume = false;
  32487. this.gainNode = null;
  32488. this.iWndNum = -1; // 窗口号
  32489. this.mVolumes = new Map(); // 用于存储所有音量
  32490. // Init AudioContext
  32491. var AudioContext = window.AudioContext || window.webkitAudioContext;
  32492. this.oAudioContext = new AudioContext();
  32493. this.writeString = function (view, offset, string) {
  32494. for (var i = 0; i < string.length; i++) {
  32495. view.setUint8(offset + i, string.charCodeAt(i));
  32496. }
  32497. };
  32498. this.setBufferToDataview = function (output, offset, input) {
  32499. for (var i = 0; i < input.length; i++, offset++) {
  32500. output.setUint8(offset, input[i]);
  32501. }
  32502. };
  32503. __instance(this);
  32504. }
  32505. /**
  32506. * @synopsis 音频播放
  32507. *
  32508. * @param dataBuf [IN] 音频缓存
  32509. * @param dataLen [IN] 缓存长度
  32510. * @param audioInfo [IN] 音频参数
  32511. *
  32512. * @returns 状态码
  32513. */
  32514. _createClass(AudioRenderer, [{
  32515. key: 'Play',
  32516. value: function Play(dataBuf, dataLen, audioInfo) {
  32517. var bufferData = new ArrayBuffer(44 + dataLen);
  32518. var viewTalk = new DataView(bufferData);
  32519. var sampleRates = audioInfo.samplesPerSec;
  32520. var channels = audioInfo.channels;
  32521. var bitsPerSample = audioInfo.bitsPerSample;
  32522. //console.log("audiorender sampleRates"+sampleRates+"channels:"+channels+"bitsPerSample:"+bitsPerSample);
  32523. /* RIFF identifier */
  32524. this.writeString(viewTalk, 0, 'RIFF');
  32525. /* file length */
  32526. viewTalk.setUint32(4, 32 + dataLen * 2, true);
  32527. /* RIFF type */
  32528. this.writeString(viewTalk, 8, 'WAVE');
  32529. /* format chunk identifier */
  32530. this.writeString(viewTalk, 12, 'fmt ');
  32531. /* format chunk length */
  32532. viewTalk.setUint32(16, 16, true);
  32533. /* sample format (raw) */
  32534. viewTalk.setUint16(20, 1, true);
  32535. /* channel count */
  32536. viewTalk.setUint16(22, channels, true);
  32537. /* sample rate */
  32538. viewTalk.setUint32(24, sampleRates, true);
  32539. /* byte rate (sample rate * block align) */
  32540. viewTalk.setUint32(28, sampleRates * 2, true);
  32541. /* block align (channel count * bytes per sample)/8 */
  32542. viewTalk.setUint16(32, channels * bitsPerSample / 8, true);
  32543. /* bits per sample */
  32544. viewTalk.setUint16(34, bitsPerSample, true);
  32545. /* data chunk identifier */
  32546. this.writeString(viewTalk, 36, 'data');
  32547. /* data chunk length */
  32548. viewTalk.setUint32(40, dataLen, true);
  32549. this.setBufferToDataview(viewTalk, 44, dataBuf);
  32550. var self = this;
  32551. this.oAudioContext.decodeAudioData(viewTalk.buffer, function (buffer) {
  32552. var bufferSource = self.oAudioContext.createBufferSource();
  32553. if (bufferSource == null) {
  32554. return -1;
  32555. }
  32556. bufferSource.buffer = buffer;
  32557. bufferSource.start(0);
  32558. if (self.gainNode == null || self.bSetVolume) {
  32559. self.gainNode = self.oAudioContext.createGain();
  32560. // self.gainNode.gain.value = self.currentVolume;
  32561. // // self.currentVolume = self.gainNode.gain.value;
  32562. // self.gainNode.connect(self.oAudioContext.destination);
  32563. self.bSetVolume = false;
  32564. }
  32565. self.gainNode.gain.value = self.currentVolume / 100;
  32566. // self.currentVolume = self.gainNode.gain.value;
  32567. self.gainNode.connect(self.oAudioContext.destination);
  32568. bufferSource.connect(self.gainNode);
  32569. }, function (e) {
  32570. console.log("decode error");
  32571. return -1;
  32572. });
  32573. return 0;
  32574. }
  32575. /**
  32576. * @synopsis 停止播放
  32577. *
  32578. * @returns 返回音量
  32579. */
  32580. }, {
  32581. key: 'Stop',
  32582. value: function Stop() {
  32583. if (this.gainNode != null) {
  32584. this.gainNode.disconnect();
  32585. this.gainNode = null;
  32586. }
  32587. // this.oAudioContext.close();
  32588. // AudioRenderer.unique = undefined;
  32589. // __instance() = null;
  32590. return true;
  32591. }
  32592. /**
  32593. * @synopsis 设置音量
  32594. *
  32595. * @param iVolume [IN] 音量
  32596. *
  32597. * @returns 状态码
  32598. */
  32599. }, {
  32600. key: 'SetVolume',
  32601. value: function SetVolume(iVolume) {
  32602. this.bSetVolume = true;
  32603. this.currentVolume = iVolume;
  32604. // 储存当前窗口设置音量值
  32605. this.mVolumes.set(this.iWndNum, this.currentVolume);
  32606. return true;
  32607. }
  32608. /**
  32609. * @synopsis 设置窗口号
  32610. *
  32611. * @param iWndNum [IN] 窗口号
  32612. *
  32613. * @returns 状态码
  32614. */
  32615. }, {
  32616. key: 'SetWndNum',
  32617. value: function SetWndNum(iWndNum) {
  32618. this.iWndNum = iWndNum;
  32619. // 获取当前窗口设置音量值
  32620. var iVolume = this.mVolumes.get(iWndNum);
  32621. if (iVolume == undefined) {
  32622. iVolume = 80; // 默认音量
  32623. }
  32624. this.currentVolume = iVolume;
  32625. return true;
  32626. }
  32627. /**
  32628. * @synopsis 获取音量
  32629. *
  32630. * @returns 返回音量
  32631. */
  32632. }, {
  32633. key: 'GetVolume',
  32634. value: function GetVolume() {
  32635. // 获取当前窗口设置音量值
  32636. var iVolume = this.mVolumes.get(this.iWndNum);
  32637. if (iVolume == undefined) {
  32638. iVolume = 80; // 默认音量
  32639. }
  32640. return iVolume;
  32641. }
  32642. }]);
  32643. window.AudioRenderer = AudioRenderer;
  32644. return AudioRenderer;
  32645. })();
  32646. //顶点着色器
  32647. //attribute修饰符用于声明由浏览器(javascript)传输给顶点着色器的变量值;
  32648. // vertexPos即我们定义的顶点坐标;
  32649. // gl_Position是一个内建的传出变量。
  32650. var vertexYUVShader = ['attribute vec4 vertexPos;', 'attribute vec2 texturePos;', 'varying vec2 textureCoord;', 'void main()', '{', 'gl_Position = vertexPos;', 'textureCoord = texturePos;', '}'].join('\n');
  32651. //像素着色器(yuv->rgb)
  32652. var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCoord;', 'uniform sampler2D ySampler;', 'uniform sampler2D uSampler;', 'uniform sampler2D vSampler;', 'const mat4 YUV2RGB = mat4', '(', '1.1643828125, 0, 1.59602734375, -.87078515625,', '1.1643828125, -.39176171875, -.81296875, .52959375,', '1.1643828125, 2.017234375, 0, -1.081390625,', '0, 0, 0, 1', ');', 'void main(void) {', 'highp float y = texture2D(ySampler, textureCoord).r;', 'highp float u = texture2D(uSampler, textureCoord).r;', 'highp float v = texture2D(vSampler, textureCoord).r;', 'gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;', '}'].join('\n');
  32653. (function (root, factory) {
  32654. // root.SuperRender = factory();
  32655. window.SuperRender = factory();
  32656. })(undefined, function () {
  32657. function RenderManager(canvas) {
  32658. this.canvasElement = document.getElementById(canvas);
  32659. this.initContextGL();
  32660. if (this.contextGL) {
  32661. this.YUVProgram = this.initProgram(vertexYUVShader, fragmentYUVShader);
  32662. this.initBuffers();
  32663. this.initTextures();
  32664. }
  32665. }
  32666. /**
  32667. * 初始化WebGL上下文
  32668. */
  32669. RenderManager.prototype.initContextGL = function () {
  32670. var canvas = this.canvasElement;
  32671. var gl = null;
  32672. try {
  32673. gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
  32674. } catch (e) {
  32675. gl = null;
  32676. }
  32677. if (!gl || typeof gl.getParameter !== "function") {
  32678. gl = null;
  32679. }
  32680. this.contextGL = gl;
  32681. console.log("WebGL1.0");
  32682. };
  32683. /**
  32684. * 初始化着色器程序
  32685. * @param vertexShaderScript 顶点着色器脚本
  32686. * @param fragmentShaderScript 片段着色器脚本
  32687. */
  32688. RenderManager.prototype.initProgram = function (vertexShaderScript, fragmentShaderScript) {
  32689. var gl = this.contextGL;
  32690. var vertexShader = gl.createShader(gl.VERTEX_SHADER); //创建定点着色器
  32691. gl.shaderSource(vertexShader, vertexShaderScript);
  32692. gl.compileShader(vertexShader);
  32693. if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
  32694. console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));
  32695. }
  32696. var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
  32697. gl.shaderSource(fragmentShader, fragmentShaderScript);
  32698. gl.compileShader(fragmentShader);
  32699. if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
  32700. console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));
  32701. }
  32702. var program = gl.createProgram();
  32703. gl.attachShader(program, vertexShader);
  32704. gl.attachShader(program, fragmentShader);
  32705. gl.linkProgram(program);
  32706. if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
  32707. console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));
  32708. }
  32709. gl.deleteShader(vertexShader);
  32710. gl.deleteShader(fragmentShader);
  32711. return program;
  32712. };
  32713. /**
  32714. * 初始化数据缓存
  32715. */
  32716. RenderManager.prototype.initBuffers = function () {
  32717. var gl = this.contextGL;
  32718. var vertexPosBuffer = gl.createBuffer();
  32719. gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);
  32720. gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);
  32721. gl.bindBuffer(gl.ARRAY_BUFFER, null);
  32722. var texturePosBuffer = gl.createBuffer();
  32723. gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
  32724. gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.DYNAMIC_DRAW);
  32725. gl.bindBuffer(gl.ARRAY_BUFFER, null);
  32726. this.vertexPosBuffer = vertexPosBuffer;
  32727. this.texturePosBuffer = texturePosBuffer;
  32728. };
  32729. /**
  32730. * 创建纹理
  32731. */
  32732. RenderManager.prototype.initTexture = function () {
  32733. var gl = this.contextGL;
  32734. var textureRef = gl.createTexture();
  32735. gl.bindTexture(gl.TEXTURE_2D, textureRef);
  32736. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
  32737. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
  32738. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
  32739. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
  32740. gl.bindTexture(gl.TEXTURE_2D, null);
  32741. return textureRef;
  32742. };
  32743. /**
  32744. * 初始化YUV纹理
  32745. */
  32746. RenderManager.prototype.initTextures = function () {
  32747. var gl = this.contextGL;
  32748. var program = this.YUVProgram;
  32749. gl.useProgram(program);
  32750. var yTextureRef = this.initTexture();
  32751. var ySamplerRef = gl.getUniformLocation(program, 'ySampler');
  32752. gl.uniform1i(ySamplerRef, 0);
  32753. this.yTextureRef = yTextureRef;
  32754. var uTextureRef = this.initTexture();
  32755. var uSamplerRef = gl.getUniformLocation(program, 'uSampler');
  32756. gl.uniform1i(uSamplerRef, 1);
  32757. this.uTextureRef = uTextureRef;
  32758. var vTextureRef = this.initTexture();
  32759. var vSamplerRef = gl.getUniformLocation(program, 'vSampler');
  32760. gl.uniform1i(vSamplerRef, 2);
  32761. this.vTextureRef = vTextureRef;
  32762. gl.useProgram(null);
  32763. };
  32764. /**
  32765. * 显示帧数据
  32766. * @param nWidth 宽度
  32767. * @param nHeight 高度
  32768. * @param nHeight 帧数据
  32769. */
  32770. RenderManager.prototype.SR_DisplayFrameData = function (nWidth, nHeight, pData, dWidth, dHeight) {
  32771. if (nWidth <= 0 || nHeight <= 0) {
  32772. return;
  32773. }
  32774. var gl = this.contextGL;
  32775. if (null == pData) {
  32776. gl.clearColor(0.0, 0.0, 0.0, 0.0);
  32777. gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
  32778. return;
  32779. }
  32780. var canvas = this.canvasElement;
  32781. this.nWindowWidth = canvas.width;
  32782. this.nWindowHeight = canvas.height;
  32783. var nWindowWidth = this.nWindowWidth;
  32784. var nWindowHeight = this.nWindowHeight;
  32785. gl.clearColor(0.8, 0.8, 1.0, 1.0);
  32786. gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
  32787. gl.viewport(0, 0, nWindowWidth, nWindowHeight);
  32788. this.updateFrameData(nWidth, nHeight, pData, dWidth, dHeight);
  32789. var program = this.YUVProgram;
  32790. gl.useProgram(program);
  32791. var vertexPosBuffer = this.vertexPosBuffer;
  32792. gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);
  32793. var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');
  32794. gl.enableVertexAttribArray(vertexPosRef);
  32795. gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);
  32796. gl.bindBuffer(gl.ARRAY_BUFFER, null);
  32797. var texturePosBuffer = this.texturePosBuffer;
  32798. gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
  32799. var texturePosRef = gl.getAttribLocation(program, 'texturePos');
  32800. gl.enableVertexAttribArray(texturePosRef);
  32801. gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);
  32802. gl.bindBuffer(gl.ARRAY_BUFFER, null);
  32803. gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
  32804. gl.disableVertexAttribArray(vertexPosRef);
  32805. gl.disableVertexAttribArray(texturePosRef);
  32806. gl.useProgram(null);
  32807. };
  32808. /**
  32809. * 上传YUV数据到纹理
  32810. * @param nWidth 宽度
  32811. * @param nHeight 高度
  32812. * @param nHeight 帧数据
  32813. */
  32814. RenderManager.prototype.updateFrameData = function (width, height, data, dWidth, dHeight) {
  32815. var gl = this.contextGL;
  32816. var yTextureRef = this.yTextureRef;
  32817. var uTextureRef = this.uTextureRef;
  32818. var vTextureRef = this.vTextureRef;
  32819. var i420Data = data;
  32820. // debugger;
  32821. if (width == dWidth && height == dHeight) {
  32822. var yDataLength = width * height;
  32823. var yData = i420Data.subarray(0, yDataLength);
  32824. gl.activeTexture(gl.TEXTURE0);
  32825. gl.bindTexture(gl.TEXTURE_2D, yTextureRef);
  32826. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width, height, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, yData);
  32827. var cbDataLength = width / 2 * height / 2;
  32828. var cbData = i420Data.subarray(width * height, width * height + cbDataLength);
  32829. gl.activeTexture(gl.TEXTURE2);
  32830. gl.bindTexture(gl.TEXTURE_2D, vTextureRef);
  32831. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width / 2, height / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, cbData);
  32832. var crDataLength = cbDataLength;
  32833. var crData = i420Data.subarray(width * height + width * height / 4, width * height + width * height / 4 + crDataLength);
  32834. gl.activeTexture(gl.TEXTURE1);
  32835. gl.bindTexture(gl.TEXTURE_2D, uTextureRef);
  32836. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width / 2, height / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, crData);
  32837. } else {
  32838. // //裁剪宽
  32839. var yDataLength = dWidth * dHeight;
  32840. var yData = new Uint8Array(yDataLength);
  32841. for (var i = 0; i < dHeight; i++) {
  32842. //var ySonData=new Uint8Array(dWidth) ;
  32843. var ySonData = i420Data.subarray(i * width, i * width + dWidth);
  32844. for (var j = 0; j < dWidth; j++) {
  32845. yData[i * dWidth + j] = ySonData[j];
  32846. }
  32847. }
  32848. gl.activeTexture(gl.TEXTURE0);
  32849. gl.bindTexture(gl.TEXTURE_2D, yTextureRef);
  32850. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth, dHeight, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, yData);
  32851. yData = null;
  32852. ySonData = null;
  32853. var cbDataLength = dWidth / 2 * dHeight / 2;
  32854. var cbData = new Uint8Array(cbDataLength);
  32855. //var cbSonData=new Uint8Array(dWidth/2) ;
  32856. for (var i = 0; i < dHeight / 2; i++) {
  32857. var cbSonData = i420Data.subarray(width * height + i * width / 2, width * height + i * width / 2 + dWidth / 2);
  32858. for (var j = 0; j < dWidth / 2; j++) {
  32859. cbData[i * dWidth / 2 + j] = cbSonData[j];
  32860. }
  32861. }
  32862. gl.activeTexture(gl.TEXTURE2);
  32863. gl.bindTexture(gl.TEXTURE_2D, vTextureRef);
  32864. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth / 2, dHeight / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, cbData);
  32865. cbData = null;
  32866. cbSonData = null;
  32867. var crDataLength = cbDataLength;
  32868. var crData = new Uint8Array(crDataLength);
  32869. for (var i = 0; i < dHeight / 2; i++) {
  32870. var crSonData = i420Data.subarray(width * height * 5 / 4 + i * width / 2, width * height * 5 / 4 + i * width / 2 + dWidth / 2);
  32871. for (var j = 0; j < dWidth / 2; j++) {
  32872. crData[i * dWidth / 2 + j] = crSonData[j];
  32873. }
  32874. }
  32875. gl.activeTexture(gl.TEXTURE1);
  32876. gl.bindTexture(gl.TEXTURE_2D, uTextureRef);
  32877. gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth / 2, dHeight / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, crData);
  32878. crData = null;
  32879. crSonData = null;
  32880. }
  32881. };
  32882. /**
  32883. * 设置显示区域
  32884. * @param stDisplayRect 显示区域
  32885. */
  32886. RenderManager.prototype.SR_SetDisplayRect = function (stDisplayRect) {
  32887. var gl = this.contextGL;
  32888. var nWindowWidth = this.nWindowWidth;
  32889. var nWindowHeight = this.nWindowHeight;
  32890. var texturePosValues = null;
  32891. if (stDisplayRect && nWindowWidth > 0 && nWindowHeight > 0) {
  32892. var fLeft = stDisplayRect.left / nWindowWidth;
  32893. var fTop = stDisplayRect.top / nWindowHeight;
  32894. var fRight = stDisplayRect.right / nWindowWidth;
  32895. var fBottom = stDisplayRect.bottom / nWindowHeight;
  32896. texturePosValues = new Float32Array([fRight, fTop, fLeft, fTop, fRight, fBottom, fLeft, fBottom]);
  32897. } else {
  32898. texturePosValues = new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]);
  32899. }
  32900. var texturePosBuffer = this.texturePosBuffer;
  32901. gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
  32902. gl.bufferSubData(gl.ARRAY_BUFFER, 0, texturePosValues);
  32903. gl.bindBuffer(gl.ARRAY_BUFFER, null);
  32904. };
  32905. /**
  32906. * 释放显示资源
  32907. */
  32908. RenderManager.prototype.SR_Destroy = function () {
  32909. var gl = this.contextGL;
  32910. var YUVProgram = this.YUVProgram;
  32911. gl.deleteProgram(YUVProgram);
  32912. var vertexPosBuffer = this.vertexPosBuffer;
  32913. var texturePosBuffer = this.texturePosBuffer;
  32914. gl.deleteBuffer(vertexPosBuffer);
  32915. gl.deleteBuffer(texturePosBuffer);
  32916. var yTextureRef = this.yTextureRef;
  32917. var uTextureRef = this.uTextureRef;
  32918. var vTextureRef = this.vTextureRef;
  32919. gl.deleteTexture(yTextureRef);
  32920. gl.deleteTexture(uTextureRef);
  32921. gl.deleteTexture(vTextureRef);
  32922. //gl.getExtension('WEBGL_lose_context').loseContext();
  32923. };
  32924. return RenderManager;
  32925. });
  32926. // 插件资源静态域名
  32927. var uikitStaticDomain = 'https://open.ys7.com';
  32928. // const uikitStaticDomain = 'https://test13open.ys7.com';
  32929. var uikitStaticPathV2 = "".concat(uikitStaticDomain, "/console/ezuikit_static/v66/v2");
  32930. var uikitStaticPathV1 = "".concat(uikitStaticDomain, "/console/ezuikit_static/v66/v1");
  32931. // iframe模板 - 兼容旧版本
  32932. var matchTemplate = function matchTemplate(templateName, params) {
  32933. var IFRAMETEMPLATE = ['theme', 'standard'];
  32934. var LOCALTEMPLATE = ['pcLive', 'pcRec', 'mobileLive', 'mobileRec', 'noData', 'security', 'voice', 'simple'];
  32935. if (typeof templateName === 'undefined') {
  32936. if (params.themeData) {
  32937. return {
  32938. templateType: 'themeData',
  32939. templateId: 'themeData'
  32940. };
  32941. }
  32942. return {
  32943. templateType: 'local',
  32944. templateId: ''
  32945. };
  32946. }
  32947. if (typeof templateName === 'string') {
  32948. if (templateName.length === 32) {
  32949. return {
  32950. templateType: 'remote',
  32951. templateId: templateName
  32952. };
  32953. } else if (IFRAMETEMPLATE.indexOf(templateName) !== -1) {
  32954. // 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
  32955. if (templateName === 'simple' && typeof params.header === 'undefined' && typeof params.footer === 'undefined') {
  32956. return {
  32957. templateType: 'local',
  32958. templateId: ''
  32959. };
  32960. }
  32961. return {
  32962. templateType: 'iframe',
  32963. templateId: templateName
  32964. };
  32965. } else if (LOCALTEMPLATE.indexOf(templateName) !== -1) {
  32966. return {
  32967. templateType: 'local',
  32968. templateId: templateName
  32969. };
  32970. }
  32971. }
  32972. };
  32973. // 是否多进程可用
  32974. var isVersion2Available = function isVersion2Available() {
  32975. var ua = window.navigator.userAgent.toLowerCase(); //获取用户端信息
  32976. var info = {
  32977. sa: /version.*safari/.test(ua),
  32978. //匹配Safari浏览器
  32979. ch: /chrome/.test(ua),
  32980. //匹配Chrome浏览器
  32981. ff: /gecko/.test(ua) && !/webkit/.test(ua) //匹配Firefox浏览器
  32982. };
  32983. var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  32984. if (isMobile) {
  32985. return false;
  32986. } else if (info.ch) {
  32987. var getChromeVersion = function getChromeVersion() {
  32988. var arr = window.navigator.userAgent.split(' ');
  32989. var chromeVersion = '';
  32990. for (var i = 0; i < arr.length; i++) {
  32991. if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
  32992. }
  32993. if (chromeVersion) {
  32994. return Number(chromeVersion.split('/')[1].split('.')[0]);
  32995. } else {
  32996. return false;
  32997. }
  32998. };
  32999. return getChromeVersion() > 91 && !!window.SharedArrayBuffer;
  33000. }
  33001. return false;
  33002. };
  33003. var EZUIKitPlayer = /*#__PURE__*/function () {
  33004. function EZUIKitPlayer(params) {
  33005. var _this = this;
  33006. _classCallCheck$1(this, EZUIKitPlayer);
  33007. // 解决当ws连接建立但是没有推流导致未触发播放成功事件,
  33008. // 此时切换设备执行 播放器 stop 时触发了播放成功事件导致设备序列号重置
  33009. this.isStoping = false; // 是否在播放前 stop 执行过程中
  33010. var _params$autoplay = params.autoplay,
  33011. autoplay = _params$autoplay === void 0 ? true : _params$autoplay;
  33012. // 如果设置了模板(除精简版),此处不自动播放,根据模板判断是否执行自动播放:
  33013. if (params.template || params.themeData) {
  33014. autoplay = false;
  33015. }
  33016. this.params = params;
  33017. this.autoplay = autoplay;
  33018. window.EZUIKit[params.id] = {
  33019. state: {
  33020. EZUIKitPlayer: {
  33021. init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
  33022. themeInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit || false,
  33023. talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
  33024. }
  33025. }
  33026. };
  33027. if (matchTemplate(this.params.template, params).templateType !== 'iframe') {
  33028. this.Monitor = new Monitor({
  33029. env: !(typeof params.disableMonitor !== 'undefined' && params.disableMonitor) ? 'online' : 'test12'
  33030. }, this);
  33031. this.id = params.id;
  33032. this.width = params.width;
  33033. this.height = params.height;
  33034. this.url = params.url;
  33035. this.accessToken = params.accessToken;
  33036. this.themeId = matchTemplate(params.template, params).templateId;
  33037. this.id = params.id;
  33038. this.audio = true;
  33039. this.poster = params.poster;
  33040. this.speed = 1;
  33041. this.disabledTimeLine = false;
  33042. this.disabledPTZ = false;
  33043. this.enableSharedArrayBufferGuide = false;
  33044. this.capacity = {};
  33045. this.playTimer = null; // 播放定时器,限制至少1秒触发播放
  33046. this.env = {
  33047. domain: "https://open.ys7.com"
  33048. };
  33049. var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  33050. this.isMobile = isMobile;
  33051. // 兼容多次初始化
  33052. if (document.getElementById("".concat(this.id, "-wrap"))) {
  33053. document.getElementById("".concat(this.id, "-wrap")).innerHTML = "";
  33054. document.getElementById("".concat(this.id, "-wrap")).id = this.id;
  33055. }
  33056. this.staticPath = isVersion2Available() ? uikitStaticPathV2 : uikitStaticPathV1;
  33057. if (typeof params.staticPath === 'string') {
  33058. if (params.staticPath.startsWith("http")) {
  33059. this.staticPath = params.staticPath;
  33060. } else {
  33061. this.staticPath = window.location.protocol + '//' + window.location.host + params.staticPath;
  33062. }
  33063. if (isVersion2Available()) {
  33064. this.staticPath += '/v2';
  33065. } else {
  33066. this.staticPath += '/v1';
  33067. }
  33068. }
  33069. if (typeof params.audio !== 'undefined') {
  33070. this.audio = params.audio;
  33071. }
  33072. if (typeof params.env !== 'undefined') {
  33073. this.env = Object.assign(this.env, params.env);
  33074. }
  33075. if (typeof params.isMobile !== 'undefined') {
  33076. this.isMobile = params.isMobile;
  33077. }
  33078. if (typeof params.disabledTimeLine !== 'undefined') {
  33079. this.disabledTimeLine = params.disabledTimeLine;
  33080. }
  33081. if (typeof params.disabledPTZ !== 'undefined') {
  33082. this.disabledPTZ = params.disabledPTZ;
  33083. }
  33084. if (typeof params.enableSharedArrayBufferGuide !== 'undefined') {
  33085. this.enableSharedArrayBufferGuide = params.enableSharedArrayBufferGuide;
  33086. }
  33087. var pluginUrl = "".concat(this.staticPath, "/js/jsPluginV1-1.0.0.min.js");
  33088. // 执行初始化;
  33089. var doInit = function doInit() {
  33090. window.addPluginUrlIng = true;
  33091. if (isVersion2Available()) {
  33092. console.log("启用多线程解析视频");
  33093. pluginUrl = "".concat(_this.staticPath, "/js/jsPluginV2-2.0.1.min.js");
  33094. } else {
  33095. // 是否引导用户开启谷歌实验室 Google Labs 特性
  33096. //enableSharedArrayBufferGuide
  33097. var getChromeVersion = function getChromeVersion() {
  33098. var arr = navigator.userAgent.split(' ');
  33099. var chromeVersion = '';
  33100. for (var i = 0; i < arr.length; i++) {
  33101. if (/chrome/i.test(arr[i])) {
  33102. chromeVersion = arr[i];
  33103. }
  33104. }
  33105. if (chromeVersion) {
  33106. return Number(chromeVersion.split('/')[1].split('.')[0]);
  33107. }
  33108. return false;
  33109. };
  33110. // pc端 谷歌浏览器 版本 > 91
  33111. if (!isMobile && 91 < getChromeVersion && _this.enableSharedArrayBufferGuide) {
  33112. console.log("提示用户开启谷歌实验室特性");
  33113. var wapDomId = "".concat(_this.id, "-wrap");
  33114. var guideDom = document.createElement("div");
  33115. var guideSpan = document.createElement("span");
  33116. guideSpan.innerHTML = "您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见";
  33117. guideDom.appendChild(guideSpan);
  33118. var guideLink = document.createElement("a");
  33119. guideLink.href = "https://open.ys7.com/help/384";
  33120. guideLink.setAttribute("target", "_blank");
  33121. guideDom.appendChild(guideLink);
  33122. guideLink.innerHTML = "开启说明";
  33123. //guideDom.innerHTML = "您的浏览器当前使用单进程播放视频,可能因内存占用过高导致浏览器卡顿,您可参考·谷歌浏览器开启多线程(链接)·开启谷歌实验室多线程特性,获取更好播放体验";
  33124. guideDom.id = "".concat(_this.id, "-guide");
  33125. guideDom.style = "font-size:12px;color:red;";
  33126. setTimeout(function () {
  33127. if (document.getElementById(wapDomId)) {
  33128. document.getElementById(wapDomId).insertBefore(guideDom, document.getElementById(_this.id));
  33129. }
  33130. }, 5000);
  33131. }
  33132. }
  33133. _this.pluginStatus = new Status(_this, _this.id);
  33134. addJs(pluginUrl, function () {
  33135. if (_this.autoplay) {
  33136. _this.initTime = new Date().getTime();
  33137. _this.Monitor.dclog({
  33138. url: _this.url,
  33139. action: 0,
  33140. text: 'startInit',
  33141. isVersion2Available: isVersion2Available() ? 1 : 0
  33142. });
  33143. _this.Monitor.localInfoLog({
  33144. Serial: matchEzopenUrl(_this.url).deviceSerial,
  33145. Channel: matchEzopenUrl(_this.url).channelNo,
  33146. Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0",
  33147. ExterVer: isVersion2Available() ? "v7.0.0" : "v6.0.0"
  33148. });
  33149. console.log("初始化-");
  33150. var initEZUIKitPlayerPromise = _this.initEZUIKitPlayer(params);
  33151. var getRealUrlPromise = _this._getRealUrlPromise(params.accessToken, params.url);
  33152. Promise.all([initEZUIKitPlayerPromise, getRealUrlPromise]).then(function (values) {
  33153. if (values[1]) {
  33154. _this.playStartTime = new Date().getTime();
  33155. _this._pluginPlay(values[1], function () {
  33156. console.log("自动播放成功");
  33157. _this.Monitor.dclog({
  33158. url: _this.url,
  33159. action: 202,
  33160. d: new Date().getTime() - _this.initTime,
  33161. text: 'autoPlaySuccess'
  33162. });
  33163. }, function () {
  33164. console.log("自动播放失败");
  33165. _this.Monitor.dclog({
  33166. url: _this.url,
  33167. action: 402,
  33168. d: new Date().getTime() - _this.initTime,
  33169. text: 'autoPlayError'
  33170. });
  33171. });
  33172. } else {
  33173. console.log("promise of one", values);
  33174. }
  33175. window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
  33176. if (document.getElementById("".concat(params.id, "canvas_draw0"))) {
  33177. document.getElementById("".concat(params.id, "canvas_draw0")).style.border = "none";
  33178. }
  33179. })["catch"](function (err) {
  33180. console.log("err", err);
  33181. if (_this.Theme) {
  33182. _this.Theme.setDisabled(true);
  33183. }
  33184. _this.pluginStatus.loadingClear();
  33185. _this.pluginStatus.loadingSetText({
  33186. text: err && err.msg || "获取播放地址失败",
  33187. color: 'red'
  33188. });
  33189. });
  33190. } else {
  33191. _this.initTime = new Date().getTime();
  33192. _this.Monitor.dclog({
  33193. url: _this.url,
  33194. action: 0,
  33195. text: 'startInit',
  33196. isVersion2Available: isVersion2Available() ? 1 : 0
  33197. });
  33198. _this.Monitor.localInfoLog({
  33199. Serial: matchEzopenUrl(_this.url).deviceSerial,
  33200. Channel: matchEzopenUrl(_this.url).channelNo,
  33201. Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
  33202. });
  33203. var initEZUIKitPlayerPromise = _this.initEZUIKitPlayer(params);
  33204. initEZUIKitPlayerPromise.then(function (data) {
  33205. console.log("初始化成功", data);
  33206. window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
  33207. if (document.getElementById("".concat(params.id, "canvas_draw0"))) {
  33208. document.getElementById("".concat(params.id, "canvas_draw0")).style.border = "none";
  33209. }
  33210. //xuehb 初始化成功 2
  33211. _this.initSuccessTime = new Date().getTime();
  33212. _this.Monitor.dclog({
  33213. url: _this.url,
  33214. action: 201,
  33215. d: _this.initSuccessTime - _this.initTime,
  33216. text: 'initSuccess',
  33217. isVersion2Available: isVersion2Available() ? 1 : 0
  33218. });
  33219. });
  33220. }
  33221. }, function () {
  33222. if (isVersion2Available()) {
  33223. return !!window.JSPluginV2 || !!window.addPluginUrled;
  33224. }
  33225. return !!window.JSPluginV1 || !!window.addPluginUrled;
  33226. });
  33227. if (params.plugin && params.plugin.indexOf("talk") !== -1) {
  33228. _this.Talk = new Talk(_this);
  33229. window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit = true;
  33230. }
  33231. _this.getDeviceCapacity();
  33232. };
  33233. // 如果浏览器正在加载插件
  33234. if (window.addPluginUrlIng) {
  33235. var doInitTimer = setInterval(function () {
  33236. if (window.JSPluginV1 || window.JSPluginV2) {
  33237. // 判断加载成功
  33238. clearInterval(doInitTimer);
  33239. doInit();
  33240. }
  33241. }, 50);
  33242. } else {
  33243. doInit();
  33244. }
  33245. } else {
  33246. return new EZUIKitV3$1.EZUIKitPlayer(params);
  33247. }
  33248. // this.stop = debouncePromise(()=>this._stop(),0,true);
  33249. this.play = dist(function (options) {
  33250. return _this._play(options);
  33251. }, 500, true);
  33252. this.resume = dist(function (time) {
  33253. return _this._resume(time);
  33254. }, 500, true);
  33255. //xuehb
  33256. this.changePlayUrl = dist(function (options, callback) {
  33257. return _this._changePlayUrl(options, callback);
  33258. }, 500);
  33259. // 监听到页面退出
  33260. // 研究院反馈,播放过程中退出页面需要执行停止视频,否则可能导致浏览器崩溃
  33261. window.addEventListener("beforeunload", function () {
  33262. console.log("退出页面,停止视频流");
  33263. _this.stop();
  33264. });
  33265. }
  33266. _createClass$1(EZUIKitPlayer, [{
  33267. key: "initEZUIKitPlayer",
  33268. value: function initEZUIKitPlayer(params) {
  33269. var _this2 = this;
  33270. var id = params.id,
  33271. _params$width = params.width,
  33272. width = _params$width === void 0 ? 600 : _params$width,
  33273. _params$height = params.height,
  33274. height = _params$height === void 0 ? 400 : _params$height;
  33275. if (!params.width || !params.height) {
  33276. var videoDOMBounding = document.getElementById(id).getBoundingClientRect();
  33277. if (!params.width && videoDOMBounding.width > 0) {
  33278. width = videoDOMBounding.width;
  33279. }
  33280. if (!params.height && videoDOMBounding.height > 0) {
  33281. height = videoDOMBounding.height;
  33282. }
  33283. }
  33284. if (!document.getElementById("".concat(id, "-wrap"))) {
  33285. var wapDom = document.createElement("div");
  33286. wapDom.id = "".concat(id, "-wrap");
  33287. wapDom.style = "display:inline-block;width:".concat(width, "px;position:relative;vertical-align: bottom;");
  33288. document.getElementById(id).parentNode.insertBefore(wapDom, document.getElementById(id));
  33289. document.getElementById(id).parentNode.removeChild(document.getElementById(id));
  33290. // wapDom.appendChild(document.getElementById(id));
  33291. wapDom.innerHTML = "<div id=".concat(id, "></div>");
  33292. document.getElementById(id).style = "display:inline-block;width:".concat(width, "px;height:").concat(height, "px;");
  33293. document.getElementById(id).style.verticalAlign = "top";
  33294. }
  33295. if (this.themeId) {
  33296. this.Theme = new Theme(this, params.id);
  33297. window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
  33298. this.Monitor.dclog({
  33299. url: this.url,
  33300. action: 2,
  33301. text: this.themeId
  33302. });
  33303. if (typeof this.params.handleThemeChange === 'function') {
  33304. this.handleThemeChange = this.params.handleThemeChange;
  33305. }
  33306. }
  33307. // 初始化Message模块
  33308. var pluginMessage = new Message(this, id);
  33309. this.Message = pluginMessage;
  33310. var initDecoder = function initDecoder(resolve, reject) {
  33311. var jSPlugin;
  33312. if (isVersion2Available()) {
  33313. jSPlugin = new window.JSPluginV2({
  33314. szId: id,
  33315. iType: 2,
  33316. iWidth: width,
  33317. iHeight: height,
  33318. iMaxSplit: 1,
  33319. iCurrentSplit: 1,
  33320. szBasePath: "",
  33321. staticPath: _this2.staticPath,
  33322. oStyle: {
  33323. border: "none",
  33324. background: "#000000"
  33325. }
  33326. });
  33327. // 增加视频容器
  33328. //var pluginStatus = new Status(this, id);
  33329. _this2.pluginStatus.loadingStart(id);
  33330. _this2.pluginStatus.loadingSetText({
  33331. text: '初始化播放器完成'
  33332. });
  33333. jSPlugin.EventCallback = {
  33334. pluginErrorHandler: function pluginErrorHandler(iWndIndex, iErrorCode, oError) {
  33335. //插件错误回调
  33336. console.log(iWndIndex, iErrorCode, oError);
  33337. if (iErrorCode === 1003) {
  33338. console.log("断流");
  33339. _this2.Theme.setDecoderState({
  33340. play: false
  33341. });
  33342. _this2.pluginStatus.setPlayStatus({
  33343. play: false
  33344. });
  33345. if (!jSPlugin.bPlay) {
  33346. _this2.pluginStatus.loadingClear();
  33347. _this2.pluginStatus.loadingSetText({
  33348. text: "连接断开,请重试",
  33349. color: 'red'
  33350. });
  33351. }
  33352. if (typeof _this2.params.handleError === 'function') {
  33353. _this2.params.handleError({
  33354. msg: "连接断开,请重试",
  33355. retcode: 1003,
  33356. id: _this2.params.id,
  33357. type: "handleError"
  33358. });
  33359. }
  33360. } else {
  33361. //推流异常时展示响应提示
  33362. if (oError.errorCode != 1) {
  33363. var errorInfo = _this2.errorHander.matchErrorInfo(oError.errorCode);
  33364. var msg = '连接断开,请重试';
  33365. if (errorInfo && errorInfo.msg) {
  33366. msg = errorInfo.msg;
  33367. } else if (errorInfo && errorInfo.description) {
  33368. msg = errorInfo.description;
  33369. }
  33370. _this2.Theme.setDecoderState({
  33371. play: false
  33372. });
  33373. _this2.pluginStatus.setPlayStatus({
  33374. play: false
  33375. });
  33376. _this2.pluginStatus.loadingClear();
  33377. _this2.pluginStatus.loadingSetText({
  33378. text: msg,
  33379. color: 'red'
  33380. });
  33381. } else {
  33382. _this2.pluginStatus.loadingClear();
  33383. if (_this2.Theme) {
  33384. _this2.Theme.setDisabled(false);
  33385. }
  33386. }
  33387. }
  33388. },
  33389. //xuehb 开启取流 4
  33390. openStreamCallback: function openStreamCallback() {
  33391. //开启取流回调 4
  33392. console.log("开启取流");
  33393. _this2.openStreamTime = new Date().getTime();
  33394. _this2.Monitor.dclog({
  33395. url: _this2.url,
  33396. action: 224,
  33397. d: _this2.openStreamTime - _this2.gotWsUrlTime,
  33398. text: 'openStream',
  33399. isVersion2Available: isVersion2Available() ? 1 : 0
  33400. });
  33401. },
  33402. //xuehb 完成取流返回流头 5
  33403. getStreamHeaderCallback: function getStreamHeaderCallback() {
  33404. console.log("完成取流返回流头");
  33405. _this2.getStreamHeaderTime = new Date().getTime();
  33406. _this2.Monitor.dclog({
  33407. url: _this2.url,
  33408. action: 225,
  33409. d: _this2.getStreamHeaderTime - _this2.openStreamTime,
  33410. text: 'getStreamHeader',
  33411. isVersion2Available: isVersion2Available() ? 1 : 0
  33412. });
  33413. },
  33414. //xuehb 返回视频流 6
  33415. getVideoStreamCallback: function getVideoStreamCallback() {
  33416. console.log("返回视频流(首次)");
  33417. _this2.getVideoStreamTime = new Date().getTime();
  33418. _this2.Monitor.dclog({
  33419. url: _this2.url,
  33420. action: 226,
  33421. d: _this2.getVideoStreamTime - _this2.getStreamHeaderTime,
  33422. text: 'getVideoStream',
  33423. isVersion2Available: isVersion2Available() ? 1 : 0
  33424. });
  33425. },
  33426. //xuehb 出现首帧画面(播放成功) 7
  33427. appearFirstFrameCallback: function appearFirstFrameCallback() {
  33428. console.log("出现首帧画面(播放成功)");
  33429. _this2.appearFirstFrameTime = new Date().getTime();
  33430. _this2.Monitor.dclog({
  33431. url: _this2.url,
  33432. action: 227,
  33433. d: _this2.appearFirstFrameTime - _this2.getStreamHeaderTime,
  33434. text: 'appearFirstFrame',
  33435. isVersion2Available: isVersion2Available() ? 1 : 0
  33436. });
  33437. },
  33438. //xuehb 平均成功取流的出流耗时 8
  33439. averageStreamSuccessCallback: function averageStreamSuccessCallback() {
  33440. console.log("平均成功取流的出流耗时");
  33441. _this2.averageStreamSuccessTime = _this2.initSuccessTime - _this2.initTime + (_this2.gotWsUrlTime - _this2.startGetWsUrlTime) + (_this2.appearFirstFrameTime - _this2.openStreamTime);
  33442. _this2.Monitor.dclog({
  33443. url: _this2.url,
  33444. action: 228,
  33445. d: _this2.averageStreamSuccessTime,
  33446. text: 'averageStreamSuccess',
  33447. isVersion2Available: isVersion2Available() ? 1 : 0
  33448. });
  33449. }
  33450. };
  33451. _this2.env = {
  33452. domain: "https://open.ys7.com"
  33453. };
  33454. if (typeof params.env !== 'undefined') {
  33455. _this2.env = Object.assign(_this2.env, params.env);
  33456. }
  33457. if (typeof params.handleTalkSuccess !== 'undefined') {
  33458. _this2.handleTalkSuccess = params.handleTalkSuccess;
  33459. }
  33460. if (typeof params.handleTalkError !== 'undefined') {
  33461. _this2.handleTalkError = params.handleTalkError;
  33462. }
  33463. _this2.errorHander = new Code();
  33464. _this2.jSPlugin = jSPlugin;
  33465. // if (this.themeId) {
  33466. // this.Theme = new Theme(this, id);
  33467. // window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
  33468. // }
  33469. var checkTimer = setInterval(function () {
  33470. //轮询是否加载解码库成功
  33471. if (window.JSPlayerModuleLoaded) {
  33472. clearInterval(checkTimer);
  33473. if (typeof _this2.params.handleInitSuccess === 'function') {
  33474. _this2.params.handleInitSuccess({
  33475. retcode: 0,
  33476. id: _this2.params.id,
  33477. type: "handleInitSuccess"
  33478. });
  33479. }
  33480. resolve({
  33481. meta: {
  33482. retcode: 200,
  33483. msg: "初始化成功"
  33484. }
  33485. });
  33486. if (params.url.indexOf('rec') != -1) {
  33487. //传入rec播放地址时将主题切换至回放
  33488. _this2.Theme.changeTheme(_this2.isMobile ? "mobileRec" : "pcRec");
  33489. }
  33490. }
  33491. }, 50);
  33492. } else {
  33493. jSPlugin = new window.JSPluginV1({
  33494. szId: id,
  33495. iType: 2,
  33496. iWidth: width,
  33497. iHeight: height,
  33498. iMaxSplit: 1,
  33499. iCurrentSplit: 1,
  33500. szBasePath: "",
  33501. staticPath: _this2.staticPath,
  33502. oStyle: {
  33503. border: "none",
  33504. background: "#000000"
  33505. }
  33506. });
  33507. // 增加视频容器
  33508. //var pluginStatus = new Status(this, id);
  33509. _this2.pluginStatus.loadingStart(id);
  33510. _this2.pluginStatus.loadingSetText({
  33511. text: '初始化播放器完成'
  33512. });
  33513. jSPlugin.EventCallback = {
  33514. //xuehb 开启取流 4
  33515. openStreamCallback: function openStreamCallback() {
  33516. console.log("开启取流---v1");
  33517. _this2.openStreamTime = new Date().getTime();
  33518. _this2.Monitor.dclog({
  33519. url: _this2.url,
  33520. action: 224,
  33521. d: _this2.openStreamTime - _this2.gotWsUrlTime,
  33522. text: 'openStream',
  33523. isVersion2Available: isVersion2Available() ? 1 : 0
  33524. });
  33525. },
  33526. //xuehb 完成取流返回流头 5
  33527. getStreamHeaderCallback: function getStreamHeaderCallback() {
  33528. console.log("完成取流返回流头");
  33529. _this2.getStreamHeaderTime = new Date().getTime();
  33530. _this2.Monitor.dclog({
  33531. url: _this2.url,
  33532. action: 225,
  33533. d: _this2.getStreamHeaderTime - _this2.openStreamTime,
  33534. text: 'getStreamHeader',
  33535. isVersion2Available: isVersion2Available() ? 1 : 0
  33536. });
  33537. },
  33538. //xuehb 返回视频流 6
  33539. getVideoStreamCallback: function getVideoStreamCallback() {
  33540. console.log("返回视频流(首次)");
  33541. _this2.getVideoStreamTime = new Date().getTime();
  33542. _this2.Monitor.dclog({
  33543. url: _this2.url,
  33544. action: 226,
  33545. d: _this2.getVideoStreamTime - _this2.getStreamHeaderTime,
  33546. text: 'getVideoStream',
  33547. isVersion2Available: isVersion2Available() ? 1 : 0
  33548. });
  33549. },
  33550. //xuehb 出现首帧画面(播放成功) 7
  33551. appearFirstFrameCallback: function appearFirstFrameCallback() {
  33552. console.log("出现首帧画面(播放成功)");
  33553. _this2.appearFirstFrameTime = new Date().getTime();
  33554. _this2.Monitor.dclog({
  33555. url: _this2.url,
  33556. action: 227,
  33557. d: _this2.appearFirstFrameTime - _this2.getStreamHeaderTime,
  33558. text: 'appearFirstFrame',
  33559. isVersion2Available: isVersion2Available() ? 1 : 0
  33560. });
  33561. },
  33562. //xuehb 平均成功取流的出流耗时 8
  33563. averageStreamSuccessCallback: function averageStreamSuccessCallback() {
  33564. console.log("平均成功取流的出流耗时");
  33565. _this2.averageStreamSuccessTime = _this2.initSuccessTime - _this2.initTime + (_this2.gotWsUrlTime - _this2.startGetWsUrlTime) + (_this2.appearFirstFrameTime - _this2.openStreamTime);
  33566. _this2.Monitor.dclog({
  33567. url: _this2.url,
  33568. action: 228,
  33569. d: _this2.averageStreamSuccessTime,
  33570. text: 'averageStreamSuccess',
  33571. isVersion2Available: isVersion2Available() ? 1 : 0
  33572. });
  33573. },
  33574. loadEventHandler: function loadEventHandler() {},
  33575. zoomEventResponse: function zoomEventResponse( /*iMode, aPoint*/
  33576. ) {//电子放大回调
  33577. },
  33578. windowEventSelect: function windowEventSelect(iWndIndex) {//插件选中窗口回调
  33579. },
  33580. pluginErrorHandler: function pluginErrorHandler(iWndIndex, iErrorCode, oError) {
  33581. //插件错误回调
  33582. console.log(iWndIndex, iErrorCode, oError);
  33583. if (iErrorCode === 1003) {
  33584. console.log("断流");
  33585. _this2.Theme.setDecoderState({
  33586. play: false
  33587. });
  33588. _this2.pluginStatus.setPlayStatus({
  33589. play: false
  33590. });
  33591. if (!jSPlugin.bPlay) {
  33592. _this2.pluginStatus.loadingClear();
  33593. _this2.pluginStatus.loadingSetText({
  33594. text: "连接断开,请重试",
  33595. color: 'red'
  33596. });
  33597. }
  33598. if (typeof _this2.params.handleError === 'function') {
  33599. _this2.params.handleError({
  33600. msg: "连接断开,请重试",
  33601. retcode: 1003,
  33602. id: _this2.params.id,
  33603. type: "handleError"
  33604. });
  33605. }
  33606. } else {
  33607. //推流异常时展示响应提示
  33608. if (oError.errorCode != 1) {
  33609. var errorInfo = _this2.errorHander.matchErrorInfo(oError.errorCode);
  33610. var msg = '连接断开,请重试';
  33611. if (errorInfo && errorInfo.msg) {
  33612. msg = errorInfo.msg;
  33613. } else if (errorInfo && errorInfo.description) {
  33614. msg = errorInfo.description;
  33615. }
  33616. _this2.Theme.setDecoderState({
  33617. play: false
  33618. });
  33619. _this2.pluginStatus.setPlayStatus({
  33620. play: false
  33621. });
  33622. _this2.pluginStatus.loadingClear();
  33623. _this2.pluginStatus.loadingSetText({
  33624. text: msg,
  33625. color: 'red'
  33626. });
  33627. } else {
  33628. _this2.pluginStatus.loadingClear();
  33629. if (_this2.Theme) {
  33630. _this2.Theme.setDisabled(false);
  33631. }
  33632. }
  33633. }
  33634. },
  33635. windowEventOver: function windowEventOver(iWndIndex) {},
  33636. windowEventOut: function windowEventOut(iWndIndex) {},
  33637. windowEventUp: function windowEventUp(iWndIndex) {},
  33638. windowFullCcreenChange: function windowFullCcreenChange(bFull) {},
  33639. firstFrameDisplay: function firstFrameDisplay(iWndIndex, iWidth, iHeight) {
  33640. console.log(iWidth, iHeight);
  33641. jSPlugin.JS_SetCanFullScreen(false);
  33642. // this.pluginStatus.loadingClear();
  33643. },
  33644. performanceLack: function performanceLack() {},
  33645. mouseEvent: function mouseEvent(iMouseEventType, iMouseX, iMouseY) {}
  33646. };
  33647. _this2.env = {
  33648. domain: "https://open.ys7.com"
  33649. };
  33650. if (typeof params.env !== 'undefined') {
  33651. _this2.env = Object.assign(_this2.env, params.env);
  33652. }
  33653. if (typeof params.handleTalkSuccess !== 'undefined') {
  33654. _this2.handleTalkSuccess = params.handleTalkSuccess;
  33655. }
  33656. if (typeof params.handleTalkError !== 'undefined') {
  33657. _this2.handleTalkError = params.handleTalkError;
  33658. }
  33659. _this2.errorHander = new Code();
  33660. _this2.jSPlugin = jSPlugin;
  33661. // if (this.themeId) {
  33662. // this.Theme = new Theme(this, id);
  33663. // window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
  33664. // }
  33665. // 待需要改造plugin,异步判断;
  33666. if (typeof _this2.params.handleInitSuccess === 'function') {
  33667. _this2.params.handleInitSuccess({
  33668. retcode: 0,
  33669. id: _this2.params.id,
  33670. type: "handleInitSuccess"
  33671. });
  33672. }
  33673. resolve({
  33674. meta: {
  33675. retcode: 200,
  33676. msg: "初始化成功"
  33677. }
  33678. });
  33679. if (params.url.indexOf('rec') != -1) {
  33680. //传入rec播放地址时将主题切换至回放
  33681. _this2.Theme.changeTheme(_this2.isMobile ? "mobileRec" : "pcRec");
  33682. }
  33683. }
  33684. };
  33685. var initDecoderPromise = new Promise(initDecoder);
  33686. return initDecoderPromise;
  33687. }
  33688. }, {
  33689. key: "_getRealUrlPromise",
  33690. value: function _getRealUrlPromise(accessToken, url) {
  33691. var _this3 = this;
  33692. console.log("\u83B7\u53D6\u64AD\u653E\u5730\u5740 url => ".concat(url, " ").concat(this.accessToken));
  33693. console.log('开始获取wsurl');
  33694. //xuehb 开始获取wsurl
  33695. this.startGetWsUrlTime = new Date().getTime();
  33696. this.Monitor.dclog({
  33697. url: this.url,
  33698. action: 222,
  33699. text: 'startGetWsUrl',
  33700. isVersion2Available: isVersion2Available() ? 1 : 0
  33701. });
  33702. var apiDomain = this.env.domain;
  33703. if (this.env) {
  33704. apiDomain = this.env.domain;
  33705. }
  33706. var getRealUrlPromise = function getRealUrlPromise(resolve, reject) {
  33707. var realUrl = '';
  33708. var apiUrl = apiDomain + "/api/lapp/live/url/ezopen";
  33709. var data = new FormData();
  33710. data.append("ezopen", url);
  33711. data.append("isFlv", false);
  33712. data.append("userAgent", window.navigator.userAgent);
  33713. data.append("isHttp", false);
  33714. data.append("accessToken", accessToken);
  33715. fetch(apiUrl, {
  33716. method: "POST",
  33717. // headers: {
  33718. // 'Content-Type': 'application/json'
  33719. // },
  33720. body: data
  33721. }).then(function (response) {
  33722. return response.json();
  33723. }).then(function (data) {
  33724. if (data.code == 200 || data.retcode == 0) {
  33725. var playUrl = "";
  33726. var stream = "";
  33727. if (data.ext && data.ext.token) {
  33728. realUrl += data.data;
  33729. stream = data.ext.token;
  33730. playUrl = data.data;
  33731. } else if (data.data && data.data.token) {
  33732. realUrl += data.data.url;
  33733. stream = data.data.token;
  33734. playUrl = data.data.url;
  33735. }
  33736. var type = url.indexOf('live') !== -1 ? 'live' : 'playback';
  33737. if (type === 'live') {
  33738. realUrl = realUrl + '&ssn=' + stream + '&auth=1&biz=4&cln=100';
  33739. } else {
  33740. realUrl = realUrl + '&ssn=' + stream + '&auth=1&cln=100';
  33741. }
  33742. console.log(realUrl);
  33743. // 设置秘钥 - 如果地址中包含秘钥参数,播放前配置到JSPlugin对应实例中
  33744. var validateCode = getQueryString('checkCode', realUrl);
  33745. if (validateCode) {
  33746. if (typeof _this3.jSPlugin.decoderVersion !== 'undefined' && _this3.jSPlugin.decoderVersion === '2.0') {
  33747. _this3.validateCode = validateCode;
  33748. } else {
  33749. console.log("设置密钥", validateCode);
  33750. _this3.jSPlugin.JS_SetSecretKey(0, validateCode);
  33751. }
  33752. }
  33753. // 回放处理
  33754. if (realUrl.indexOf('playback') !== -1) {
  33755. var wsBegin = getQueryString('begin', playUrl) || getQueryString('begin', url);
  33756. var wsEnd = getQueryString('end', playUrl) || getQueryString('end', url);
  33757. // 兼容各种时间格式
  33758. if (!wsBegin) {
  33759. var defaultDate = new Date();
  33760. realUrl = realUrl + '&begin=' + defaultDate.Format('yyyyMMdd') + 'T000000Z';
  33761. } else {
  33762. realUrl = realUrl.replace('&begin=' + getQueryString('begin', playUrl), '&begin=' + formatRecTime(wsBegin, '000000'));
  33763. if (!getQueryString('begin', realUrl)) {
  33764. realUrl += '&begin=' + formatRecTime(wsBegin, '000000');
  33765. }
  33766. }
  33767. if (!wsEnd) {
  33768. realUrl = realUrl + '&end=' + formatRecTime(getQueryString('begin', realUrl).substr(0, 8), '235959');
  33769. } else {
  33770. realUrl = realUrl.replace('&end=' + getQueryString('end', playUrl), '&end=' + formatRecTime(wsEnd, '235959'));
  33771. if (!getQueryString('end', realUrl)) {
  33772. realUrl += '&end=' + formatRecTime(wsEnd, '235959');
  33773. }
  33774. }
  33775. // api错误处理
  33776. if (!getQueryString('stream', playUrl)) {
  33777. realUrl = realUrl.replace('stream', '&stream');
  33778. }
  33779. if (url.indexOf('.cloud') !== -1) {
  33780. var recAPISuccess = function recAPISuccess(data) {
  33781. if (data.code == 200) {
  33782. var recSliceArr = [];
  33783. if (data.data && data.data.files && data.data.files.length > 0) {
  33784. var dataArr = data.data.files;
  33785. var nextFileTime = new Date().getTime();
  33786. var isAll = data.data.isAll;
  33787. // mock
  33788. // var number = 0;
  33789. //isAll = false;
  33790. if (isAll) {
  33791. recSliceArr = recSliceArrFun(dataArr);
  33792. var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
  33793. realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
  33794. resolve(realUrl);
  33795. } else {
  33796. // 云存储回调事务
  33797. var recTransaction = function recTransaction() {
  33798. function recAPIV2Success(data) {
  33799. if (data.data && data.data.files && data.data.files.length > 0) {
  33800. //if(number < 2 ) {
  33801. if (data.data.isAll == false) {
  33802. if (data.data.files) {
  33803. dataArr = dataArr.concat(data.data.files);
  33804. }
  33805. nextFileTime = data.data.nextFileTime > 0 ? data.data.nextFileTime : new Date().getTime();
  33806. recTransaction();
  33807. } else {
  33808. recSliceArr = recSliceArrFun(dataArr);
  33809. var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
  33810. realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
  33811. resolve(realUrl);
  33812. }
  33813. // mock
  33814. //number = number + 1;
  33815. } else {
  33816. recSliceArr = recSliceArrFun(dataArr);
  33817. var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
  33818. realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
  33819. resolve(realUrl);
  33820. }
  33821. }
  33822. recSliceParams.startTime = nextFileTime;
  33823. request(recSliceUrl, 'POST', recSliceParams, '', recAPIV2Success);
  33824. };
  33825. recTransaction();
  33826. }
  33827. } else {
  33828. reject({
  33829. retcode: -1,
  33830. msg: "未找到录像片段"
  33831. });
  33832. }
  33833. } else {
  33834. reject({
  33835. retcode: -1,
  33836. msg: "未找到录像片段"
  33837. });
  33838. }
  33839. function recSliceArrFun(data) {
  33840. var downloadPathArr = [];
  33841. data.forEach(function (item, index) {
  33842. if (downloadPathArr.length == 0 || item.downloadPath !== downloadPathArr[downloadPathArr.length - 1].downloadPath) {
  33843. downloadPathArr.push({
  33844. downloadPath: item.downloadPath,
  33845. ownerId: item.ownerId,
  33846. iStorageVersion: item.iStorageVersion,
  33847. videoType: item.videoType,
  33848. iPlaySpeed: 0,
  33849. startTime: item.startTime,
  33850. endTime: item.endTime
  33851. });
  33852. } else {
  33853. downloadPathArr[downloadPathArr.length - 1].endTime = item.endTime;
  33854. }
  33855. });
  33856. return downloadPathArr;
  33857. }
  33858. };
  33859. //云存储回放
  33860. // 调用回放API接口获取回放片段 - start
  33861. var recBegin = reRormatRecTime(getQueryString('begin', realUrl));
  33862. var recEnd = reRormatRecTime(getQueryString('end', realUrl));
  33863. var deviceSerial = getQueryString('serial', realUrl);
  33864. var channelNo = getQueryString('chn', realUrl);
  33865. var recSliceUrl = apiDomain + "/api/lapp/video/by/time";
  33866. var recSliceParams = {
  33867. accessToken: _this3.accessToken,
  33868. recType: 1,
  33869. deviceSerial: deviceSerial,
  33870. channelNo: channelNo,
  33871. startTime: recBegin,
  33872. endTime: recEnd,
  33873. version: '2.0'
  33874. };
  33875. request(recSliceUrl, 'POST', recSliceParams, '', recAPISuccess);
  33876. } else {
  33877. // 本地回放
  33878. //alarm rec - start
  33879. if (url.indexOf('alarmId') !== -1) {
  33880. var _recAPISuccess = function _recAPISuccess(data) {
  33881. if (data.code == 200) {
  33882. var recSliceArr = [];
  33883. if (data.data) {
  33884. recSliceArr = recSliceArrFun([data.data]);
  33885. var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
  33886. realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '');
  33887. console.log("realUrl", realUrl, data.data.recType);
  33888. if (data.data.recType == 1) {
  33889. realUrl = realUrl.replace('/playback', '/cloudplayback');
  33890. } else {
  33891. realUrl = realUrl.replace('/cloudplayback', '/playback');
  33892. }
  33893. // _this.opt.sources[0] = realUrl;
  33894. resolve(realUrl);
  33895. // request(nodeUrl, 'GET', '', '', nodeSuccess, nodeError);
  33896. }
  33897. }
  33898. function recSliceArrFun(data) {
  33899. var downloadPathArr = [];
  33900. data.forEach(function (item, index) {
  33901. if (downloadPathArr.length == 0 || item.downloadPath !== downloadPathArr[downloadPathArr.length - 1].downloadPath) {
  33902. downloadPathArr.push({
  33903. downloadPath: item.downloadPath,
  33904. ownerId: item.ownerId,
  33905. iStorageVersion: item.iStorageVersion,
  33906. videoType: item.videoType,
  33907. iPlaySpeed: 0,
  33908. startTime: item.startTime,
  33909. endTime: item.endTime
  33910. });
  33911. } else {
  33912. downloadPathArr[downloadPathArr.length - 1].endTime = item.endTime;
  33913. }
  33914. });
  33915. console.log("downloadPathArr", downloadPathArr);
  33916. return downloadPathArr;
  33917. }
  33918. };
  33919. console.log("进入alarmId回放");
  33920. // 调用回放API接口获取回放片段 - start
  33921. var alarmId = getQueryString('alarmId', realUrl);
  33922. var recBegin = reRormatRecTime(getQueryString('begin', realUrl));
  33923. var recEnd = reRormatRecTime(getQueryString('end', realUrl));
  33924. var deviceSerial = getQueryString('serial', realUrl);
  33925. var channelNo = getQueryString('chn', realUrl);
  33926. var recSliceUrl = apiDomain + "/api/lapp/video/by/id";
  33927. var recSliceParams = {
  33928. accessToken: _this3.accessToken,
  33929. // recType: 1,
  33930. deviceSerial: deviceSerial,
  33931. channelNo: channelNo,
  33932. alarmId: alarmId
  33933. // startTime:recBegin,
  33934. // endTime:recEnd
  33935. };
  33936. request(recSliceUrl, 'POST', recSliceParams, '', _recAPISuccess);
  33937. } else {
  33938. // arlar rec - end
  33939. // request(nodeUrl, 'GET', '', '', nodeSuccess, nodeError);
  33940. resolve(realUrl);
  33941. }
  33942. }
  33943. } else {
  33944. resolve(realUrl);
  33945. }
  33946. } else {
  33947. if (_this3.Theme) {
  33948. _this3.Theme.setDisabled(true);
  33949. }
  33950. _this3.pluginStatus.loadingClear();
  33951. _this3.pluginStatus.loadingSetText({
  33952. text: data.msg,
  33953. color: 'red'
  33954. });
  33955. if (typeof _this3.params.handleError === 'function') {
  33956. _this3.params.handleError({
  33957. retcode: data.code,
  33958. msg: data.msg,
  33959. id: _this3.params.id,
  33960. type: "handleError"
  33961. });
  33962. }
  33963. reject(data);
  33964. }
  33965. // fetch real url end
  33966. });
  33967. };
  33968. return new Promise(function (resolve, reject) {
  33969. return getRealUrlPromise(resolve, reject);
  33970. });
  33971. // 格式化回放时间
  33972. function formatRecTime(time, defaultTime) {
  33973. // 用户格式 无需更改 => 20182626T000000Z
  33974. // return time
  33975. // 用户格式需要更改
  33976. //用户时间长度为 14 20181226000000 =》 20181226000000
  33977. // 用户长度为12 201812260000 =》 201812260000 + defaultTime后面2位
  33978. // 用户长度为10 2018122600 =》 201812260000 + defaultTime后面4位
  33979. // 用户长度为8 20181226 =》 201812260000 + defaultTime后面6位
  33980. // 结果 20181226000000 14位
  33981. // 插入 TZ
  33982. var reg = /^[0-9]{8}T[0-9]{6}Z$/;
  33983. if (reg.test(time)) {
  33984. // 用户格式 无需更改 => 20182626T000000Z
  33985. return time;
  33986. } else if (/[0-9]{8,14}/.test(time)) {
  33987. var start = 6 - (14 - time.length);
  33988. var end = defaultTime.length;
  33989. var standardTime = time + defaultTime.substring(start, end);
  33990. return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
  33991. }
  33992. throw new Error('回放时间格式有误,请确认');
  33993. }
  33994. function reRormatRecTime(time) {
  33995. var year = time.slice(0, 4);
  33996. var month = time.slice(4, 6);
  33997. var day = time.slice(6, 8);
  33998. var hour = time.slice(9, 11);
  33999. var minute = time.slice(11, 13);
  34000. var second = time.slice(13, 15);
  34001. var date = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  34002. // if (_this.opt.domain !== 'open') {
  34003. // return new Date(date.replace(/-/g, '/')).getTime() + (8 * 60 * 60 * 1000);
  34004. // }
  34005. return new Date(date.replace(/-/g, '/')).getTime();
  34006. }
  34007. }
  34008. }, {
  34009. key: "_pluginPlay",
  34010. value: function _pluginPlay(data, successCallback, errorCallback) {
  34011. var _this4 = this;
  34012. console.log("执行播放 _pluginPlay", data);
  34013. if (!data) {
  34014. return false;
  34015. }
  34016. function getPlayParams(url) {
  34017. var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
  34018. var websocketStreamingParam = (url.indexOf('/live') === -1 ? url.indexOf('cloudplayback') !== -1 ? '/cloudplayback?' : '/playback?' : '/live?') + url.split('?')[1];
  34019. if (websocketStreamingParam.indexOf('/playback') !== -1) {
  34020. websocketStreamingParam = websocketStreamingParam.replace("stream=2", 'stream=1');
  34021. }
  34022. // 本地回放仅支持主码流
  34023. return {
  34024. websocketConnectUrl: websocketConnectUrl,
  34025. websocketStreamingParam: websocketStreamingParam
  34026. };
  34027. }
  34028. var wsUrl = getPlayParams(data).websocketConnectUrl;
  34029. if (this.env && this.env.wsUrl) {
  34030. wsUrl = this.env.wsUrl;
  34031. }
  34032. //xuehb todo 完成获取URL 3
  34033. this.gotWsUrlTime = new Date().getTime();
  34034. this.Monitor.dclog({
  34035. url: this.url,
  34036. action: 223,
  34037. d: this.gotWsUrlTime - this.startGetWsUrlTime,
  34038. text: 'getWsUrlSuccess',
  34039. isVersion2Available: isVersion2Available() ? 1 : 0
  34040. });
  34041. var wsParams = {
  34042. playURL: getPlayParams(data).websocketStreamingParam
  34043. };
  34044. console.log('播放前 stop 阶段 结束');
  34045. this.isStoping = false;
  34046. var now = Date.now();
  34047. console.log('执行播放 ... this.jSPlugin.JS_Play at ', now);
  34048. this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(function () {
  34049. console.log("执行播放 ... this.jSPlugin.JS_Play 播放成功", wsUrl, wsParams);
  34050. console.log("执行播放耗时 ", Date.now() - now);
  34051. if (_this4.isStoping) {
  34052. console.log('现在在播放前 stop 阶段,此次应为无效播放成功触发。不执行后续回调, 此次耗时无效');
  34053. return;
  34054. }
  34055. if (_this4.validateCode && typeof _this4.jSPlugin.decoderVersion !== 'undefined' && _this4.jSPlugin.decoderVersion === '2.0') {
  34056. _this4.jSPlugin.JS_SetSecretKey(0, _this4.validateCode);
  34057. }
  34058. _this4.pluginStatus.loadingClear();
  34059. _this4.pluginStatus.setPlayStatus({
  34060. play: true,
  34061. loading: false
  34062. });
  34063. if (_this4.Theme) {
  34064. _this4.Theme.setDecoderState({
  34065. play: true
  34066. });
  34067. var isOpenSound = lodash.findIndex(_this4.Theme.themeData.footer.btnList, function (v) {
  34068. return v.iconId === 'sound' && v.isrender === 1 && v.defaultActive === 1;
  34069. }) > -1;
  34070. _this4.audio = isOpenSound;
  34071. }
  34072. if (_this4.audio) {
  34073. setTimeout(function () {
  34074. _this4.openSound();
  34075. }, 500);
  34076. }
  34077. if (typeof _this4.params.handleSuccess === 'function') {
  34078. _this4.params.handleSuccess({
  34079. retcode: 0,
  34080. id: _this4.params.id,
  34081. type: "handleSuccess"
  34082. });
  34083. }
  34084. successCallback(wsParams);
  34085. _this4.Monitor.dclog({
  34086. url: _this4.url,
  34087. action: 211,
  34088. d: new Date().getTime() - _this4.playStartTime,
  34089. text: 'startPlaySuccess'
  34090. });
  34091. _this4.Monitor.playLog({
  34092. Enc: _this4.url.indexOf("@") === -1 ? 0 : 1,
  34093. // 0 不加密 1 加密
  34094. PlTp: _this4.url.indexOf("back") === -1 ? 1 : 2,
  34095. // 1 直播 2 回放
  34096. Via: 2,
  34097. // 2 服务端取流
  34098. ErrCd: 0,
  34099. Cost: new Date().getTime() - _this4.playStartTime,
  34100. // 毫秒数
  34101. Serial: matchEzopenUrl(_this4.url).deviceSerial,
  34102. Channel: matchEzopenUrl(_this4.url).channelNo,
  34103. Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
  34104. });
  34105. }, function (err) {
  34106. console.log("err", err);
  34107. var msg = '播放失败,请检查设备及客户端网络';
  34108. var retcode = -1;
  34109. if (_this4.jSPlugin.bPlay) {
  34110. return false;
  34111. }
  34112. if (err && err.errorCode) {
  34113. var errorInfo = _this4.errorHander.matchErrorInfo(err.errorCode);
  34114. if (_this4.Theme) {
  34115. _this4.Theme.setDisabled(true);
  34116. }
  34117. if (errorInfo && errorInfo.msg) {
  34118. msg = errorInfo.msg;
  34119. } else if (errorInfo && errorInfo.description) {
  34120. msg = errorInfo.description;
  34121. } else {
  34122. msg = '播放失败,请检查设备及客户端网络';
  34123. }
  34124. retcode = err.errorCode;
  34125. }
  34126. _this4.pluginStatus.loadingClear();
  34127. _this4.pluginStatus.loadingSetText({
  34128. text: msg,
  34129. color: 'red'
  34130. });
  34131. if (typeof _this4.params.handleError === 'function') {
  34132. _this4.params.handleError({
  34133. retcode: retcode,
  34134. msg: msg,
  34135. id: _this4.params.id,
  34136. type: "handleError"
  34137. });
  34138. }
  34139. errorCallback();
  34140. _this4.Monitor.dclog({
  34141. url: _this4.url,
  34142. action: 411,
  34143. d: new Date().getTime() - _this4.playStartTime,
  34144. text: 'startPlayError'
  34145. });
  34146. _this4.Monitor.playLog({
  34147. Enc: _this4.url.indexOf("@") === -1 ? 0 : 1,
  34148. // 0 不加密 1 加密
  34149. PlTp: _this4.url.indexOf("back") === -1 ? 1 : 2,
  34150. // 1 直播 2 回放
  34151. Via: 2,
  34152. // 2 服务端取流
  34153. ErrCd: retcode,
  34154. Cost: -1,
  34155. // 毫秒数
  34156. Serial: matchEzopenUrl(_this4.url).deviceSerial,
  34157. Channel: matchEzopenUrl(_this4.url).channelNo,
  34158. Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
  34159. });
  34160. });
  34161. }
  34162. }, {
  34163. key: "_play",
  34164. value: function _play(options) {
  34165. var _this5 = this;
  34166. console.log("\u6267\u884C\u64AD\u653E play options.url =>", options);
  34167. this.pluginStatus.setPlayStatus({
  34168. play: false,
  34169. loading: true
  34170. });
  34171. this.playStartTime = new Date().getTime();
  34172. this.Monitor.dclog({
  34173. url: this.url,
  34174. action: 1,
  34175. d: new Date().getTime() - this.initTime,
  34176. text: 'startPlay'
  34177. });
  34178. if (options) {
  34179. if (typeof options === 'string') {
  34180. this.url = options;
  34181. }
  34182. if (typeof options.url === 'string') {
  34183. this.url = options.url;
  34184. }
  34185. if (typeof options.accessToken === 'string') {
  34186. this.accessToken = options.accessToken;
  34187. }
  34188. if (this.Theme && (typeof options.url === 'string' || typeof options.accessToken === 'string')) {
  34189. this.Theme.getDeviceInfo();
  34190. }
  34191. }
  34192. var promise = new Promise(function (resolve, reject) {
  34193. console.log('执行 播放前 stop');
  34194. _this5.isStoping = true;
  34195. _this5.jSPlugin.JS_Stop(0).then(function () {
  34196. console.log("\u64AD\u653E\u524D stop \u6267\u884C\u6210\u529F this.url => ".concat(_this5.url, " ").concat(_this5.accessToken));
  34197. _this5._getRealUrlPromise(_this5.accessToken, _this5.url).then(function (data) {
  34198. _this5._pluginPlay(data, function (params) {
  34199. // if (params.playURL.indexOf('playback') != -1) {
  34200. // //传入rec播放地址时将主题切换至回放
  34201. // this.Theme.changeTheme(this.isMobile ? "mobileRec" :"pcRec");
  34202. // }
  34203. resolve(true);
  34204. }, function () {
  34205. return reject(false);
  34206. });
  34207. })["catch"](function (err) {
  34208. var msg = err.msg ? err.msg : '播放失败,请检查设备及客户端网络';
  34209. if (_this5.Theme) {
  34210. _this5.Theme.setDisabled(true);
  34211. }
  34212. _this5.pluginStatus.loadingClear();
  34213. _this5.pluginStatus.loadingSetText({
  34214. text: msg,
  34215. color: 'red'
  34216. });
  34217. if (typeof _this5.params.handleError === 'function') {
  34218. _this5.params.handleError({
  34219. retcode: err.oError ? err.oError.errorCode : -1,
  34220. msg: msg,
  34221. id: _this5.params.id,
  34222. type: "handleError"
  34223. });
  34224. }
  34225. reject({
  34226. retcode: err.oError ? err.oError.errorCode : -1,
  34227. msg: msg,
  34228. id: _this5.params.id,
  34229. type: "handleError"
  34230. });
  34231. });
  34232. });
  34233. });
  34234. return promise;
  34235. }
  34236. }, {
  34237. key: "stop",
  34238. value: function stop() {
  34239. var _this6 = this;
  34240. this.pluginStatus.setPlayStatus({
  34241. loading: true
  34242. });
  34243. this.reSetTheme();
  34244. return this.jSPlugin.JS_Stop(0).then(function () {
  34245. console.log("停止成功");
  34246. _this6.pluginStatus.setPlayStatus({
  34247. play: false,
  34248. loading: false
  34249. });
  34250. if (_this6.Theme) {
  34251. _this6.Theme.setDecoderState({
  34252. play: false
  34253. });
  34254. }
  34255. });
  34256. }
  34257. }, {
  34258. key: "changeVideoLevel",
  34259. value: function changeVideoLevel(level) {
  34260. var _this7 = this;
  34261. var initUrl = this.url;
  34262. var url = level ? initUrl.replace(".live", ".hd.live") : initUrl.replace(".hd.live", ".live");
  34263. this.jSPlugin.playURL = level ? this.jSPlugin.playURL.replace("stream=2", "stream=1") : this.jSPlugin.playURL.replace("stream=1", "stream=2");
  34264. console.log("changeVideoLevel", url, this.jSPlugin.playURL);
  34265. this.url = url;
  34266. var promise = new Promise(function (resolve, reject) {
  34267. _this7.pause().then(function () {
  34268. console.log("暂停成功");
  34269. _this7.resume().then(function (data) {
  34270. console.log("恢复成功");
  34271. });
  34272. })["catch"](function () {
  34273. console.log("暂停失败");
  34274. _this7.resume().then(function (data) {
  34275. console.log("恢复成功");
  34276. });
  34277. });
  34278. });
  34279. return promise;
  34280. }
  34281. }, {
  34282. key: "reSetTheme",
  34283. value: function reSetTheme() {
  34284. // 云台初始化
  34285. if (this.Theme && this.Theme.Ptz) {
  34286. this.Theme.setDecoderState({
  34287. pantile: false
  34288. });
  34289. this.Theme.Ptz.hide();
  34290. }
  34291. // 录制初始化
  34292. if (this.Theme) {
  34293. if (this.Theme.decoderState.state.recordvideo) {
  34294. this.Theme.setDecoderState({
  34295. recordvideo: false
  34296. });
  34297. }
  34298. }
  34299. // 电子放大初始化
  34300. if (this.Theme && this.Theme.decoderState.state.zoom) {
  34301. this.Zoom.stopZoom();
  34302. this.Theme.setDecoderState({
  34303. zoom: false
  34304. });
  34305. }
  34306. // 对讲初始化
  34307. if (this.Theme && this.Theme.decoderState.state.talk) {
  34308. this.stopTalk();
  34309. this.Theme.setDecoderState({
  34310. talk: false
  34311. });
  34312. }
  34313. // 回放日期选择
  34314. if (this.Theme && this.Theme.Rec && !this.Theme.isMobile) {
  34315. this.Theme.Rec.datepickerHide();
  34316. }
  34317. // 回放倍速
  34318. if (this.Theme && this.Theme.Rec) {
  34319. this.Theme.changeRecSpeed(1);
  34320. this.Theme.nextRate = 1;
  34321. this.speed = 1;
  34322. this.Theme.setDecoderState({
  34323. speed: false
  34324. });
  34325. }
  34326. }
  34327. //xuehb 添加回调
  34328. }, {
  34329. key: "_changePlayUrl",
  34330. value: function _changePlayUrl(options) {
  34331. var _this8 = this;
  34332. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  34333. console.log('_changePlayUrl');
  34334. console.log(options);
  34335. this.reSetTheme();
  34336. this.getDeviceCapacity({
  34337. accessToken: options.accessToken,
  34338. deviceSerial: options.deviceSerial
  34339. });
  34340. var initUrl = this.url;
  34341. var url = matchUrl(initUrl, options);
  34342. if (options.accessToken) {
  34343. this.accessToken = options.accessToken;
  34344. }
  34345. this.url = url;
  34346. //xuehb
  34347. callback();
  34348. this.pluginStatus.loadingStart(this.id);
  34349. this.pluginStatus.loadingSetText({
  34350. text: '加载中,请稍后'
  34351. });
  34352. var promise = new Promise(function (resolve, reject) {
  34353. var changePlayUrlParams = {
  34354. url: url
  34355. };
  34356. if (options.accessToken) {
  34357. changePlayUrlParams["accessToken"] = options.accessToken;
  34358. }
  34359. console.log("切换播放地址 参数 ", changePlayUrlParams);
  34360. return _this8.play(changePlayUrlParams).then(function () {
  34361. console.log("切换播放地址 play 执行成功 ", _this8.url, _this8.accessToken);
  34362. // 当前处于网页全屏状态
  34363. if (_this8.Theme && _this8.Theme.decoderState.state.webExpend) {
  34364. _this8.Theme.webExpend();
  34365. }
  34366. // 当前处于全屏状态
  34367. if (_this8.Theme && _this8.Theme.decoderState.state.expend) {
  34368. _this8.Theme.expend();
  34369. }
  34370. if (options.type) {
  34371. if (options.type == 'rec' || options.type == 'cloud.rec') {
  34372. _this8.Theme.changeTheme(_this8.isMobile ? "mobileRec" : "pcRec");
  34373. } else {
  34374. _this8.Theme.changeTheme(_this8.isMobile ? "mobileLive" : "pcLive");
  34375. }
  34376. } else {
  34377. if (_this8.url.indexOf('.rec') > -1) {
  34378. _this8.Theme.changeTheme(_this8.isMobile ? "mobileRec" : "pcRec");
  34379. } else {
  34380. _this8.Theme.changeTheme(_this8.isMobile ? "mobileLive" : "pcLive");
  34381. }
  34382. }
  34383. if (options && options.begin && options.deviceSerial) {
  34384. _this8.Theme.Rec.setDatepickerDate(options.begin);
  34385. }
  34386. _this8.Theme.setDisabled(false);
  34387. resolve(url);
  34388. })["catch"](function (err) {
  34389. reject(url);
  34390. if (err && err.msg) {
  34391. if (_this8.Theme) {
  34392. _this8.Theme.setDisabled(true);
  34393. }
  34394. _this8.pluginStatus.loadingClear();
  34395. _this8.pluginStatus.loadingSetText({
  34396. text: err.msg,
  34397. color: 'red'
  34398. });
  34399. }
  34400. });
  34401. });
  34402. /**
  34403. * 匹配播放地址 用户播放地址切换
  34404. * options
  34405. * type | string | live,rec
  34406. * hd | boolean | true,false
  34407. * deviceSerial
  34408. * channelNO
  34409. * begin
  34410. * end
  34411. */
  34412. function matchUrl(matchInitUrl, matchOptions) {
  34413. if (matchOptions.url) {
  34414. return matchOptions.url;
  34415. }
  34416. console.log('--------------matchInitUrl', matchInitUrl);
  34417. var type = matchInitUrl.split("/")[4].split(".")[matchInitUrl.split("/")[4].split(".").length - 1].split("?")[0];
  34418. if (type === 'rec' && matchInitUrl.indexOf(".cloud.rec") !== -1) {
  34419. type = 'cloud.rec';
  34420. }
  34421. if (matchOptions.type) {
  34422. type = matchOptions.type;
  34423. }
  34424. var deviceSerial = matchInitUrl.split("/")[3];
  34425. if (matchOptions.deviceSerial) {
  34426. deviceSerial = matchOptions.deviceSerial;
  34427. }
  34428. var channelNo = matchInitUrl.split("/")[4].split(".")[0];
  34429. if (matchOptions.channelNo) {
  34430. channelNo = matchOptions.channelNo;
  34431. }
  34432. // 如果切换设备,之前设备有验证码,新设备无验证码,建议传空验证码,清理验证码(降低解码消耗)
  34433. var validCode = matchInitUrl.split("/")[2].split("@").length === 2 ? matchInitUrl.split("/")[2].split("@")[0] : "";
  34434. if (typeof matchOptions.validCode !== 'undefined') {
  34435. validCode = matchOptions.validCode;
  34436. }
  34437. var hd = typeof matchOptions.hd === 'undefined' ? matchInitUrl.indexOf('.hd') !== -1 : matchOptions.hd;
  34438. var result = "ezopen://".concat(validCode ? "".concat(validCode, "@") : "", "open.ys7.com/").concat(deviceSerial, "/").concat(channelNo).concat(hd ? '.hd' : '', ".").concat(type);
  34439. if (type === 'live') {
  34440. return result;
  34441. }
  34442. result = "ezopen://".concat(validCode ? "".concat(validCode, "@") : "", "open.ys7.com/").concat(deviceSerial, "/").concat(channelNo, ".").concat(type);
  34443. if (matchOptions.begin && matchOptions.end) {
  34444. result += "?begin=".concat(matchOptions.begin, "&end=").concat(matchOptions.end);
  34445. } else if (matchOptions.begin) {
  34446. result += "?begin=".concat(matchOptions.begin);
  34447. } else if (getQueryString("begin", matchInitUrl)) {
  34448. result += "?begin=".concat(getQueryString("begin", matchInitUrl));
  34449. }
  34450. return result;
  34451. }
  34452. return promise;
  34453. }
  34454. }, {
  34455. key: "getOSDTime",
  34456. value: function getOSDTime() {
  34457. var _this9 = this;
  34458. var promise = new Promise(function (resolve, reject) {
  34459. _this9.jSPlugin.JS_GetOSDTime(0).then(function (data) {
  34460. resolve({
  34461. code: 0,
  34462. retcode: 0,
  34463. data: data
  34464. });
  34465. // 兼容旧版本callback
  34466. if (typeof _this9.params.getOSDTimeCallBack === 'function') {
  34467. _this9.params.getOSDTimeCallBack({
  34468. id: _this9.id,
  34469. type: 'getOSDTime',
  34470. code: 0,
  34471. data: data
  34472. });
  34473. }
  34474. })["catch"](function (err) {
  34475. reject({
  34476. code: -1,
  34477. retcode: -1,
  34478. data: err
  34479. });
  34480. // 兼容旧版本callback
  34481. if (typeof _this9.params.getOSDTimeCallBack === 'function') {
  34482. _this9.params.getOSDTimeCallBack({
  34483. id: _this9.id,
  34484. type: 'getOSDTime',
  34485. code: -1,
  34486. data: -1
  34487. });
  34488. }
  34489. });
  34490. });
  34491. return promise;
  34492. }
  34493. }, {
  34494. key: "capturePicture",
  34495. value: function capturePicture(name) {
  34496. var _this10 = this;
  34497. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34498. var capturePictureRT = this.jSPlugin.JS_CapturePicture(0, name, "JPEG", callback, !!callback);
  34499. if (isPromise(capturePictureRT)) {
  34500. // 兼容旧版本callback
  34501. if (typeof this.params.capturePictureCallBack === 'function') {
  34502. capturePictureRT.then(function () {
  34503. _this10.params.capturePictureCallBack({
  34504. id: _this10.id,
  34505. type: 'capturePicture',
  34506. code: 0
  34507. });
  34508. })["catch"](function () {
  34509. _this10.params.capturePictureCallBack({
  34510. id: _this10.id,
  34511. type: 'capturePicture',
  34512. code: -1
  34513. });
  34514. });
  34515. }
  34516. return capturePictureRT;
  34517. }
  34518. return new Promise(function (resolve) {
  34519. resolve(capturePictureRT);
  34520. });
  34521. }
  34522. }, {
  34523. key: "startSave",
  34524. value: function startSave(name) {
  34525. var _this11 = this;
  34526. var startSaveRT = this.jSPlugin.JS_StartSave(0, name);
  34527. if (isPromise(startSaveRT)) {
  34528. // 兼容旧版本callback
  34529. if (typeof this.params.startSaveCallBack === 'function') {
  34530. startSaveRT.then(function () {
  34531. _this11.params.startSaveCallBack({
  34532. id: _this11.id,
  34533. type: 'startSave',
  34534. code: 0
  34535. });
  34536. })["catch"](function () {
  34537. _this11.params.startSaveCallBack({
  34538. id: _this11.id,
  34539. type: 'startSave',
  34540. code: -1
  34541. });
  34542. });
  34543. }
  34544. return startSaveRT;
  34545. }
  34546. if (this.Theme) {
  34547. this.Theme.setDecoderState({
  34548. recordvideo: true
  34549. });
  34550. }
  34551. return new Promise(function (resolve) {
  34552. resolve(startSaveRT);
  34553. });
  34554. }
  34555. }, {
  34556. key: "stopSave",
  34557. value: function stopSave() {
  34558. var _this12 = this;
  34559. var stopSaveRT = this.jSPlugin.JS_StopSave(0);
  34560. if (isPromise(stopSaveRT)) {
  34561. // 兼容旧版本callback
  34562. if (typeof this.params.startSaveCallBack === 'function') {
  34563. stopSaveRT.then(function () {
  34564. _this12.params.stopSaveCallBack({
  34565. id: _this12.id,
  34566. type: 'stopSave',
  34567. code: 0
  34568. });
  34569. })["catch"](function () {
  34570. _this12.params.stopSaveCallBack({
  34571. id: _this12.id,
  34572. type: 'stopSave',
  34573. code: -1
  34574. });
  34575. });
  34576. }
  34577. return stopSaveRT;
  34578. }
  34579. if (this.Theme) {
  34580. this.Theme.setDecoderState({
  34581. recordvideo: false
  34582. });
  34583. }
  34584. return new Promise(function (resolve) {
  34585. resolve(stopSaveRT);
  34586. });
  34587. }
  34588. }, {
  34589. key: "openSound",
  34590. value: function openSound() {
  34591. var openSoundRT = this.jSPlugin.JS_OpenSound(0);
  34592. console.log("打开声音", openSoundRT);
  34593. if (isPromise(openSoundRT)) {
  34594. return openSoundRT;
  34595. }
  34596. if (this.Theme) {
  34597. this.Theme.setDecoderState({
  34598. sound: true
  34599. });
  34600. }
  34601. // 兼容旧版本callback
  34602. if (typeof this.params.openSoundCallBack === 'function') {
  34603. this.params.openSoundCallBack({
  34604. id: this.id,
  34605. type: 'openSound',
  34606. code: openSoundRT
  34607. });
  34608. }
  34609. return new Promise(function (resolve) {
  34610. resolve(openSoundRT);
  34611. });
  34612. }
  34613. }, {
  34614. key: "closeSound",
  34615. value: function closeSound() {
  34616. var closeSoundRT = this.jSPlugin.JS_CloseSound(0);
  34617. if (isPromise(closeSoundRT)) {
  34618. return closeSoundRT;
  34619. }
  34620. if (this.Theme) {
  34621. this.Theme.setDecoderState({
  34622. sound: false
  34623. });
  34624. }
  34625. // 兼容旧版本callback
  34626. if (typeof this.params.closeSoundCallBack === 'function') {
  34627. this.params.closeSoundCallBack({
  34628. id: this.id,
  34629. type: 'closeSound',
  34630. code: closeSoundRT
  34631. });
  34632. }
  34633. return new Promise(function (resolve) {
  34634. resolve(closeSoundRT);
  34635. });
  34636. }
  34637. }, {
  34638. key: "enableZoom",
  34639. value: function enableZoom() {
  34640. var enableZoomRT = this.jSPlugin.JS_EnableZoom(0);
  34641. if (isPromise(enableZoomRT)) {
  34642. return enableZoomRT;
  34643. }
  34644. return new Promise(function (resolve) {
  34645. resolve(enableZoomRT);
  34646. });
  34647. }
  34648. }, {
  34649. key: "closeZoom",
  34650. value: function closeZoom() {
  34651. var closeZoomRT = this.jSPlugin.JS_DisableZoom(0);
  34652. if (isPromise(closeZoomRT)) {
  34653. return closeZoomRT;
  34654. }
  34655. return new Promise(function (resolve) {
  34656. resolve(closeZoomRT);
  34657. });
  34658. }
  34659. }, {
  34660. key: "setPoster",
  34661. value: function setPoster(url) {
  34662. // this.pluginStatus.setPoster(url);
  34663. if (isVersion2Available()) {
  34664. if (document.getElementById("".concat(this.id))) {
  34665. document.getElementById("".concat(this.id)).style.backgroundImage = "url(".concat(url, ")");
  34666. document.getElementById("".concat(this.id)).style.backgroundSize = "100% 100%";
  34667. }
  34668. } else {
  34669. if (document.getElementById("".concat(this.id, "canvas0"))) {
  34670. document.getElementById("".concat(this.id, "canvas0")).style.backgroundImage = "url(".concat(url, ")");
  34671. document.getElementById("".concat(this.id, "canvas0")).style.backgroundSize = "cover";
  34672. }
  34673. }
  34674. }
  34675. }, {
  34676. key: "reSize",
  34677. value: function reSize(width, height) {
  34678. var headerHeight = 0;
  34679. var timeLineHeight = 0;
  34680. this.params.height = height;
  34681. this.params.width = width;
  34682. //总体高度包含模板
  34683. if (this.Theme && this.Theme.isNeedRenderHeader && document.getElementById("".concat(this.id, "-headControl"))) {
  34684. headerHeight = parseInt(document.getElementById("".concat(this.id, "-headControl")).style.height, 10);
  34685. }
  34686. if (this.Theme && this.Theme.isNeedRenderTimeLine && !this.isMobile) {
  34687. timeLineHeight = 48;
  34688. }
  34689. height = height - headerHeight - timeLineHeight;
  34690. this.width = width;
  34691. this.height = height;
  34692. document.getElementById("".concat(this.id, "-wrap")).style = "width:".concat(width, "px;position:relative;display:inline-block;vertical-align: bottom;");
  34693. document.getElementById("".concat(this.id)).style.width = width + 'px';
  34694. document.getElementById("".concat(this.id)).style.height = height + 'px';
  34695. if (this.jSPlugin && this.jSPlugin.bPlay) {
  34696. if (this.jSPlugin) {
  34697. this.jSPlugin.iHeight = height;
  34698. this.jSPlugin.iWidth = width;
  34699. }
  34700. this.jSPlugin.JS_Resize(width, height);
  34701. } else {
  34702. if (document.getElementById("".concat(this.id, "-player"))) {
  34703. document.getElementById("".concat(this.id, "-player")).width = width;
  34704. document.getElementById("".concat(this.id, "-player")).height = height;
  34705. document.getElementById("".concat(this.id, "-player")).style.width = width + "px";
  34706. document.getElementById("".concat(this.id, "-player")).style.height = height + "px";
  34707. }
  34708. var scale = 1;
  34709. if (document.getElementById("".concat(this.id, "canvas0"))) {
  34710. var isNeedScale = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
  34711. if (isNeedScale) {
  34712. scale = 2;
  34713. }
  34714. document.getElementById("".concat(this.id, "canvas0")).style.width = width * scale + "px";
  34715. document.getElementById("".concat(this.id, "canvas0")).style.height = height * scale + "px";
  34716. document.getElementById("".concat(this.id, "canvas0")).width = width * scale;
  34717. document.getElementById("".concat(this.id, "canvas0")).height = height * scale;
  34718. document.getElementById("".concat(this.id, "canvas0")).parentNode.style.width = width * scale + "px";
  34719. document.getElementById("".concat(this.id, "canvas0")).parentNode.style.height = height * scale + "px";
  34720. document.getElementById("".concat(this.id, "canvas_draw0")).height = height * scale;
  34721. }
  34722. if (this.jSPlugin) {
  34723. this.jSPlugin.iHeight = height * scale;
  34724. this.jSPlugin.iWidth = width * scale;
  34725. }
  34726. }
  34727. }
  34728. }, {
  34729. key: "fast",
  34730. value: function fast(next) {
  34731. var _this13 = this;
  34732. var speed = this.speed;
  34733. if (next) {
  34734. var fastRT = this.jSPlugin.JS_Fast(0, next);
  34735. } else {
  34736. if (speed === 1) {
  34737. speed = 2;
  34738. } else if (speed === 2) {
  34739. speed = 4;
  34740. } else {
  34741. if (typeof this.params.handleError === 'function') {
  34742. this.params.handleError({
  34743. msg: "播放速度最大为4倍速度",
  34744. retcode: 1003,
  34745. id: this.id,
  34746. type: "handleError"
  34747. });
  34748. }
  34749. return new Promise(function (resolve, reject) {
  34750. _this13.speed = speed;
  34751. reject({
  34752. code: -1,
  34753. data: {
  34754. speed: speed,
  34755. result: "播放速度最大为4倍速度"
  34756. }
  34757. });
  34758. });
  34759. }
  34760. var fastRT = this.jSPlugin.JS_Fast(0);
  34761. }
  34762. return new Promise(function (resolve) {
  34763. _this13.speed = speed;
  34764. resolve({
  34765. code: 0,
  34766. data: {
  34767. speed: speed,
  34768. result: fastRT
  34769. }
  34770. });
  34771. });
  34772. }
  34773. }, {
  34774. key: "slow",
  34775. value: function slow() {
  34776. var _this14 = this;
  34777. var speed = this.speed;
  34778. if (speed === 4) {
  34779. speed = 2;
  34780. } else if (speed === 2) {
  34781. speed = 1;
  34782. } else {
  34783. if (typeof this.params.handleError === 'function') {
  34784. this.params.handleError({
  34785. msg: "播放速度最小为1倍速度",
  34786. retcode: 1003,
  34787. id: this.id,
  34788. type: "handleError"
  34789. });
  34790. }
  34791. return new Promise(function (resolve, reject) {
  34792. _this14.speed = speed;
  34793. reject({
  34794. code: -1,
  34795. data: {
  34796. speed: speed,
  34797. result: "播放速度最小为1倍速度"
  34798. }
  34799. });
  34800. });
  34801. }
  34802. var slowRT = this.jSPlugin.JS_Slow(0);
  34803. return new Promise(function (resolve) {
  34804. _this14.speed = speed;
  34805. resolve({
  34806. code: 0,
  34807. data: {
  34808. speed: speed,
  34809. result: slowRT
  34810. }
  34811. });
  34812. });
  34813. }
  34814. }, {
  34815. key: "seek",
  34816. value: function seek(startTime, endTime) {
  34817. var url = this.url;
  34818. var currentDay = (getQueryString('begin', url) || new Date().Format('yyyyMMdd')).substr(0, 8);
  34819. endTime = formatRecTime(currentDay, '235959');
  34820. if (startTime.length === 6) {
  34821. startTime = formatRecTime(currentDay, startTime);
  34822. } else if (startTime.length === 16) {
  34823. if (startTime.substr(0, 8) !== currentDay) {
  34824. if (typeof this.params.handleError === 'function') {
  34825. this.params.handleError({
  34826. msg: "seek时间不能跨日期",
  34827. retcode: -1,
  34828. id: this.id,
  34829. type: "handleError"
  34830. });
  34831. }
  34832. return false;
  34833. }
  34834. } else {
  34835. if (typeof this.params.handleError === 'function') {
  34836. this.params.handleError({
  34837. msg: "seek时间格式错误",
  34838. retcode: -1,
  34839. id: this.id,
  34840. type: "handleError"
  34841. });
  34842. }
  34843. return false;
  34844. }
  34845. // 格式化回放时间
  34846. function formatRecTime(time, defaultTime) {
  34847. // 用户格式 无需更改 => 20182626T000000Z
  34848. // return time
  34849. // 用户格式需要更改
  34850. //用户时间长度为 14 20181226000000 =》 20181226000000
  34851. // 用户长度为12 201812260000 =》 201812260000 + defaultTime后面2位
  34852. // 用户长度为10 2018122600 =》 201812260000 + defaultTime后面4位
  34853. // 用户长度为8 20181226 =》 201812260000 + defaultTime后面6位
  34854. // 结果 20181226000000 14位
  34855. // 插入 TZ
  34856. var reg = /^[0-9]{8}T[0-9]{6}Z$/;
  34857. if (reg.test(time)) {
  34858. // 用户格式 无需更改 => 20182626T000000Z
  34859. return time;
  34860. } else if (/[0-9]{8,14}/.test(time)) {
  34861. var start = 6 - (14 - time.length);
  34862. var end = defaultTime.length;
  34863. var standardTime = time + defaultTime.substring(start, end);
  34864. return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
  34865. }
  34866. throw new Error('回放时间格式有误,请确认');
  34867. }
  34868. var seekRT = this.jSPlugin.JS_Seek(0, startTime, endTime);
  34869. console.log("seekRT", seekRT);
  34870. if (isPromise(seekRT)) {
  34871. return seekRT;
  34872. }
  34873. return new Promise(function (resolve) {
  34874. resolve(seekRT);
  34875. });
  34876. }
  34877. }, {
  34878. key: "fullScreen",
  34879. value: function fullScreen() {
  34880. var _this15 = this;
  34881. var promise = requestFullScreenPromise(document.getElementById("".concat(this.id)));
  34882. promise.then(function (data) {
  34883. console.log("全屏promise", window.screen.availWidth);
  34884. _this15.jSPlugin.JS_Resize(window.screen.availWidth, window.screen.availHeight);
  34885. // 兼容旧版本callback
  34886. if (typeof _this15.params.fullScreenCallBack === 'function') {
  34887. _this15.params.fullScreenCallBack({
  34888. id: _this15.id,
  34889. type: 'fullScreen',
  34890. code: 0
  34891. });
  34892. }
  34893. });
  34894. // 监听全屏事件触发
  34895. var fullscreenchange = function fullscreenchange() {
  34896. var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
  34897. if (!isFullScreen) {
  34898. _this15.jSPlugin.JS_Resize(_this15.width, _this15.height);
  34899. }
  34900. // 兼容旧版本callback
  34901. if (typeof _this15.params.fullScreenChangeCallBack === 'function') {
  34902. _this15.params.fullScreenChangeCallBack({
  34903. id: _this15.id,
  34904. type: 'fullScreen',
  34905. code: isFullScreen
  34906. });
  34907. }
  34908. };
  34909. ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
  34910. window.addEventListener(item, function (data) {
  34911. return fullscreenchange();
  34912. });
  34913. });
  34914. }
  34915. }, {
  34916. key: "cancelFullScreen",
  34917. value: function cancelFullScreen() {
  34918. var _this16 = this;
  34919. var cancelPromise = cancelFullScreenPromise();
  34920. cancelPromise.then(function (data) {
  34921. console.log("取消全屏", data, _this16.jSPlugin);
  34922. _this16.jSPlugin.JS_Resize(_this16.width, _this16.height);
  34923. });
  34924. }
  34925. }, {
  34926. key: "startTalk",
  34927. value: function startTalk() {
  34928. this.Talk.startTalk();
  34929. }
  34930. }, {
  34931. key: "stopTalk",
  34932. value: function stopTalk() {
  34933. this.Talk.stopTalk();
  34934. }
  34935. }, {
  34936. key: "destroy",
  34937. value: function destroy() {
  34938. var destroyRT = this.jSPlugin.JS_DestroyWorker(0);
  34939. if (this.Theme) {
  34940. this.Theme = null;
  34941. window.EZUIKit[this.params.id].state.EZUIKitPlayer.themeInit = false;
  34942. }
  34943. if (isPromise(destroyRT)) {
  34944. return destroyRT;
  34945. }
  34946. return new Promise(function (resolve) {
  34947. resolve(destroyRT);
  34948. });
  34949. }
  34950. }, {
  34951. key: "getDeviceCapacity",
  34952. value: function getDeviceCapacity(params) {
  34953. var _this17 = this;
  34954. var apiDomain = this.env.domain;
  34955. if (this.env) {
  34956. apiDomain = this.env.domain;
  34957. }
  34958. var capacityUrl = apiDomain + "/api/lapp/device/capacity";
  34959. var capacitySuccess = function capacitySuccess(data) {
  34960. if (data.code == 200 && data.data) {
  34961. _this17.capacity = data.data;
  34962. }
  34963. };
  34964. var capacityParams = params || {
  34965. accessToken: this.accessToken,
  34966. deviceSerial: matchEzopenUrl(this.url).deviceSerial
  34967. };
  34968. request(capacityUrl, 'POST', capacityParams, '', capacitySuccess);
  34969. }
  34970. // pause() {
  34971. // return this.jSPlugin.JS_Pause(0);
  34972. // }
  34973. // resume(time) {
  34974. // return this.jSPlugin.JS_Resume(time);
  34975. // }
  34976. }, {
  34977. key: "pause",
  34978. value: function pause() {
  34979. var _this18 = this;
  34980. // return this.jSPlugin.JS_Pause(0);
  34981. // this.reSetTheme();
  34982. return new Promise(function (resolve, reject) {
  34983. // 兼容单线程未关闭声音无法再次开启声音问题
  34984. _this18.jSPlugin.JS_CloseSound(0);
  34985. _this18.jSPlugin.JS_Pause(0, function (data) {
  34986. _this18.setPoster(data.base64);
  34987. }).then(function (data) {
  34988. // 暂停成功
  34989. if (_this18.Theme) {
  34990. _this18.Theme.setDecoderState({
  34991. play: false
  34992. });
  34993. }
  34994. resolve();
  34995. })["catch"](function (err) {
  34996. // 暂停失败
  34997. console.log(err);
  34998. reject(err);
  34999. });
  35000. });
  35001. }
  35002. }, {
  35003. key: "_resume",
  35004. value: function _resume(time) {
  35005. var _this19 = this;
  35006. return new Promise(function (resolve, reject) {
  35007. _this19.pluginStatus.setPlayStatus({
  35008. play: false,
  35009. loading: true
  35010. });
  35011. _this19.jSPlugin.JS_Resume(time).then(function (data) {
  35012. setTimeout(function () {
  35013. // 暂停恢复后,保持倍速
  35014. if (_this19.url.indexOf(".rec") !== -1 && _this19.speed != 1) {
  35015. _this19.jSPlugin.JS_Speed(_this19.speed);
  35016. }
  35017. }, 500);
  35018. // 主题播放状态及声音状态
  35019. if (_this19.Theme) {
  35020. _this19.Theme.setDecoderState({
  35021. play: true,
  35022. speed: _this19.speed
  35023. });
  35024. var isOpenSound = _this19.Theme.decoderState.state.sound;
  35025. if (isOpenSound) {
  35026. setTimeout(function () {
  35027. _this19.openSound();
  35028. }, 500);
  35029. }
  35030. }
  35031. resolve(data);
  35032. })["catch"](function (err) {
  35033. console.log("resume err", err);
  35034. reject(err);
  35035. });
  35036. });
  35037. // return this.jSPlugin.JS_Resume(time);
  35038. }
  35039. }]);
  35040. return EZUIKitPlayer;
  35041. }();
  35042. var oWebControl = null;
  35043. // var accessToken = '';
  35044. /**
  35045. * video 初始化及配置
  35046. * @param {*video挂载的dom id} id
  35047. * @param {*连接成功的回调} cbConnectSuccess
  35048. * @param {*连接报错的回调} cbConnectError
  35049. * @param {*连接关闭的回调} cbConnectClose
  35050. */
  35051. function WebControlInit(id, cbConnectSuccess, cbConnectError, cbConnectClose) {
  35052. return new WebControl({
  35053. szPluginContainer: id,
  35054. iServicePortStart: 14510,
  35055. // 对应 LocalServiceConfig.xml 中的ServicePortStart值
  35056. iServicePortEnd: 14519,
  35057. // 对应 LocalServiceConfig.xml 中的ServicePortEnd值
  35058. cbConnectSuccess: cbConnectSuccess,
  35059. cbConnectError: cbConnectError,
  35060. cbConnectClose: cbConnectClose
  35061. });
  35062. }
  35063. /**
  35064. * 离开页面时调用 断开链接的方法
  35065. * @param {*视频插件实例} oWebControl
  35066. */
  35067. function WebControlDistory() {
  35068. if (oWebControl != null) {
  35069. oWebControl.JS_DestroyWnd().then(function () {
  35070. console.log('JS_DestroyWnd');
  35071. }, function () {});
  35072. oWebControl.JS_StopService('window').then(function () {
  35073. oWebControl.JS_Disconnect().then(function () {
  35074. console.log('JS_Disconnect');
  35075. }, function () {});
  35076. });
  35077. }
  35078. }
  35079. // 监听视频控件的事件-todo
  35080. function cbIntegrationCallBack(oData) {
  35081. if (oData.responseMsg.eventName === 'FireTransFunction') ;
  35082. // if (typeof onHDCallbackMessage === 'function' && oData && oData.responseMsg) {
  35083. // onHDCallbackMessage(oData.responseMsg)
  35084. // }
  35085. console.log(oData.responseMsg);
  35086. }
  35087. function cbConnectSuccess() {
  35088. // 设置窗口控制回调
  35089. oWebControl.JS_SetWindowControlCallback({
  35090. cbIntegrationCallBack: cbIntegrationCallBack
  35091. });
  35092. //创建视频窗口
  35093. oWebControl.JS_StartService('window', {
  35094. dllPath: './chain/cloudTransform.dll'
  35095. }).then(function () {
  35096. oWebControl.JS_CreateWnd('playWnd', 900, 500).then(function () {
  35097. console.log('JS_CreateWnd success');
  35098. });
  35099. });
  35100. }
  35101. function cbConnectError() {
  35102. console.log('cbConnectError');
  35103. oWebControl = null;
  35104. console.error('确认本地进程是否已安装并开启成功!');
  35105. }
  35106. function cbConnectClose(bNormalClose) {
  35107. // 连接异常断开:bNormalClose = false
  35108. // JS_Disconnect正常断开:bNormalClose = true
  35109. console.log('cbConnectClose');
  35110. oWebControl = null;
  35111. }
  35112. // //销毁视频控件
  35113. // function WebControlDistory() {
  35114. // // var bIE = !!window.ActiveXObject || 'ActiveXObject' in window // 是否为IE浏览器
  35115. // if (oWebControl != null) {
  35116. // oWebControl.JS_DestroyWnd().then(
  35117. // function () {
  35118. // console.log('JS_DestroyWnd');
  35119. // },
  35120. // function () { }
  35121. // );
  35122. // oWebControl.JS_StopService('window').then(function () {
  35123. // oWebControl.JS_Disconnect().then(
  35124. // function () {
  35125. // console.log('JS_Disconnect');
  35126. // },
  35127. // function () { }
  35128. // );
  35129. // });
  35130. // }
  35131. // }
  35132. window.onscroll = function () {
  35133. if (oWebControl != null) {
  35134. oWebControl.JS_Resize(900, 500);
  35135. }
  35136. };
  35137. window.onresize = function () {
  35138. if (oWebControl != null) {
  35139. oWebControl.JS_Resize(900, 500);
  35140. }
  35141. };
  35142. window.onunload = function () {
  35143. try {
  35144. oWebControl.JS_HideWnd();
  35145. WebControlDistory();
  35146. } catch (error) {
  35147. console.error(error);
  35148. }
  35149. };
  35150. window.onpagehide = function () {
  35151. try {
  35152. oWebControl.JS_HideWnd();
  35153. } catch (error) {
  35154. console.error(error);
  35155. }
  35156. };
  35157. var EZUIKitHD = /*#__PURE__*/function () {
  35158. function EZUIKitHD(params) {
  35159. var _this = this;
  35160. _classCallCheck$1(this, EZUIKitHD);
  35161. _defineProperty(this, "changeModel", function (num, playParams) {
  35162. var self = _this;
  35163. _this.switchVideo = parseInt(num);
  35164. // if (num == 0) {
  35165. // this.setLayout(this.layout);
  35166. // } else {
  35167. // this.setLayout(1)
  35168. // }
  35169. if (oWebControl) {
  35170. oWebControl.JS_RequestInterface({
  35171. funcName: 'ChangeModel',
  35172. arguments: encodeURI(JSON.stringify({
  35173. model: num
  35174. }))
  35175. }).then(function (oData) {
  35176. // self.play();
  35177. if (num == 0) {
  35178. // 预览
  35179. self.play({
  35180. deviceSerial: playParams.deviceSerial,
  35181. channelNo: playParams.channelNo,
  35182. validateCode: playParams.validateCode
  35183. });
  35184. } else {
  35185. // 回放
  35186. self.play({
  35187. deviceSerial: playParams.deviceSerial,
  35188. channelNo: playParams.channelNo,
  35189. validateCode: playParams.validateCode,
  35190. startTime: playParams.startTime,
  35191. endTime: playParams.endTime
  35192. });
  35193. }
  35194. });
  35195. }
  35196. });
  35197. _defineProperty(this, "init", function (initParams) {
  35198. var _argumentsPram;
  35199. var self = _this;
  35200. if (!initParams.appKey || !initParams.accessToken) {
  35201. self.showTips(false, '请输入appkey和token');
  35202. return;
  35203. }
  35204. if (typeof initParams.appKey !== 'undefined') {
  35205. _this.appKey = initParams.appKey;
  35206. }
  35207. if (typeof initParams.accessToken !== 'undefined') {
  35208. _this.accessToken = initParams.accessToken;
  35209. }
  35210. if (typeof initParams.platformId !== 'undefined') {
  35211. _this.platformId = initParams.platformId;
  35212. }
  35213. // const onHDCallbackMessage = typeof initParams.onCallbackMessage === 'function';
  35214. // if (onHDCallbackMessage) {
  35215. // onHDCallbackMessage = initParams.onHDCallbackMessage
  35216. // }
  35217. // 初始化入参
  35218. var argumentsPram = (_argumentsPram = {
  35219. layout: +self.layout,
  35220. userName: "",
  35221. waterMark: ""
  35222. }, _defineProperty(_argumentsPram, "waterMark", "1"), _defineProperty(_argumentsPram, "iWndType", 0), _defineProperty(_argumentsPram, "intelligenceEnable", 1), _defineProperty(_argumentsPram, "isRecord", 1), _defineProperty(_argumentsPram, "isSetPos", 1), _defineProperty(_argumentsPram, "motionDetectEnable", 0), _defineProperty(_argumentsPram, "playBackAlarmOverlyingEnable", 0), _defineProperty(_argumentsPram, "response", {
  35223. code: 0,
  35224. message: null,
  35225. data: {
  35226. appKey: initParams.appKey,
  35227. ezvizToken: initParams.accessToken,
  35228. videoLevel: 0,
  35229. logLevel: 3,
  35230. showMainTool: 1,
  35231. showSubTool: 1,
  35232. waterMark: "1",
  35233. userName: "openteam",
  35234. platformId: initParams.platformId
  35235. }
  35236. }), _argumentsPram);
  35237. console.log('初始化入参', argumentsPram);
  35238. // 调用视频控件初始化方法
  35239. oWebControl.JS_RequestInterface({
  35240. funcName: 'Init',
  35241. arguments: encodeURI(JSON.stringify(argumentsPram))
  35242. }).then(function (oData) {
  35243. console.log(oData.responseMsg);
  35244. self.showTips(true, '视频初始化成功!');
  35245. });
  35246. });
  35247. _defineProperty(this, "play", function (playParams) {
  35248. var self = _this;
  35249. if (!playParams.deviceSerial || !playParams.channelNo) {
  35250. return;
  35251. }
  35252. if (typeof playParams.deviceSerial !== 'undefined') {
  35253. _this.deviceSerial = playParams.deviceSerial;
  35254. }
  35255. if (typeof playParams.channelNo !== 'undefined') {
  35256. _this.channelNo = playParams.channelNo;
  35257. }
  35258. if (typeof playParams.startTime !== 'undefined' && playParams.startTime) {
  35259. _this.startTime = playParams.startTime + ' 00:00:00';
  35260. }
  35261. if (typeof playParams.endTime !== 'undefined' && playParams.endTime) {
  35262. _this.endTime = playParams.endTime + ' 23:59:59';
  35263. }
  35264. if (typeof playParams.validateCode !== 'undefined' && playParams.validateCode) {
  35265. _this.validateCode = playParams.validateCode;
  35266. }
  35267. // 预览入参
  35268. var argumentsPram = {
  35269. response: {
  35270. code: 0,
  35271. message: null,
  35272. data: {
  35273. deviceSerial: playParams.deviceSerial,
  35274. channelCode: playParams.channelNo,
  35275. channelNo: +playParams.channelNo,
  35276. codeIsEncrypt: 0,
  35277. validateCode: playParams.validateCode,
  35278. deviceClass: self.deviceClass,
  35279. deviceType: "10222",
  35280. //deviceType:"10240",
  35281. channelId: "2222222222",
  35282. channelName: "channelNameTest",
  35283. storeName: "storeName",
  35284. storeId: "storeid",
  35285. // startTime: '2022-09-13 20:00:00',
  35286. // endTime: '2022-09-13 21:40:00',
  35287. startTime: _this.startTime,
  35288. endTime: _this.endTime
  35289. //Limited_start:limitStart,
  35290. //Limited_end:limitEnd,
  35291. }
  35292. }
  35293. };
  35294. if (self.deviceClass === '1') {
  35295. // 国标协议对应的两个字段
  35296. argumentsPram.response.data.channelCode = self.channelNo;
  35297. argumentsPram.response.data.platformId = self.platformId;
  35298. } else {
  35299. // 海康协议对应的一个字段
  35300. argumentsPram.response.data.channelNo = +self.channelNo;
  35301. }
  35302. // 回放时对应的两个字段
  35303. if (_this.switchVideo === 1) {
  35304. if (_this.startTime) argumentsPram.response.data.startTime = _this.startTime;
  35305. if (_this.endTime) argumentsPram.response.data.endTime = _this.endTime;
  35306. }
  35307. console.log('预览/回放入参', argumentsPram);
  35308. // 调用视频控件预览方法
  35309. oWebControl.JS_RequestInterface({
  35310. funcName: _this.switchVideo === 0 ? 'StartPreview' : 'StartPlayback',
  35311. arguments: encodeURI(JSON.stringify(argumentsPram))
  35312. }).then(function (oData) {
  35313. console.log(oData.responseMsg);
  35314. self.showTips(true, '预览/回放成功!');
  35315. })["catch"](function (res) {
  35316. console.log('开始播放:', res);
  35317. });
  35318. });
  35319. _defineProperty(this, "showCBInfo", function (message) {
  35320. _this.callbackMessage = _this.callbackMessage + JSON.stringify(message) + '\n\n';
  35321. console.log(_this.callbackMessage);
  35322. });
  35323. _defineProperty(this, "showTips", function (status, message) {
  35324. // let self = this;
  35325. // this.successTip = status;
  35326. // this.tips = message;
  35327. // this.tipsShow = true;
  35328. // setTimeout(() => {
  35329. // self.tipsShow = false;
  35330. // }, 1000);
  35331. });
  35332. _defineProperty(this, "hideVideo", function () {
  35333. oWebControl.JS_HideWnd();
  35334. });
  35335. _defineProperty(this, "showVideo", function () {
  35336. oWebControl.JS_ShowWnd();
  35337. });
  35338. _defineProperty(this, "GetLayout", function () {
  35339. var data = null;
  35340. oWebControl.JS_RequestInterface({
  35341. funcName: 'GetLayout',
  35342. arguments: encodeURI(JSON.stringify({
  35343. response: {
  35344. code: 0,
  35345. message: null,
  35346. data: data
  35347. }
  35348. }))
  35349. }).then(function (oData) {
  35350. console.log(JSON.stringify(oData.responseMsg));
  35351. console.log(oData.responseMsg);
  35352. });
  35353. });
  35354. _defineProperty(this, "capturePicture", function (wndId) {
  35355. var data = null;
  35356. oWebControl.JS_RequestInterface({
  35357. funcName: 'CaptureJPGEx',
  35358. arguments: encodeURI(JSON.stringify({
  35359. response: {
  35360. code: 0,
  35361. message: null,
  35362. data: data
  35363. }
  35364. }))
  35365. }).then(function (oData) {
  35366. console.log(JSON.stringify(oData.responseMsg));
  35367. console.log(oData.responseMsg);
  35368. });
  35369. });
  35370. _defineProperty(this, "stop", function () {
  35371. var wndId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
  35372. oWebControl.JS_RequestInterface({
  35373. funcName: 'StopPlay',
  35374. arguments: encodeURI(JSON.stringify({
  35375. response: {
  35376. code: 0,
  35377. message: null,
  35378. data: {
  35379. wndId: parseInt(wndId) //传入1表示停止窗口1,传入-1表示停止当前活动窗口
  35380. }
  35381. }
  35382. }))
  35383. }).then(function (oData) {
  35384. console.log(JSON.stringify(oData.responseMsg));
  35385. console.log(oData.responseMsg);
  35386. });
  35387. });
  35388. _defineProperty(this, "setLayout", function (num) {
  35389. var layout = parseInt(num);
  35390. if (isNaN(layout) || layout == 0 || layout >= 13) {
  35391. console.log('不支持实际布局大于16的窗口数');
  35392. return;
  35393. }
  35394. _this.layout = layout;
  35395. oWebControl.JS_RequestInterface({
  35396. funcName: 'SetLayout',
  35397. arguments: encodeURI(JSON.stringify({
  35398. response: {
  35399. code: 0,
  35400. message: null,
  35401. data: {
  35402. layout: layout //参数int为布局编号,其定义参见控件初始化函数 init方法中指定的编号。
  35403. }
  35404. }
  35405. }))
  35406. }).then(function (oData) {
  35407. console.log(JSON.stringify(oData.responseMsg));
  35408. console.log(oData.responseMsg);
  35409. });
  35410. });
  35411. _defineProperty(this, "setSoundVolumn", function () {
  35412. var wndId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
  35413. var num = arguments.length > 1 ? arguments[1] : undefined;
  35414. oWebControl.JS_RequestInterface({
  35415. funcName: 'SoundVolumn',
  35416. arguments: encodeURI(JSON.stringify({
  35417. response: {
  35418. code: 0,
  35419. message: null,
  35420. data: {
  35421. wndId: parseInt(wndId),
  35422. //传入1表示停止窗口1,传入-1表示停止当前活动窗口
  35423. volumn: parseInt(num)
  35424. }
  35425. }
  35426. }))
  35427. }).then(function (oData) {
  35428. console.log(JSON.stringify(oData.responseMsg));
  35429. console.log(oData.responseMsg);
  35430. });
  35431. });
  35432. _defineProperty(this, "testMute", function () {
  35433. var num = parseInt(prompt('请输入窗口ID'));
  35434. oWebControl.JS_RequestInterface({
  35435. funcName: 'MuteOnOff',
  35436. arguments: encodeURI(JSON.stringify({
  35437. response: {
  35438. code: 0,
  35439. message: null,
  35440. data: {
  35441. wndId: num
  35442. }
  35443. }
  35444. }))
  35445. }).then(function (oData) {
  35446. console.log(JSON.stringify(oData.responseMsg));
  35447. console.log(oData.responseMsg);
  35448. });
  35449. });
  35450. _defineProperty(this, "testSelectWnd", function () {
  35451. var num = parseInt(prompt('请输入窗口ID'));
  35452. oWebControl.JS_RequestInterface({
  35453. funcName: 'SelectPlayWnd',
  35454. arguments: encodeURI(JSON.stringify({
  35455. response: {
  35456. code: 0,
  35457. message: null,
  35458. data: {
  35459. wndId: num
  35460. }
  35461. }
  35462. }))
  35463. }).then(function (oData) {
  35464. console.log(JSON.stringify(oData.responseMsg));
  35465. console.log(oData.responseMsg);
  35466. });
  35467. });
  35468. _defineProperty(this, "setVideoLevel", function (wndId, level) {
  35469. oWebControl.JS_RequestInterface({
  35470. funcName: 'SetVideoLevel',
  35471. arguments: encodeURI(JSON.stringify({
  35472. response: {
  35473. code: 0,
  35474. message: null,
  35475. data: {
  35476. wndId: _this.switchVideo == 1 ? 0 : parseInt(wndId),
  35477. level: parseInt(level, 10) //0:流畅 1:均衡 2:高品质 3:超清
  35478. }
  35479. }
  35480. }))
  35481. }).then(function (oData) {
  35482. console.log(JSON.stringify(oData.responseMsg));
  35483. console.log(oData.responseMsg);
  35484. });
  35485. });
  35486. _defineProperty(this, "startTalk", function (wndId) {
  35487. oWebControl.JS_RequestInterface({
  35488. funcName: 'StartTalk',
  35489. arguments: encodeURI(JSON.stringify({
  35490. response: {
  35491. code: 0,
  35492. message: null,
  35493. data: {
  35494. wndId: parseInt(wndId)
  35495. }
  35496. }
  35497. }))
  35498. }).then(function (oData) {
  35499. console.log(JSON.stringify(oData.responseMsg));
  35500. console.log(oData.responseMsg);
  35501. });
  35502. });
  35503. _defineProperty(this, "stopTalk", function (wndId) {
  35504. oWebControl.JS_RequestInterface({
  35505. funcName: 'StopTalk',
  35506. arguments: encodeURI(JSON.stringify({
  35507. response: {
  35508. code: 0,
  35509. message: null,
  35510. data: {
  35511. wndId: parseInt(wndId)
  35512. }
  35513. }
  35514. }))
  35515. }).then(function (oData) {
  35516. console.log(JSON.stringify(oData.responseMsg));
  35517. console.log(oData.responseMsg);
  35518. });
  35519. });
  35520. _defineProperty(this, "startSave", function (wndId) {
  35521. oWebControl.JS_RequestInterface({
  35522. funcName: 'StartRecord',
  35523. arguments: encodeURI(JSON.stringify({
  35524. response: {
  35525. code: 0,
  35526. message: null,
  35527. data: {
  35528. wndId: parseInt(wndId)
  35529. }
  35530. }
  35531. }))
  35532. }).then(function (oData) {
  35533. console.log(JSON.stringify(oData.responseMsg));
  35534. console.log(oData.responseMsg);
  35535. });
  35536. });
  35537. _defineProperty(this, "stopSave", function (wndId) {
  35538. oWebControl.JS_RequestInterface({
  35539. funcName: 'StopRecord',
  35540. arguments: encodeURI(JSON.stringify({
  35541. response: {
  35542. code: 0,
  35543. message: null,
  35544. data: {
  35545. wndId: parseInt(wndId)
  35546. }
  35547. }
  35548. }))
  35549. }).then(function (oData) {
  35550. console.log(JSON.stringify(oData.responseMsg));
  35551. console.log(oData.responseMsg);
  35552. });
  35553. });
  35554. this.appKey = 'b9a3ad6e8026410095d8252169fa430a', this.accessToken = 'at.2vtum8873rrcwbrv431qb6pn94dkbv23-8dw2twn355-1u3x014-wrthellzk', this.deviceSerial = 'C33368372', this.channelNo = '1', this.validateCode = ''; // 设备验证码
  35555. this.deviceClass = '0';
  35556. this.platformId = '';
  35557. this.startTime = '';
  35558. this.endTime = '';
  35559. this.layout = 2;
  35560. this.switchVideo = 0; // 0实时预览 1录像回放
  35561. this.tips = '调用成功';
  35562. this.successTip = false;
  35563. this.tipsShow = false;
  35564. oWebControl = WebControlInit('playWnd', cbConnectSuccess, cbConnectError, cbConnectClose);
  35565. }
  35566. /**
  35567. * 切换模式
  35568. * @param {*} num 0: 预览 1:回放
  35569. */
  35570. _createClass$1(EZUIKitHD, [{
  35571. key: "alarmMsg",
  35572. value: function alarmMsg() {
  35573. var res = {
  35574. "request": {
  35575. "body": {
  35576. "alarmTypes": [10800, 0, 0, 0, 0],
  35577. "channelId": "066dde0465dd4abaab6afe355baf9d0b",
  35578. "endTime": "1621007999000",
  35579. "startTime": "1620921600000"
  35580. },
  35581. "callBack": "GetAlarmMsgOrders",
  35582. "majorKey": "",
  35583. "method": "POST",
  35584. "storeId": "",
  35585. "url": "/videoplugin/message/getMessageByTypes"
  35586. },
  35587. "response": {
  35588. "code": 0,
  35589. "message": null,
  35590. "data": [{
  35591. "alarmType": 10800,
  35592. "alarmName": "移动侦测报警",
  35593. "alarmTime": 1620921217000
  35594. }, {
  35595. "alarmType": 10800,
  35596. "alarmName": "移动侦测报警",
  35597. "alarmTime": 1620920678000
  35598. }, {
  35599. "alarmType": 10800,
  35600. "alarmName": "移动侦测报警",
  35601. "alarmTime": 1620920586000
  35602. }, {
  35603. "alarmType": 10800,
  35604. "alarmName": "移动侦测报警",
  35605. "alarmTime": 1620919513000
  35606. }, {
  35607. "alarmType": 10800,
  35608. "alarmName": "移动侦测报警",
  35609. "alarmTime": 1620919483000
  35610. }, {
  35611. "alarmType": 10800,
  35612. "alarmName": "移动侦测报警",
  35613. "alarmTime": 1620919333000
  35614. }, {
  35615. "alarmType": 10800,
  35616. "alarmName": "移动侦测报警",
  35617. "alarmTime": 1620918913000
  35618. }, {
  35619. "alarmType": 10800,
  35620. "alarmName": "移动侦测报警",
  35621. "alarmTime": 1620918616000
  35622. }, {
  35623. "alarmType": 10800,
  35624. "alarmName": "移动侦测报警",
  35625. "alarmTime": 1620918305000
  35626. }, {
  35627. "alarmType": 10800,
  35628. "alarmName": "移动侦测报警",
  35629. "alarmTime": 1620917858000
  35630. }, {
  35631. "alarmType": 10800,
  35632. "alarmName": "移动侦测报警",
  35633. "alarmTime": 1620917658000
  35634. }, {
  35635. "alarmType": 10800,
  35636. "alarmName": "移动侦测报警",
  35637. "alarmTime": 1620917244000
  35638. }, {
  35639. "alarmType": 10800,
  35640. "alarmName": "移动侦测报警",
  35641. "alarmTime": 1620917064000
  35642. }, {
  35643. "alarmType": 10800,
  35644. "alarmName": "移动侦测报警",
  35645. "alarmTime": 1620916994000
  35646. }, {
  35647. "alarmType": 10800,
  35648. "alarmName": "移动侦测报警",
  35649. "alarmTime": 1620916668000
  35650. }, {
  35651. "alarmType": 10800,
  35652. "alarmName": "移动侦测报警",
  35653. "alarmTime": 1620916571000
  35654. }, {
  35655. "alarmType": 10800,
  35656. "alarmName": "移动侦测报警",
  35657. "alarmTime": 1620916529000
  35658. }, {
  35659. "alarmType": 10800,
  35660. "alarmName": "移动侦测报警",
  35661. "alarmTime": 1620916343000
  35662. }, {
  35663. "alarmType": 10800,
  35664. "alarmName": "移动侦测报警",
  35665. "alarmTime": 1620916081000
  35666. }, {
  35667. "alarmType": 10800,
  35668. "alarmName": "移动侦测报警",
  35669. "alarmTime": 1620915825000
  35670. }, {
  35671. "alarmType": 10800,
  35672. "alarmName": "移动侦测报警",
  35673. "alarmTime": 1620915676000
  35674. }, {
  35675. "alarmType": 10800,
  35676. "alarmName": "移动侦测报警",
  35677. "alarmTime": 1620915531000
  35678. }, {
  35679. "alarmType": 10800,
  35680. "alarmName": "移动侦测报警",
  35681. "alarmTime": 1620915394000
  35682. }, {
  35683. "alarmType": 10800,
  35684. "alarmName": "移动侦测报警",
  35685. "alarmTime": 1620915197000
  35686. }, {
  35687. "alarmType": 10800,
  35688. "alarmName": "移动侦测报警",
  35689. "alarmTime": 1620914971000
  35690. }, {
  35691. "alarmType": 10800,
  35692. "alarmName": "移动侦测报警",
  35693. "alarmTime": 1620914644000
  35694. }, {
  35695. "alarmType": 10800,
  35696. "alarmName": "移动侦测报警",
  35697. "alarmTime": 1620914533000
  35698. }, {
  35699. "alarmType": 10800,
  35700. "alarmName": "移动侦测报警",
  35701. "alarmTime": 1620914457000
  35702. }, {
  35703. "alarmType": 10800,
  35704. "alarmName": "移动侦测报警",
  35705. "alarmTime": 1620914376000
  35706. }, {
  35707. "alarmType": 10800,
  35708. "alarmName": "移动侦测报警",
  35709. "alarmTime": 1620914284000
  35710. }, {
  35711. "alarmType": 10800,
  35712. "alarmName": "移动侦测报警",
  35713. "alarmTime": 1620913973000
  35714. }, {
  35715. "alarmType": 10800,
  35716. "alarmName": "移动侦测报警",
  35717. "alarmTime": 1620913431000
  35718. }, {
  35719. "alarmType": 10800,
  35720. "alarmName": "移动侦测报警",
  35721. "alarmTime": 1620912834000
  35722. }, {
  35723. "alarmType": 10800,
  35724. "alarmName": "移动侦测报警",
  35725. "alarmTime": 1620912771000
  35726. }, {
  35727. "alarmType": 10800,
  35728. "alarmName": "移动侦测报警",
  35729. "alarmTime": 1620912354000
  35730. }, {
  35731. "alarmType": 10800,
  35732. "alarmName": "移动侦测报警",
  35733. "alarmTime": 1620912275000
  35734. }, {
  35735. "alarmType": 10800,
  35736. "alarmName": "移动侦测报警",
  35737. "alarmTime": 1620912093000
  35738. }, {
  35739. "alarmType": 10800,
  35740. "alarmName": "移动侦测报警",
  35741. "alarmTime": 1620912024000
  35742. }, {
  35743. "alarmType": 10800,
  35744. "alarmName": "移动侦测报警",
  35745. "alarmTime": 1620911890000
  35746. }, {
  35747. "alarmType": 10800,
  35748. "alarmName": "移动侦测报警",
  35749. "alarmTime": 1620911839000
  35750. }, {
  35751. "alarmType": 10800,
  35752. "alarmName": "移动侦测报警",
  35753. "alarmTime": 1620911807000
  35754. }, {
  35755. "alarmType": 10800,
  35756. "alarmName": "移动侦测报警",
  35757. "alarmTime": 1620911760000
  35758. }, {
  35759. "alarmType": 10800,
  35760. "alarmName": "移动侦测报警",
  35761. "alarmTime": 1620911682000
  35762. }, {
  35763. "alarmType": 10800,
  35764. "alarmName": "移动侦测报警",
  35765. "alarmTime": 1620911270000
  35766. }, {
  35767. "alarmType": 10800,
  35768. "alarmName": "移动侦测报警",
  35769. "alarmTime": 1620911184000
  35770. }, {
  35771. "alarmType": 10800,
  35772. "alarmName": "移动侦测报警",
  35773. "alarmTime": 1620910982000
  35774. }, {
  35775. "alarmType": 10800,
  35776. "alarmName": "移动侦测报警",
  35777. "alarmTime": 1620910931000
  35778. }, {
  35779. "alarmType": 10800,
  35780. "alarmName": "移动侦测报警",
  35781. "alarmTime": 1620910851000
  35782. }, {
  35783. "alarmType": 10800,
  35784. "alarmName": "移动侦测报警",
  35785. "alarmTime": 1620910781000
  35786. }, {
  35787. "alarmType": 10800,
  35788. "alarmName": "移动侦测报警",
  35789. "alarmTime": 1620910727000
  35790. }, {
  35791. "alarmType": 10800,
  35792. "alarmName": "移动侦测报警",
  35793. "alarmTime": 1620910677000
  35794. }, {
  35795. "alarmType": 10800,
  35796. "alarmName": "移动侦测报警",
  35797. "alarmTime": 1620910647000
  35798. }, {
  35799. "alarmType": 10800,
  35800. "alarmName": "移动侦测报警",
  35801. "alarmTime": 1620910588000
  35802. }, {
  35803. "alarmType": 10800,
  35804. "alarmName": "移动侦测报警",
  35805. "alarmTime": 1620910544000
  35806. }, {
  35807. "alarmType": 10800,
  35808. "alarmName": "移动侦测报警",
  35809. "alarmTime": 1620910484000
  35810. }, {
  35811. "alarmType": 10800,
  35812. "alarmName": "移动侦测报警",
  35813. "alarmTime": 1620910410000
  35814. }, {
  35815. "alarmType": 10800,
  35816. "alarmName": "移动侦测报警",
  35817. "alarmTime": 1620910350000
  35818. }, {
  35819. "alarmType": 10800,
  35820. "alarmName": "移动侦测报警",
  35821. "alarmTime": 1620910278000
  35822. }, {
  35823. "alarmType": 10800,
  35824. "alarmName": "移动侦测报警",
  35825. "alarmTime": 1620910217000
  35826. }, {
  35827. "alarmType": 10800,
  35828. "alarmName": "移动侦测报警",
  35829. "alarmTime": 1620910124000
  35830. }, {
  35831. "alarmType": 10800,
  35832. "alarmName": "移动侦测报警",
  35833. "alarmTime": 1620909976000
  35834. }, {
  35835. "alarmType": 10800,
  35836. "alarmName": "移动侦测报警",
  35837. "alarmTime": 1620909939000
  35838. }, {
  35839. "alarmType": 10800,
  35840. "alarmName": "移动侦测报警",
  35841. "alarmTime": 1620909847000
  35842. }, {
  35843. "alarmType": 10800,
  35844. "alarmName": "移动侦测报警",
  35845. "alarmTime": 1620909817000
  35846. }, {
  35847. "alarmType": 10800,
  35848. "alarmName": "移动侦测报警",
  35849. "alarmTime": 1620909736000
  35850. }, {
  35851. "alarmType": 10800,
  35852. "alarmName": "移动侦测报警",
  35853. "alarmTime": 1620909664000
  35854. }, {
  35855. "alarmType": 10800,
  35856. "alarmName": "移动侦测报警",
  35857. "alarmTime": 1620909605000
  35858. }, {
  35859. "alarmType": 10800,
  35860. "alarmName": "移动侦测报警",
  35861. "alarmTime": 1620909575000
  35862. }, {
  35863. "alarmType": 10800,
  35864. "alarmName": "移动侦测报警",
  35865. "alarmTime": 1620909346000
  35866. }, {
  35867. "alarmType": 10800,
  35868. "alarmName": "移动侦测报警",
  35869. "alarmTime": 1620909247000
  35870. }, {
  35871. "alarmType": 10800,
  35872. "alarmName": "移动侦测报警",
  35873. "alarmTime": 1620909216000
  35874. }, {
  35875. "alarmType": 10800,
  35876. "alarmName": "移动侦测报警",
  35877. "alarmTime": 1620909149000
  35878. }, {
  35879. "alarmType": 10800,
  35880. "alarmName": "移动侦测报警",
  35881. "alarmTime": 1620909120000
  35882. }, {
  35883. "alarmType": 10800,
  35884. "alarmName": "移动侦测报警",
  35885. "alarmTime": 1620909028000
  35886. }, {
  35887. "alarmType": 10800,
  35888. "alarmName": "移动侦测报警",
  35889. "alarmTime": 1620908999000
  35890. }, {
  35891. "alarmType": 10800,
  35892. "alarmName": "移动侦测报警",
  35893. "alarmTime": 1620908969000
  35894. }, {
  35895. "alarmType": 10800,
  35896. "alarmName": "移动侦测报警",
  35897. "alarmTime": 1620908909000
  35898. }, {
  35899. "alarmType": 10800,
  35900. "alarmName": "移动侦测报警",
  35901. "alarmTime": 1620908880000
  35902. }, {
  35903. "alarmType": 10800,
  35904. "alarmName": "移动侦测报警",
  35905. "alarmTime": 1620908835000
  35906. }, {
  35907. "alarmType": 10800,
  35908. "alarmName": "移动侦测报警",
  35909. "alarmTime": 1620908750000
  35910. }, {
  35911. "alarmType": 10800,
  35912. "alarmName": "移动侦测报警",
  35913. "alarmTime": 1620908720000
  35914. }, {
  35915. "alarmType": 10800,
  35916. "alarmName": "移动侦测报警",
  35917. "alarmTime": 1620908652000
  35918. }, {
  35919. "alarmType": 10800,
  35920. "alarmName": "移动侦测报警",
  35921. "alarmTime": 1620908612000
  35922. }, {
  35923. "alarmType": 10800,
  35924. "alarmName": "移动侦测报警",
  35925. "alarmTime": 1620908582000
  35926. }, {
  35927. "alarmType": 10800,
  35928. "alarmName": "移动侦测报警",
  35929. "alarmTime": 1620908552000
  35930. }, {
  35931. "alarmType": 10800,
  35932. "alarmName": "移动侦测报警",
  35933. "alarmTime": 1620908456000
  35934. }, {
  35935. "alarmType": 10800,
  35936. "alarmName": "移动侦测报警",
  35937. "alarmTime": 1620908426000
  35938. }, {
  35939. "alarmType": 10800,
  35940. "alarmName": "移动侦测报警",
  35941. "alarmTime": 1620908299000
  35942. }, {
  35943. "alarmType": 10800,
  35944. "alarmName": "移动侦测报警",
  35945. "alarmTime": 1620908268000
  35946. }, {
  35947. "alarmType": 10800,
  35948. "alarmName": "移动侦测报警",
  35949. "alarmTime": 1620908050000
  35950. }, {
  35951. "alarmType": 10800,
  35952. "alarmName": "移动侦测报警",
  35953. "alarmTime": 1620907918000
  35954. }, {
  35955. "alarmType": 10800,
  35956. "alarmName": "移动侦测报警",
  35957. "alarmTime": 1620907758000
  35958. }, {
  35959. "alarmType": 10800,
  35960. "alarmName": "移动侦测报警",
  35961. "alarmTime": 1620907625000
  35962. }, {
  35963. "alarmType": 10800,
  35964. "alarmName": "移动侦测报警",
  35965. "alarmTime": 1620907386000
  35966. }, {
  35967. "alarmType": 10800,
  35968. "alarmName": "移动侦测报警",
  35969. "alarmTime": 1620907292000
  35970. }, {
  35971. "alarmType": 10800,
  35972. "alarmName": "移动侦测报警",
  35973. "alarmTime": 1620907127000
  35974. }, {
  35975. "alarmType": 10800,
  35976. "alarmName": "移动侦测报警",
  35977. "alarmTime": 1620906864000
  35978. }, {
  35979. "alarmType": 10800,
  35980. "alarmName": "移动侦测报警",
  35981. "alarmTime": 1620906828000
  35982. }, {
  35983. "alarmType": 10800,
  35984. "alarmName": "移动侦测报警",
  35985. "alarmTime": 1620906797000
  35986. }, {
  35987. "alarmType": 10800,
  35988. "alarmName": "移动侦测报警",
  35989. "alarmTime": 1620906747000
  35990. }, {
  35991. "alarmType": 10800,
  35992. "alarmName": "移动侦测报警",
  35993. "alarmTime": 1620906717000
  35994. }, {
  35995. "alarmType": 10800,
  35996. "alarmName": "移动侦测报警",
  35997. "alarmTime": 1620906632000
  35998. }, {
  35999. "alarmType": 10800,
  36000. "alarmName": "移动侦测报警",
  36001. "alarmTime": 1620906501000
  36002. }, {
  36003. "alarmType": 10800,
  36004. "alarmName": "移动侦测报警",
  36005. "alarmTime": 1620906412000
  36006. }, {
  36007. "alarmType": 10800,
  36008. "alarmName": "移动侦测报警",
  36009. "alarmTime": 1620906368000
  36010. }, {
  36011. "alarmType": 10800,
  36012. "alarmName": "移动侦测报警",
  36013. "alarmTime": 1620906329000
  36014. }, {
  36015. "alarmType": 10800,
  36016. "alarmName": "移动侦测报警",
  36017. "alarmTime": 1620906142000
  36018. }, {
  36019. "alarmType": 10800,
  36020. "alarmName": "移动侦测报警",
  36021. "alarmTime": 1620906112000
  36022. }, {
  36023. "alarmType": 10800,
  36024. "alarmName": "移动侦测报警",
  36025. "alarmTime": 1620906013000
  36026. }, {
  36027. "alarmType": 10800,
  36028. "alarmName": "移动侦测报警",
  36029. "alarmTime": 1620905946000
  36030. }, {
  36031. "alarmType": 10800,
  36032. "alarmName": "移动侦测报警",
  36033. "alarmTime": 1620905823000
  36034. }, {
  36035. "alarmType": 10800,
  36036. "alarmName": "移动侦测报警",
  36037. "alarmTime": 1620905697000
  36038. }, {
  36039. "alarmType": 10800,
  36040. "alarmName": "移动侦测报警",
  36041. "alarmTime": 1620905622000
  36042. }, {
  36043. "alarmType": 10800,
  36044. "alarmName": "移动侦测报警",
  36045. "alarmTime": 1620905571000
  36046. }, {
  36047. "alarmType": 10800,
  36048. "alarmName": "移动侦测报警",
  36049. "alarmTime": 1620905541000
  36050. }, {
  36051. "alarmType": 10800,
  36052. "alarmName": "移动侦测报警",
  36053. "alarmTime": 1620905511000
  36054. }, {
  36055. "alarmType": 10800,
  36056. "alarmName": "移动侦测报警",
  36057. "alarmTime": 1620905481000
  36058. }, {
  36059. "alarmType": 10800,
  36060. "alarmName": "移动侦测报警",
  36061. "alarmTime": 1620905442000
  36062. }, {
  36063. "alarmType": 10800,
  36064. "alarmName": "移动侦测报警",
  36065. "alarmTime": 1620905412000
  36066. }, {
  36067. "alarmType": 10800,
  36068. "alarmName": "移动侦测报警",
  36069. "alarmTime": 1620905382000
  36070. }, {
  36071. "alarmType": 10800,
  36072. "alarmName": "移动侦测报警",
  36073. "alarmTime": 1620905352000
  36074. }, {
  36075. "alarmType": 10800,
  36076. "alarmName": "移动侦测报警",
  36077. "alarmTime": 1620905322000
  36078. }, {
  36079. "alarmType": 10800,
  36080. "alarmName": "移动侦测报警",
  36081. "alarmTime": 1620905262000
  36082. }, {
  36083. "alarmType": 10800,
  36084. "alarmName": "移动侦测报警",
  36085. "alarmTime": 1620905196000
  36086. }, {
  36087. "alarmType": 10800,
  36088. "alarmName": "移动侦测报警",
  36089. "alarmTime": 1620905150000
  36090. }, {
  36091. "alarmType": 10800,
  36092. "alarmName": "移动侦测报警",
  36093. "alarmTime": 1620904994000
  36094. }, {
  36095. "alarmType": 10800,
  36096. "alarmName": "移动侦测报警",
  36097. "alarmTime": 1620904931000
  36098. }, {
  36099. "alarmType": 10800,
  36100. "alarmName": "移动侦测报警",
  36101. "alarmTime": 1620904813000
  36102. }, {
  36103. "alarmType": 10800,
  36104. "alarmName": "移动侦测报警",
  36105. "alarmTime": 1620904730000
  36106. }, {
  36107. "alarmType": 10800,
  36108. "alarmName": "移动侦测报警",
  36109. "alarmTime": 1620904700000
  36110. }, {
  36111. "alarmType": 10800,
  36112. "alarmName": "移动侦测报警",
  36113. "alarmTime": 1620904618000
  36114. }, {
  36115. "alarmType": 10800,
  36116. "alarmName": "移动侦测报警",
  36117. "alarmTime": 1620904286000
  36118. }, {
  36119. "alarmType": 10800,
  36120. "alarmName": "移动侦测报警",
  36121. "alarmTime": 1620904173000
  36122. }, {
  36123. "alarmType": 10800,
  36124. "alarmName": "移动侦测报警",
  36125. "alarmTime": 1620904143000
  36126. }, {
  36127. "alarmType": 10800,
  36128. "alarmName": "移动侦测报警",
  36129. "alarmTime": 1620904112000
  36130. }, {
  36131. "alarmType": 10800,
  36132. "alarmName": "移动侦测报警",
  36133. "alarmTime": 1620904053000
  36134. }, {
  36135. "alarmType": 10800,
  36136. "alarmName": "移动侦测报警",
  36137. "alarmTime": 1620904023000
  36138. }, {
  36139. "alarmType": 10800,
  36140. "alarmName": "移动侦测报警",
  36141. "alarmTime": 1620903854000
  36142. }, {
  36143. "alarmType": 10800,
  36144. "alarmName": "移动侦测报警",
  36145. "alarmTime": 1620903789000
  36146. }, {
  36147. "alarmType": 10800,
  36148. "alarmName": "移动侦测报警",
  36149. "alarmTime": 1620903723000
  36150. }, {
  36151. "alarmType": 10800,
  36152. "alarmName": "移动侦测报警",
  36153. "alarmTime": 1620903643000
  36154. }, {
  36155. "alarmType": 10800,
  36156. "alarmName": "移动侦测报警",
  36157. "alarmTime": 1620903612000
  36158. }, {
  36159. "alarmType": 10800,
  36160. "alarmName": "移动侦测报警",
  36161. "alarmTime": 1620903573000
  36162. }, {
  36163. "alarmType": 10800,
  36164. "alarmName": "移动侦测报警",
  36165. "alarmTime": 1620903505000
  36166. }, {
  36167. "alarmType": 10800,
  36168. "alarmName": "移动侦测报警",
  36169. "alarmTime": 1620903383000
  36170. }, {
  36171. "alarmType": 10800,
  36172. "alarmName": "移动侦测报警",
  36173. "alarmTime": 1620903329000
  36174. }, {
  36175. "alarmType": 10800,
  36176. "alarmName": "移动侦测报警",
  36177. "alarmTime": 1620903299000
  36178. }, {
  36179. "alarmType": 10800,
  36180. "alarmName": "移动侦测报警",
  36181. "alarmTime": 1620903268000
  36182. }, {
  36183. "alarmType": 10800,
  36184. "alarmName": "移动侦测报警",
  36185. "alarmTime": 1620903200000
  36186. }, {
  36187. "alarmType": 10800,
  36188. "alarmName": "移动侦测报警",
  36189. "alarmTime": 1620903149000
  36190. }, {
  36191. "alarmType": 10800,
  36192. "alarmName": "移动侦测报警",
  36193. "alarmTime": 1620903120000
  36194. }, {
  36195. "alarmType": 10800,
  36196. "alarmName": "移动侦测报警",
  36197. "alarmTime": 1620902977000
  36198. }, {
  36199. "alarmType": 10800,
  36200. "alarmName": "移动侦测报警",
  36201. "alarmTime": 1620902860000
  36202. }, {
  36203. "alarmType": 10800,
  36204. "alarmName": "移动侦测报警",
  36205. "alarmTime": 1620902770000
  36206. }, {
  36207. "alarmType": 10800,
  36208. "alarmName": "移动侦测报警",
  36209. "alarmTime": 1620902639000
  36210. }, {
  36211. "alarmType": 10800,
  36212. "alarmName": "移动侦测报警",
  36213. "alarmTime": 1620902609000
  36214. }, {
  36215. "alarmType": 10800,
  36216. "alarmName": "移动侦测报警",
  36217. "alarmTime": 1620902517000
  36218. }, {
  36219. "alarmType": 10800,
  36220. "alarmName": "移动侦测报警",
  36221. "alarmTime": 1620902373000
  36222. }, {
  36223. "alarmType": 10800,
  36224. "alarmName": "移动侦测报警",
  36225. "alarmTime": 1620902320000
  36226. }, {
  36227. "alarmType": 10800,
  36228. "alarmName": "移动侦测报警",
  36229. "alarmTime": 1620902253000
  36230. }, {
  36231. "alarmType": 10800,
  36232. "alarmName": "移动侦测报警",
  36233. "alarmTime": 1620902198000
  36234. }, {
  36235. "alarmType": 10800,
  36236. "alarmName": "移动侦测报警",
  36237. "alarmTime": 1620902132000
  36238. }, {
  36239. "alarmType": 10800,
  36240. "alarmName": "移动侦测报警",
  36241. "alarmTime": 1620901940000
  36242. }, {
  36243. "alarmType": 10800,
  36244. "alarmName": "移动侦测报警",
  36245. "alarmTime": 1620901850000
  36246. }, {
  36247. "alarmType": 10800,
  36248. "alarmName": "移动侦测报警",
  36249. "alarmTime": 1620901789000
  36250. }, {
  36251. "alarmType": 10800,
  36252. "alarmName": "移动侦测报警",
  36253. "alarmTime": 1620901746000
  36254. }, {
  36255. "alarmType": 10800,
  36256. "alarmName": "移动侦测报警",
  36257. "alarmTime": 1620901685000
  36258. }, {
  36259. "alarmType": 10800,
  36260. "alarmName": "移动侦测报警",
  36261. "alarmTime": 1620901638000
  36262. }, {
  36263. "alarmType": 10800,
  36264. "alarmName": "移动侦测报警",
  36265. "alarmTime": 1620901520000
  36266. }, {
  36267. "alarmType": 10800,
  36268. "alarmName": "移动侦测报警",
  36269. "alarmTime": 1620901489000
  36270. }, {
  36271. "alarmType": 10800,
  36272. "alarmName": "移动侦测报警",
  36273. "alarmTime": 1620901424000
  36274. }, {
  36275. "alarmType": 10800,
  36276. "alarmName": "移动侦测报警",
  36277. "alarmTime": 1620901271000
  36278. }, {
  36279. "alarmType": 10800,
  36280. "alarmName": "移动侦测报警",
  36281. "alarmTime": 1620901233000
  36282. }, {
  36283. "alarmType": 10800,
  36284. "alarmName": "移动侦测报警",
  36285. "alarmTime": 1620901157000
  36286. }, {
  36287. "alarmType": 10800,
  36288. "alarmName": "移动侦测报警",
  36289. "alarmTime": 1620900915000
  36290. }, {
  36291. "alarmType": 10800,
  36292. "alarmName": "移动侦测报警",
  36293. "alarmTime": 1620900834000
  36294. }, {
  36295. "alarmType": 10800,
  36296. "alarmName": "移动侦测报警",
  36297. "alarmTime": 1620900774000
  36298. }, {
  36299. "alarmType": 10800,
  36300. "alarmName": "移动侦测报警",
  36301. "alarmTime": 1620900744000
  36302. }, {
  36303. "alarmType": 10800,
  36304. "alarmName": "移动侦测报警",
  36305. "alarmTime": 1620900650000
  36306. }, {
  36307. "alarmType": 10800,
  36308. "alarmName": "移动侦测报警",
  36309. "alarmTime": 1620900440000
  36310. }, {
  36311. "alarmType": 10800,
  36312. "alarmName": "移动侦测报警",
  36313. "alarmTime": 1620900409000
  36314. }, {
  36315. "alarmType": 10800,
  36316. "alarmName": "移动侦测报警",
  36317. "alarmTime": 1620900175000
  36318. }, {
  36319. "alarmType": 10800,
  36320. "alarmName": "移动侦测报警",
  36321. "alarmTime": 1620900134000
  36322. }, {
  36323. "alarmType": 10800,
  36324. "alarmName": "移动侦测报警",
  36325. "alarmTime": 1620900069000
  36326. }, {
  36327. "alarmType": 10800,
  36328. "alarmName": "移动侦测报警",
  36329. "alarmTime": 1620900016000
  36330. }, {
  36331. "alarmType": 10800,
  36332. "alarmName": "移动侦测报警",
  36333. "alarmTime": 1620899976000
  36334. }, {
  36335. "alarmType": 10800,
  36336. "alarmName": "移动侦测报警",
  36337. "alarmTime": 1620899908000
  36338. }, {
  36339. "alarmType": 10800,
  36340. "alarmName": "移动侦测报警",
  36341. "alarmTime": 1620899879000
  36342. }, {
  36343. "alarmType": 10800,
  36344. "alarmName": "移动侦测报警",
  36345. "alarmTime": 1620899826000
  36346. }, {
  36347. "alarmType": 10800,
  36348. "alarmName": "移动侦测报警",
  36349. "alarmTime": 1620899756000
  36350. }, {
  36351. "alarmType": 10800,
  36352. "alarmName": "移动侦测报警",
  36353. "alarmTime": 1620899599000
  36354. }, {
  36355. "alarmType": 10800,
  36356. "alarmName": "移动侦测报警",
  36357. "alarmTime": 1620899559000
  36358. }, {
  36359. "alarmType": 10800,
  36360. "alarmName": "移动侦测报警",
  36361. "alarmTime": 1620899467000
  36362. }, {
  36363. "alarmType": 10800,
  36364. "alarmName": "移动侦测报警",
  36365. "alarmTime": 1620899406000
  36366. }, {
  36367. "alarmType": 10800,
  36368. "alarmName": "移动侦测报警",
  36369. "alarmTime": 1620899265000
  36370. }, {
  36371. "alarmType": 10800,
  36372. "alarmName": "移动侦测报警",
  36373. "alarmTime": 1620899211000
  36374. }, {
  36375. "alarmType": 10800,
  36376. "alarmName": "移动侦测报警",
  36377. "alarmTime": 1620899140000
  36378. }, {
  36379. "alarmType": 10800,
  36380. "alarmName": "移动侦测报警",
  36381. "alarmTime": 1620899110000
  36382. }, {
  36383. "alarmType": 10800,
  36384. "alarmName": "移动侦测报警",
  36385. "alarmTime": 1620899050000
  36386. }, {
  36387. "alarmType": 10800,
  36388. "alarmName": "移动侦测报警",
  36389. "alarmTime": 1620898991000
  36390. }, {
  36391. "alarmType": 10800,
  36392. "alarmName": "移动侦测报警",
  36393. "alarmTime": 1620898926000
  36394. }, {
  36395. "alarmType": 10800,
  36396. "alarmName": "移动侦测报警",
  36397. "alarmTime": 1620898834000
  36398. }, {
  36399. "alarmType": 10800,
  36400. "alarmName": "移动侦测报警",
  36401. "alarmTime": 1620898785000
  36402. }, {
  36403. "alarmType": 10800,
  36404. "alarmName": "移动侦测报警",
  36405. "alarmTime": 1620898746000
  36406. }, {
  36407. "alarmType": 10800,
  36408. "alarmName": "移动侦测报警",
  36409. "alarmTime": 1620898697000
  36410. }, {
  36411. "alarmType": 10800,
  36412. "alarmName": "移动侦测报警",
  36413. "alarmTime": 1620898666000
  36414. }, {
  36415. "alarmType": 10800,
  36416. "alarmName": "移动侦测报警",
  36417. "alarmTime": 1620898507000
  36418. }, {
  36419. "alarmType": 10800,
  36420. "alarmName": "移动侦测报警",
  36421. "alarmTime": 1620898293000
  36422. }, {
  36423. "alarmType": 10800,
  36424. "alarmName": "移动侦测报警",
  36425. "alarmTime": 1620898248000
  36426. }, {
  36427. "alarmType": 10800,
  36428. "alarmName": "移动侦测报警",
  36429. "alarmTime": 1620898218000
  36430. }, {
  36431. "alarmType": 10800,
  36432. "alarmName": "移动侦测报警",
  36433. "alarmTime": 1620898157000
  36434. }, {
  36435. "alarmType": 10800,
  36436. "alarmName": "移动侦测报警",
  36437. "alarmTime": 1620898088000
  36438. }, {
  36439. "alarmType": 10800,
  36440. "alarmName": "移动侦测报警",
  36441. "alarmTime": 1620898020000
  36442. }, {
  36443. "alarmType": 10800,
  36444. "alarmName": "移动侦测报警",
  36445. "alarmTime": 1620897960000
  36446. }, {
  36447. "alarmType": 10800,
  36448. "alarmName": "移动侦测报警",
  36449. "alarmTime": 1620897850000
  36450. }, {
  36451. "alarmType": 10800,
  36452. "alarmName": "移动侦测报警",
  36453. "alarmTime": 1620897807000
  36454. }, {
  36455. "alarmType": 10800,
  36456. "alarmName": "移动侦测报警",
  36457. "alarmTime": 1620897771000
  36458. }, {
  36459. "alarmType": 10800,
  36460. "alarmName": "移动侦测报警",
  36461. "alarmTime": 1620897719000
  36462. }, {
  36463. "alarmType": 10800,
  36464. "alarmName": "移动侦测报警",
  36465. "alarmTime": 1620897690000
  36466. }, {
  36467. "alarmType": 10800,
  36468. "alarmName": "移动侦测报警",
  36469. "alarmTime": 1620897630000
  36470. }, {
  36471. "alarmType": 10800,
  36472. "alarmName": "移动侦测报警",
  36473. "alarmTime": 1620897600000
  36474. }, {
  36475. "alarmType": 10800,
  36476. "alarmName": "移动侦测报警",
  36477. "alarmTime": 1620897570000
  36478. }, {
  36479. "alarmType": 10800,
  36480. "alarmName": "移动侦测报警",
  36481. "alarmTime": 1620897540000
  36482. }, {
  36483. "alarmType": 10800,
  36484. "alarmName": "移动侦测报警",
  36485. "alarmTime": 1620897475000
  36486. }, {
  36487. "alarmType": 10800,
  36488. "alarmName": "移动侦测报警",
  36489. "alarmTime": 1620897412000
  36490. }, {
  36491. "alarmType": 10800,
  36492. "alarmName": "移动侦测报警",
  36493. "alarmTime": 1620897369000
  36494. }, {
  36495. "alarmType": 10800,
  36496. "alarmName": "移动侦测报警",
  36497. "alarmTime": 1620897339000
  36498. }, {
  36499. "alarmType": 10800,
  36500. "alarmName": "移动侦测报警",
  36501. "alarmTime": 1620897279000
  36502. }, {
  36503. "alarmType": 10800,
  36504. "alarmName": "移动侦测报警",
  36505. "alarmTime": 1620897237000
  36506. }, {
  36507. "alarmType": 10800,
  36508. "alarmName": "移动侦测报警",
  36509. "alarmTime": 1620897207000
  36510. }, {
  36511. "alarmType": 10800,
  36512. "alarmName": "移动侦测报警",
  36513. "alarmTime": 1620897172000
  36514. }, {
  36515. "alarmType": 10800,
  36516. "alarmName": "移动侦测报警",
  36517. "alarmTime": 1620897142000
  36518. }, {
  36519. "alarmType": 10800,
  36520. "alarmName": "移动侦测报警",
  36521. "alarmTime": 1620897112000
  36522. }, {
  36523. "alarmType": 10800,
  36524. "alarmName": "移动侦测报警",
  36525. "alarmTime": 1620897024000
  36526. }, {
  36527. "alarmType": 10800,
  36528. "alarmName": "移动侦测报警",
  36529. "alarmTime": 1620896985000
  36530. }, {
  36531. "alarmType": 10800,
  36532. "alarmName": "移动侦测报警",
  36533. "alarmTime": 1620896874000
  36534. }, {
  36535. "alarmType": 10800,
  36536. "alarmName": "移动侦测报警",
  36537. "alarmTime": 1620896843000
  36538. }, {
  36539. "alarmType": 10800,
  36540. "alarmName": "移动侦测报警",
  36541. "alarmTime": 1620896814000
  36542. }, {
  36543. "alarmType": 10800,
  36544. "alarmName": "移动侦测报警",
  36545. "alarmTime": 1620896783000
  36546. }, {
  36547. "alarmType": 10800,
  36548. "alarmName": "移动侦测报警",
  36549. "alarmTime": 1620896736000
  36550. }, {
  36551. "alarmType": 10800,
  36552. "alarmName": "移动侦测报警",
  36553. "alarmTime": 1620896621000
  36554. }, {
  36555. "alarmType": 10800,
  36556. "alarmName": "移动侦测报警",
  36557. "alarmTime": 1620896478000
  36558. }, {
  36559. "alarmType": 10800,
  36560. "alarmName": "移动侦测报警",
  36561. "alarmTime": 1620896447000
  36562. }, {
  36563. "alarmType": 10800,
  36564. "alarmName": "移动侦测报警",
  36565. "alarmTime": 1620896358000
  36566. }, {
  36567. "alarmType": 10800,
  36568. "alarmName": "移动侦测报警",
  36569. "alarmTime": 1620896307000
  36570. }, {
  36571. "alarmType": 10800,
  36572. "alarmName": "移动侦测报警",
  36573. "alarmTime": 1620896277000
  36574. }, {
  36575. "alarmType": 10800,
  36576. "alarmName": "移动侦测报警",
  36577. "alarmTime": 1620896247000
  36578. }, {
  36579. "alarmType": 10800,
  36580. "alarmName": "移动侦测报警",
  36581. "alarmTime": 1620896214000
  36582. }, {
  36583. "alarmType": 10800,
  36584. "alarmName": "移动侦测报警",
  36585. "alarmTime": 1620896040000
  36586. }, {
  36587. "alarmType": 10800,
  36588. "alarmName": "移动侦测报警",
  36589. "alarmTime": 1620895953000
  36590. }, {
  36591. "alarmType": 10800,
  36592. "alarmName": "移动侦测报警",
  36593. "alarmTime": 1620895921000
  36594. }, {
  36595. "alarmType": 10800,
  36596. "alarmName": "移动侦测报警",
  36597. "alarmTime": 1620895868000
  36598. }, {
  36599. "alarmType": 10800,
  36600. "alarmName": "移动侦测报警",
  36601. "alarmTime": 1620895770000
  36602. }, {
  36603. "alarmType": 10800,
  36604. "alarmName": "移动侦测报警",
  36605. "alarmTime": 1620895704000
  36606. }, {
  36607. "alarmType": 10800,
  36608. "alarmName": "移动侦测报警",
  36609. "alarmTime": 1620895590000
  36610. }, {
  36611. "alarmType": 10800,
  36612. "alarmName": "移动侦测报警",
  36613. "alarmTime": 1620895559000
  36614. }, {
  36615. "alarmType": 10800,
  36616. "alarmName": "移动侦测报警",
  36617. "alarmTime": 1620895480000
  36618. }, {
  36619. "alarmType": 10800,
  36620. "alarmName": "移动侦测报警",
  36621. "alarmTime": 1620895442000
  36622. }, {
  36623. "alarmType": 10800,
  36624. "alarmName": "移动侦测报警",
  36625. "alarmTime": 1620895377000
  36626. }, {
  36627. "alarmType": 10800,
  36628. "alarmName": "移动侦测报警",
  36629. "alarmTime": 1620895347000
  36630. }, {
  36631. "alarmType": 10800,
  36632. "alarmName": "移动侦测报警",
  36633. "alarmTime": 1620895293000
  36634. }, {
  36635. "alarmType": 10800,
  36636. "alarmName": "移动侦测报警",
  36637. "alarmTime": 1620895171000
  36638. }, {
  36639. "alarmType": 10800,
  36640. "alarmName": "移动侦测报警",
  36641. "alarmTime": 1620895136000
  36642. }, {
  36643. "alarmType": 10800,
  36644. "alarmName": "移动侦测报警",
  36645. "alarmTime": 1620895017000
  36646. }, {
  36647. "alarmType": 10800,
  36648. "alarmName": "移动侦测报警",
  36649. "alarmTime": 1620894926000
  36650. }, {
  36651. "alarmType": 10800,
  36652. "alarmName": "移动侦测报警",
  36653. "alarmTime": 1620894896000
  36654. }, {
  36655. "alarmType": 10800,
  36656. "alarmName": "移动侦测报警",
  36657. "alarmTime": 1620894864000
  36658. }, {
  36659. "alarmType": 10800,
  36660. "alarmName": "移动侦测报警",
  36661. "alarmTime": 1620894834000
  36662. }, {
  36663. "alarmType": 10800,
  36664. "alarmName": "移动侦测报警",
  36665. "alarmTime": 1620894738000
  36666. }, {
  36667. "alarmType": 10800,
  36668. "alarmName": "移动侦测报警",
  36669. "alarmTime": 1620894599000
  36670. }, {
  36671. "alarmType": 10800,
  36672. "alarmName": "移动侦测报警",
  36673. "alarmTime": 1620894539000
  36674. }, {
  36675. "alarmType": 10800,
  36676. "alarmName": "移动侦测报警",
  36677. "alarmTime": 1620894426000
  36678. }, {
  36679. "alarmType": 10800,
  36680. "alarmName": "移动侦测报警",
  36681. "alarmTime": 1620894359000
  36682. }, {
  36683. "alarmType": 10800,
  36684. "alarmName": "移动侦测报警",
  36685. "alarmTime": 1620894297000
  36686. }, {
  36687. "alarmType": 10800,
  36688. "alarmName": "移动侦测报警",
  36689. "alarmTime": 1620894213000
  36690. }, {
  36691. "alarmType": 10800,
  36692. "alarmName": "移动侦测报警",
  36693. "alarmTime": 1620894183000
  36694. }, {
  36695. "alarmType": 10800,
  36696. "alarmName": "移动侦测报警",
  36697. "alarmTime": 1620894051000
  36698. }, {
  36699. "alarmType": 10800,
  36700. "alarmName": "移动侦测报警",
  36701. "alarmTime": 1620893964000
  36702. }, {
  36703. "alarmType": 10800,
  36704. "alarmName": "移动侦测报警",
  36705. "alarmTime": 1620893934000
  36706. }, {
  36707. "alarmType": 10800,
  36708. "alarmName": "移动侦测报警",
  36709. "alarmTime": 1620893843000
  36710. }, {
  36711. "alarmType": 10800,
  36712. "alarmName": "移动侦测报警",
  36713. "alarmTime": 1620893754000
  36714. }, {
  36715. "alarmType": 10800,
  36716. "alarmName": "移动侦测报警",
  36717. "alarmTime": 1620893676000
  36718. }, {
  36719. "alarmType": 10800,
  36720. "alarmName": "移动侦测报警",
  36721. "alarmTime": 1620893606000
  36722. }, {
  36723. "alarmType": 10800,
  36724. "alarmName": "移动侦测报警",
  36725. "alarmTime": 1620893530000
  36726. }, {
  36727. "alarmType": 10800,
  36728. "alarmName": "移动侦测报警",
  36729. "alarmTime": 1620893452000
  36730. }, {
  36731. "alarmType": 10800,
  36732. "alarmName": "移动侦测报警",
  36733. "alarmTime": 1620893423000
  36734. }, {
  36735. "alarmType": 10800,
  36736. "alarmName": "移动侦测报警",
  36737. "alarmTime": 1620893357000
  36738. }, {
  36739. "alarmType": 10800,
  36740. "alarmName": "移动侦测报警",
  36741. "alarmTime": 1620893288000
  36742. }, {
  36743. "alarmType": 10800,
  36744. "alarmName": "移动侦测报警",
  36745. "alarmTime": 1620893143000
  36746. }, {
  36747. "alarmType": 10800,
  36748. "alarmName": "移动侦测报警",
  36749. "alarmTime": 1620893051000
  36750. }, {
  36751. "alarmType": 10800,
  36752. "alarmName": "移动侦测报警",
  36753. "alarmTime": 1620893006000
  36754. }, {
  36755. "alarmType": 10800,
  36756. "alarmName": "移动侦测报警",
  36757. "alarmTime": 1620892904000
  36758. }, {
  36759. "alarmType": 10800,
  36760. "alarmName": "移动侦测报警",
  36761. "alarmTime": 1620892824000
  36762. }, {
  36763. "alarmType": 10800,
  36764. "alarmName": "移动侦测报警",
  36765. "alarmTime": 1620892764000
  36766. }, {
  36767. "alarmType": 10800,
  36768. "alarmName": "移动侦测报警",
  36769. "alarmTime": 1620892541000
  36770. }, {
  36771. "alarmType": 10800,
  36772. "alarmName": "移动侦测报警",
  36773. "alarmTime": 1620892479000
  36774. }, {
  36775. "alarmType": 10800,
  36776. "alarmName": "移动侦测报警",
  36777. "alarmTime": 1620892412000
  36778. }, {
  36779. "alarmType": 10800,
  36780. "alarmName": "移动侦测报警",
  36781. "alarmTime": 1620892311000
  36782. }, {
  36783. "alarmType": 10800,
  36784. "alarmName": "移动侦测报警",
  36785. "alarmTime": 1620892281000
  36786. }, {
  36787. "alarmType": 10800,
  36788. "alarmName": "移动侦测报警",
  36789. "alarmTime": 1620892209000
  36790. }, {
  36791. "alarmType": 10800,
  36792. "alarmName": "移动侦测报警",
  36793. "alarmTime": 1620892063000
  36794. }, {
  36795. "alarmType": 10800,
  36796. "alarmName": "移动侦测报警",
  36797. "alarmTime": 1620891991000
  36798. }, {
  36799. "alarmType": 10800,
  36800. "alarmName": "移动侦测报警",
  36801. "alarmTime": 1620891931000
  36802. }, {
  36803. "alarmType": 10800,
  36804. "alarmName": "移动侦测报警",
  36805. "alarmTime": 1620891870000
  36806. }, {
  36807. "alarmType": 10800,
  36808. "alarmName": "移动侦测报警",
  36809. "alarmTime": 1620891810000
  36810. }, {
  36811. "alarmType": 10800,
  36812. "alarmName": "移动侦测报警",
  36813. "alarmTime": 1620891708000
  36814. }, {
  36815. "alarmType": 10800,
  36816. "alarmName": "移动侦测报警",
  36817. "alarmTime": 1620891655000
  36818. }, {
  36819. "alarmType": 10800,
  36820. "alarmName": "移动侦测报警",
  36821. "alarmTime": 1620891585000
  36822. }, {
  36823. "alarmType": 10800,
  36824. "alarmName": "移动侦测报警",
  36825. "alarmTime": 1620891531000
  36826. }, {
  36827. "alarmType": 10800,
  36828. "alarmName": "移动侦测报警",
  36829. "alarmTime": 1620891501000
  36830. }, {
  36831. "alarmType": 10800,
  36832. "alarmName": "移动侦测报警",
  36833. "alarmTime": 1620891401000
  36834. }, {
  36835. "alarmType": 10800,
  36836. "alarmName": "移动侦测报警",
  36837. "alarmTime": 1620891297000
  36838. }, {
  36839. "alarmType": 10800,
  36840. "alarmName": "移动侦测报警",
  36841. "alarmTime": 1620891257000
  36842. }, {
  36843. "alarmType": 10800,
  36844. "alarmName": "移动侦测报警",
  36845. "alarmTime": 1620891216000
  36846. }, {
  36847. "alarmType": 10800,
  36848. "alarmName": "移动侦测报警",
  36849. "alarmTime": 1620891178000
  36850. }, {
  36851. "alarmType": 10800,
  36852. "alarmName": "移动侦测报警",
  36853. "alarmTime": 1620891128000
  36854. }, {
  36855. "alarmType": 10800,
  36856. "alarmName": "移动侦测报警",
  36857. "alarmTime": 1620891033000
  36858. }, {
  36859. "alarmType": 10800,
  36860. "alarmName": "移动侦测报警",
  36861. "alarmTime": 1620890973000
  36862. }, {
  36863. "alarmType": 10800,
  36864. "alarmName": "移动侦测报警",
  36865. "alarmTime": 1620890940000
  36866. }, {
  36867. "alarmType": 10800,
  36868. "alarmName": "移动侦测报警",
  36869. "alarmTime": 1620890879000
  36870. }, {
  36871. "alarmType": 10800,
  36872. "alarmName": "移动侦测报警",
  36873. "alarmTime": 1620890794000
  36874. }, {
  36875. "alarmType": 10800,
  36876. "alarmName": "移动侦测报警",
  36877. "alarmTime": 1620890714000
  36878. }, {
  36879. "alarmType": 10800,
  36880. "alarmName": "移动侦测报警",
  36881. "alarmTime": 1620890616000
  36882. }, {
  36883. "alarmType": 10800,
  36884. "alarmName": "移动侦测报警",
  36885. "alarmTime": 1620890586000
  36886. }, {
  36887. "alarmType": 10800,
  36888. "alarmName": "移动侦测报警",
  36889. "alarmTime": 1620890469000
  36890. }, {
  36891. "alarmType": 10800,
  36892. "alarmName": "移动侦测报警",
  36893. "alarmTime": 1620890414000
  36894. }, {
  36895. "alarmType": 10800,
  36896. "alarmName": "移动侦测报警",
  36897. "alarmTime": 1620890346000
  36898. }, {
  36899. "alarmType": 10800,
  36900. "alarmName": "移动侦测报警",
  36901. "alarmTime": 1620890288000
  36902. }, {
  36903. "alarmType": 10800,
  36904. "alarmName": "移动侦测报警",
  36905. "alarmTime": 1620890179000
  36906. }, {
  36907. "alarmType": 10800,
  36908. "alarmName": "移动侦测报警",
  36909. "alarmTime": 1620890108000
  36910. }, {
  36911. "alarmType": 10800,
  36912. "alarmName": "移动侦测报警",
  36913. "alarmTime": 1620890041000
  36914. }, {
  36915. "alarmType": 10800,
  36916. "alarmName": "移动侦测报警",
  36917. "alarmTime": 1620890011000
  36918. }, {
  36919. "alarmType": 10800,
  36920. "alarmName": "移动侦测报警",
  36921. "alarmTime": 1620889937000
  36922. }, {
  36923. "alarmType": 10800,
  36924. "alarmName": "移动侦测报警",
  36925. "alarmTime": 1620889719000
  36926. }, {
  36927. "alarmType": 10800,
  36928. "alarmName": "移动侦测报警",
  36929. "alarmTime": 1620889635000
  36930. }, {
  36931. "alarmType": 10800,
  36932. "alarmName": "移动侦测报警",
  36933. "alarmTime": 1620889481000
  36934. }, {
  36935. "alarmType": 10800,
  36936. "alarmName": "移动侦测报警",
  36937. "alarmTime": 1620889451000
  36938. }, {
  36939. "alarmType": 10800,
  36940. "alarmName": "移动侦测报警",
  36941. "alarmTime": 1620889317000
  36942. }, {
  36943. "alarmType": 10800,
  36944. "alarmName": "移动侦测报警",
  36945. "alarmTime": 1620889227000
  36946. }, {
  36947. "alarmType": 10800,
  36948. "alarmName": "移动侦测报警",
  36949. "alarmTime": 1620889139000
  36950. }, {
  36951. "alarmType": 10800,
  36952. "alarmName": "移动侦测报警",
  36953. "alarmTime": 1620889034000
  36954. }, {
  36955. "alarmType": 10800,
  36956. "alarmName": "移动侦测报警",
  36957. "alarmTime": 1620888973000
  36958. }, {
  36959. "alarmType": 10800,
  36960. "alarmName": "移动侦测报警",
  36961. "alarmTime": 1620888902000
  36962. }, {
  36963. "alarmType": 10800,
  36964. "alarmName": "移动侦测报警",
  36965. "alarmTime": 1620888837000
  36966. }, {
  36967. "alarmType": 10800,
  36968. "alarmName": "移动侦测报警",
  36969. "alarmTime": 1620888767000
  36970. }, {
  36971. "alarmType": 10800,
  36972. "alarmName": "移动侦测报警",
  36973. "alarmTime": 1620888737000
  36974. }, {
  36975. "alarmType": 10800,
  36976. "alarmName": "移动侦测报警",
  36977. "alarmTime": 1620888706000
  36978. }, {
  36979. "alarmType": 10800,
  36980. "alarmName": "移动侦测报警",
  36981. "alarmTime": 1620888633000
  36982. }, {
  36983. "alarmType": 10800,
  36984. "alarmName": "移动侦测报警",
  36985. "alarmTime": 1620888571000
  36986. }, {
  36987. "alarmType": 10800,
  36988. "alarmName": "移动侦测报警",
  36989. "alarmTime": 1620888413000
  36990. }, {
  36991. "alarmType": 10800,
  36992. "alarmName": "移动侦测报警",
  36993. "alarmTime": 1620888353000
  36994. }, {
  36995. "alarmType": 10800,
  36996. "alarmName": "移动侦测报警",
  36997. "alarmTime": 1620888323000
  36998. }, {
  36999. "alarmType": 10800,
  37000. "alarmName": "移动侦测报警",
  37001. "alarmTime": 1620888249000
  37002. }, {
  37003. "alarmType": 10800,
  37004. "alarmName": "移动侦测报警",
  37005. "alarmTime": 1620888162000
  37006. }, {
  37007. "alarmType": 10800,
  37008. "alarmName": "移动侦测报警",
  37009. "alarmTime": 1620888000000
  37010. }, {
  37011. "alarmType": 10800,
  37012. "alarmName": "移动侦测报警",
  37013. "alarmTime": 1620887859000
  37014. }, {
  37015. "alarmType": 10800,
  37016. "alarmName": "移动侦测报警",
  37017. "alarmTime": 1620887776000
  37018. }, {
  37019. "alarmType": 10800,
  37020. "alarmName": "移动侦测报警",
  37021. "alarmTime": 1620887734000
  37022. }, {
  37023. "alarmType": 10800,
  37024. "alarmName": "移动侦测报警",
  37025. "alarmTime": 1620887692000
  37026. }, {
  37027. "alarmType": 10800,
  37028. "alarmName": "移动侦测报警",
  37029. "alarmTime": 1620887619000
  37030. }, {
  37031. "alarmType": 10800,
  37032. "alarmName": "移动侦测报警",
  37033. "alarmTime": 1620887501000
  37034. }, {
  37035. "alarmType": 10800,
  37036. "alarmName": "移动侦测报警",
  37037. "alarmTime": 1620887355000
  37038. }, {
  37039. "alarmType": 10800,
  37040. "alarmName": "移动侦测报警",
  37041. "alarmTime": 1620887320000
  37042. }, {
  37043. "alarmType": 10800,
  37044. "alarmName": "移动侦测报警",
  37045. "alarmTime": 1620887289000
  37046. }, {
  37047. "alarmType": 10800,
  37048. "alarmName": "移动侦测报警",
  37049. "alarmTime": 1620887126000
  37050. }, {
  37051. "alarmType": 10800,
  37052. "alarmName": "移动侦测报警",
  37053. "alarmTime": 1620887066000
  37054. }, {
  37055. "alarmType": 10800,
  37056. "alarmName": "移动侦测报警",
  37057. "alarmTime": 1620887034000
  37058. }, {
  37059. "alarmType": 10800,
  37060. "alarmName": "移动侦测报警",
  37061. "alarmTime": 1620886970000
  37062. }, {
  37063. "alarmType": 10800,
  37064. "alarmName": "移动侦测报警",
  37065. "alarmTime": 1620886884000
  37066. }, {
  37067. "alarmType": 10800,
  37068. "alarmName": "移动侦测报警",
  37069. "alarmTime": 1620886804000
  37070. }, {
  37071. "alarmType": 10800,
  37072. "alarmName": "移动侦测报警",
  37073. "alarmTime": 1620886728000
  37074. }, {
  37075. "alarmType": 10800,
  37076. "alarmName": "移动侦测报警",
  37077. "alarmTime": 1620886609000
  37078. }, {
  37079. "alarmType": 10800,
  37080. "alarmName": "移动侦测报警",
  37081. "alarmTime": 1620886538000
  37082. }, {
  37083. "alarmType": 10800,
  37084. "alarmName": "移动侦测报警",
  37085. "alarmTime": 1620886478000
  37086. }, {
  37087. "alarmType": 10800,
  37088. "alarmName": "移动侦测报警",
  37089. "alarmTime": 1620886396000
  37090. }, {
  37091. "alarmType": 10800,
  37092. "alarmName": "移动侦测报警",
  37093. "alarmTime": 1620886334000
  37094. }, {
  37095. "alarmType": 10800,
  37096. "alarmName": "移动侦测报警",
  37097. "alarmTime": 1620886246000
  37098. }, {
  37099. "alarmType": 10800,
  37100. "alarmName": "移动侦测报警",
  37101. "alarmTime": 1620886111000
  37102. }, {
  37103. "alarmType": 10800,
  37104. "alarmName": "移动侦测报警",
  37105. "alarmTime": 1620886011000
  37106. }, {
  37107. "alarmType": 10800,
  37108. "alarmName": "移动侦测报警",
  37109. "alarmTime": 1620885956000
  37110. }, {
  37111. "alarmType": 10800,
  37112. "alarmName": "移动侦测报警",
  37113. "alarmTime": 1620885894000
  37114. }, {
  37115. "alarmType": 10800,
  37116. "alarmName": "移动侦测报警",
  37117. "alarmTime": 1620885696000
  37118. }, {
  37119. "alarmType": 10800,
  37120. "alarmName": "移动侦测报警",
  37121. "alarmTime": 1620885514000
  37122. }, {
  37123. "alarmType": 10800,
  37124. "alarmName": "移动侦测报警",
  37125. "alarmTime": 1620885484000
  37126. }, {
  37127. "alarmType": 10800,
  37128. "alarmName": "移动侦测报警",
  37129. "alarmTime": 1620885414000
  37130. }, {
  37131. "alarmType": 10800,
  37132. "alarmName": "移动侦测报警",
  37133. "alarmTime": 1620885383000
  37134. }, {
  37135. "alarmType": 10800,
  37136. "alarmName": "移动侦测报警",
  37137. "alarmTime": 1620885341000
  37138. }, {
  37139. "alarmType": 10800,
  37140. "alarmName": "移动侦测报警",
  37141. "alarmTime": 1620885306000
  37142. }, {
  37143. "alarmType": 10800,
  37144. "alarmName": "移动侦测报警",
  37145. "alarmTime": 1620885276000
  37146. }, {
  37147. "alarmType": 10800,
  37148. "alarmName": "移动侦测报警",
  37149. "alarmTime": 1620885216000
  37150. }, {
  37151. "alarmType": 10800,
  37152. "alarmName": "移动侦测报警",
  37153. "alarmTime": 1620885186000
  37154. }, {
  37155. "alarmType": 10800,
  37156. "alarmName": "移动侦测报警",
  37157. "alarmTime": 1620885114000
  37158. }, {
  37159. "alarmType": 10800,
  37160. "alarmName": "移动侦测报警",
  37161. "alarmTime": 1620885037000
  37162. }, {
  37163. "alarmType": 10800,
  37164. "alarmName": "移动侦测报警",
  37165. "alarmTime": 1620885006000
  37166. }, {
  37167. "alarmType": 10800,
  37168. "alarmName": "移动侦测报警",
  37169. "alarmTime": 1620884975000
  37170. }, {
  37171. "alarmType": 10800,
  37172. "alarmName": "移动侦测报警",
  37173. "alarmTime": 1620884945000
  37174. }, {
  37175. "alarmType": 10800,
  37176. "alarmName": "移动侦测报警",
  37177. "alarmTime": 1620884911000
  37178. }, {
  37179. "alarmType": 10800,
  37180. "alarmName": "移动侦测报警",
  37181. "alarmTime": 1620884851000
  37182. }, {
  37183. "alarmType": 10800,
  37184. "alarmName": "移动侦测报警",
  37185. "alarmTime": 1620884780000
  37186. }, {
  37187. "alarmType": 10800,
  37188. "alarmName": "移动侦测报警",
  37189. "alarmTime": 1620884696000
  37190. }],
  37191. "success": true
  37192. }
  37193. };
  37194. console.log(res);
  37195. //let res = {"request":{"body":{"alarmTypes":[10800,0,0,0,0],"channelId":"066dde0465dd4abaab6afe355baf9d0b","endTime":"1621007999000","startTime":"1620921600000"},"callBack":"GetAlarmMsgOrders","majorKey":"","method":"POST","storeId":"","url":"/videoplugin/message/getMessageByTypes"},"response":{"code":0,"message":null,"data":[{"alarmType":10800,"alarmName":"移动侦测报警","alarmTime":1620864635000},{"alarmType":10800,"alarmName":"移动侦测报警","alarmTime":1620840908000}],"success":true}}
  37196. oWebControl.JS_RequestInterface({
  37197. funcName: 'TransFunctionResult',
  37198. arguments: encodeURI(JSON.stringify(res))
  37199. });
  37200. //.JS_RequestInterface({funcName: 'TransFunctionResult', arguments: {
  37201. // response: res
  37202. //}})
  37203. }
  37204. }]);
  37205. return EZUIKitHD;
  37206. }();
  37207. (function (global, factory) {
  37208. if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  37209. module.exports = global.document ? factory(global, true) : function (w) {
  37210. if (!w.document) {
  37211. throw new Error("EZUIPlayer requires a window with a document");
  37212. }
  37213. return factory(w);
  37214. };
  37215. } else {
  37216. factory(global);
  37217. }
  37218. // Pass this if window is not defined yet
  37219. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  37220. var EZUIKit = {
  37221. Core: Core,
  37222. HLS: HLS,
  37223. FLV: FLV,
  37224. EZUIKitPlayer: EZUIKitPlayer,
  37225. EZUIKitHD: EZUIKitHD
  37226. };
  37227. window.EZUIKit = EZUIKit;
  37228. return EZUIKit;
  37229. });