12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627 |
- 'use strict';
- function _typeof(obj) {
- "@babel/helpers - typeof";
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- }, _typeof(obj);
- }
- function _classCallCheck$1(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass$1(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var Core = /*#__PURE__*/function () {
- function Core(x, y) {
- _classCallCheck$1(this, Core);
- this.coreX = x;
- this.coreY = y;
- }
- _createClass$1(Core, [{
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }]);
- return Core;
- }();
- // eslint-disable-next-line no-extend-native
- Date.prototype.Format = function (fmt) {
- var o = {
- "M+": this.getMonth() + 1,
- "d+": this.getDate(),
- "h+": this.getHours(),
- "m+": this.getMinutes(),
- "s+": this.getSeconds(),
- "q+": Math.floor((this.getMonth() + 3) / 3),
- "S": this.getMilliseconds()
- };
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
- }
- return fmt;
- };
- // 加载js
- var addJs = function addJs(filepath, callback, isReadyFun) {
- var headerScript = document.getElementsByTagName('head')[0].getElementsByTagName("script");
- var isReady = false;
- if (isReadyFun) {
- isReady = isReadyFun();
- } else {
- for (var i = 0; i < headerScript.length; i++) {
- if (headerScript[i].getAttribute("src") == filepath) {
- isReady = true;
- callback();
- }
- }
- }
- if (!isReady) {
- var oJs = document.createElement("script");
- oJs.setAttribute("src", filepath);
- oJs.setAttribute("crossorigin", true);
- oJs.onload = callback;
- document.getElementsByTagName("head")[0].appendChild(oJs);
- } else {
- callback();
- }
- };
- var addCss = function addCss(filepath, callback) {
- var headerLink = document.getElementsByTagName('head')[0].getElementsByTagName("link");
- var isReady = false;
- for (var i = 0; i < headerLink.length; i++) {
- if (headerLink[i].getAttribute("href") == filepath) {
- isReady = true;
- }
- }
- if (!isReady) {
- var oJs = document.createElement('link');
- oJs.rel = 'stylesheet';
- oJs.type = 'text/css';
- oJs.href = filepath;
- oJs.onload = callback;
- document.getElementsByTagName("head")[0].appendChild(oJs);
- }
- };
- var isPromise = function isPromise(obj) {
- return !!obj && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- };
- var getQueryString = function getQueryString(name, url) {
- var r = new RegExp("(\\?|#|&)" + name + "=(.*?)(#|&|$)");
- var m = (url || window.location.href).match(r);
- return decodeURIComponent(m ? m[2] : '');
- };
- var insertAfter$1 = function insertAfter(newElement, targetElement) {
- var parent = targetElement.parentNode;
- if (parent.lastChild == targetElement) {
- parent.appendChild(newElement);
- } else {
- parent.insertBefore(newElement, targetElement.nextSibling);
- }
- };
- var requestFullScreen = function requestFullScreen(element) {
- console.log("requestFullScreen", document.getElementById(element));
- var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
- if (requestMethod) {
- requestMethod.call(element);
- } else if (typeof window.ActiveXObject !== "undefined") {
- var wscript = new window.ActiveXObject("WScript.Shell");
- if (wscript !== null) {
- wscript.SendKeys("{F11}");
- }
- }
- };
- var requestMobileFullScreen = function requestMobileFullScreen(element) {
- var width = document.documentElement.clientWidth;
- var height = document.documentElement.clientHeight;
- var wrapper = element;
- var style = "";
- style += "width:" + height + "px;"; // 注意旋转后的宽高切换
- style += "height:" + width + "px;";
- style += "-webkit-transform: rotate(90.001deg); transform: rotate(90.001deg);";
- // 注意旋转中点的处理
- style += "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
- style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
- style += 'position: fixed;top: 0;left: 0;z-index:10';
- wrapper.style.cssText = style;
- };
- var requestFullScreenPromise = function requestFullScreenPromise(element) {
- requestFullScreen(element);
- var promise = new Promise(function (resolve, reject) {
- var timeInterval = setInterval(function () {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (isFullScreen) {
- clearInterval(timeInterval);
- return resolve(true);
- }
- }, 100);
- var timeOut = setTimeout(function () {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (!isFullScreen) {
- reject(false);
- }
- clearTimeout(timeOut);
- }, 2000);
- });
- return promise;
- };
- var cancelMobileFullScreen = function cancelMobileFullScreen(element, width, height) {
- var style = "";
- style += "width:" + width + "px;";
- style += "height:" + height + "px;";
- style += "-webkit-transform: none; transform: none;";
- style += "-webkit-transform-origin: 0 0;";
- style += "transform-origin: 0 0;";
- element.style.cssText = style;
- };
- var cancelFullScreen = function cancelFullScreen() {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.webkitCancelFullScreen) {
- document.webkitCancelFullScreen();
- } else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- }
- };
- var cancelFullScreenPromise = function cancelFullScreenPromise(element) {
- cancelFullScreen();
- var promise = new Promise(function (resolve, reject) {
- var timeInterval = setInterval(function () {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (!isFullScreen) {
- clearInterval(timeInterval);
- return resolve(true);
- }
- }, 50);
- var timeOut = setTimeout(function () {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (isFullScreen) {
- reject(false);
- }
- clearTimeout(timeOut);
- }, 2000);
- });
- return promise;
- };
- var matchEzopenUrl = function matchEzopenUrl(ezopenUrl) {
- var deviceSerial = ezopenUrl.split("/")[3];
- var channelNo = ezopenUrl.split("/")[4].split(".")[0];
- var validCode = ezopenUrl.split("/")[2].split("@").length === 2 ? ezopenUrl.split("/")[2].split("@")[0] : "";
- var hd = ezopenUrl.indexOf('.hd') !== -1;
- var type = ezopenUrl.split("/")[4].split(".")[ezopenUrl.split("/")[4].split(".").length - 1].split("?")[0];
- if (type === 'rec' && ezopenUrl.indexOf(".cloud.rec") !== -1) {
- type = 'cloud.rec';
- }
- return {
- deviceSerial: deviceSerial,
- channelNo: channelNo,
- validCode: validCode,
- hd: hd,
- type: type
- };
- };
- function isJSON(str) {
- if (typeof str === 'string') {
- try {
- var obj = JSON.parse(str);
- if (_typeof(obj) === 'object' && obj) {
- return true;
- }
- return false;
- } catch (e) {
- return false;
- }
- }
- console.log('It is not a string!');
- }
- var request = function request(url, method, params, header, success, error) {
- var _url = url;
- var http_request = new XMLHttpRequest();
- http_request.onreadystatechange = function () {
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
- if (isJSON(http_request.responseText)) {
- var _data = JSON.parse(http_request.responseText);
- success(_data);
- } else {
- success(http_request.responseText);
- }
- }
- }
- };
- http_request.open(method, _url, true);
- // http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- var data = new FormData();
- for (var i in params) {
- data.append(i, params[i]);
- }
- http_request.send(data);
- };
- var HLS = /*#__PURE__*/function () {
- function HLS(videoId, url) {
- var _this = this;
- _classCallCheck$1(this, HLS);
- addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js", function () {
- console.log("加载hls.min.js成功", window.Hls);
- console.log("isSupportHls", window.Hls.isSupported());
- if (window.Hls.isSupported()) {
- _this.initHLS(videoId, url);
- }
- }, function () {
- return !!window.Hls;
- });
- }
- _createClass$1(HLS, [{
- key: "toString",
- value: function toString() {
- return "hls ".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "initHLS",
- value: function initHLS(videoId, hlsUrl) {
- var video = document.getElementById(videoId);
- var hls = new window.Hls({
- defaultAudioCodec: 'mp4a.40.2'
- }); // 萤石设备默认使用 AAC LC 音频编码
- hls.loadSource(hlsUrl);
- hls.attachMedia(video);
- hls.on(window.Hls.Events.MANIFEST_PARSED, function () {
- video.play();
- });
- hls.on(window.Hls.Events.ERROR, function (event, data) {
- if (data.fatal) {
- switch (data.type) {
- case window.Hls.ErrorTypes.NETWORK_ERROR:
- // try to recover network error
- console.log("fatal network error encountered, try to recover");
- hls.startLoad();
- break;
- case window.Hls.ErrorTypes.MEDIA_ERROR:
- console.log("fatal media error encountered, try to recover");
- hls.recoverMediaError();
- break;
- default:
- // cannot recover
- hls.destroy();
- break;
- }
- }
- });
- this.hls = hls;
- this.video = video;
- this.hlsUrl = hlsUrl;
- }
- }, {
- key: "play",
- value: function play() {
- console.log("执行hls播放", this.video);
- this.hls.startLoad();
- // this.video.src = this.hlsUrl;
- this.video.play();
- }
- }, {
- key: "stop",
- value: function stop() {
- // 通过暂停停止播放
- // this.video.pause();
- // this.video.src = "";
- this.video.pause();
- // 停止取流
- this.hls.stopLoad();
- // this.hls.destroy();
- }
- }]);
- return HLS;
- }();
- var FLV = /*#__PURE__*/function () {
- function FLV(videoId, url) {
- var _this = this;
- _classCallCheck$1(this, FLV);
- addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/flv.min.js", function () {
- console.log("加载flv.min.js成功", window.flvjs);
- console.log("isSupportFlv", window.flvjs.isSupported());
- if (window.flvjs.isSupported()) {
- _this.initFLV(videoId, url);
- }
- });
- }
- _createClass$1(FLV, [{
- key: "toString",
- value: function toString() {
- return "Flv ".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "initFLV",
- value: function initFLV(videoId, flvUrl) {
- var video = document.getElementById(videoId);
- var hasControls = video.getAttribute('controls');
- if (!hasControls) {
- video.setAttribute('controls', true);
- }
- var flvPlayer = window.flvjs.createPlayer({
- type: 'flv',
- url: flvUrl,
- isLive: true
- }, {
- enableStashBuffer: true,
- stashInitialSize: 128,
- enableWorker: true
- });
- flvPlayer.attachMediaElement(video);
- flvPlayer.load();
- flvPlayer.play();
- this.flvUrl = flvUrl;
- this.flv = flvPlayer;
- this.video = video;
- }
- }, {
- key: "play",
- value: function play() {
- console.log("执行flv播放", this.video);
- this.video.play();
- }
- }, {
- key: "stop",
- value: function stop() {
- // 通过暂停停止播放
- // this.video.pause();
- // this.video.src = "";
- this.video.pause();
- // 停止取流
- this.flv.unload();
- // this.hls.destroy();
- }
- }]);
- return FLV;
- }();
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var lodash = createCommonjsModule(function (module, exports) {
- (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;/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */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;/**
- * Used to validate the `validate` option in `_.template` variable.
- *
- * Forbids characters which could potentially change the meaning of the function argument definition:
- * - "()," (modification of function parameters)
- * - "=" (default value)
- * - "[]{}" (destructuring of function parameters)
- * - "/" (beginning of a comment)
- * - whitespace
- */var reForbiddenIdentifierChars=/[()=,{}\[\]\/\s]/;/** Used to match backslashes in property paths. */var reEscapeChar=/\\(\\)?/g;/**
- * Used to match
- * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
- */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');/**
- * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
- * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
- */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.
- '\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.
- '\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={'&':'&','<':'<','>':'>','"':'"',"'":'''};/** Used to map HTML entities to characters. */var htmlUnescapes={'&':'&','<':'<','>':'>','"':'"',''':"'"};/** 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+.
- var types=freeModule&&freeModule.require&&freeModule.require('util').types;if(types){return types;}// Legacy `process.binding('util')` for Node.js < 10.
- 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;/*--------------------------------------------------------------------------*/ /**
- * A faster alternative to `Function#apply`, this function invokes `func`
- * with the `this` binding of `thisArg` and the arguments of `args`.
- *
- * @private
- * @param {Function} func The function to invoke.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {Array} args The arguments to invoke `func` with.
- * @returns {*} Returns the result of `func`.
- */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);}/**
- * A specialized version of `baseAggregator` for arrays.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} setter The function to set `accumulator` values.
- * @param {Function} iteratee The iteratee to transform keys.
- * @param {Object} accumulator The initial aggregated object.
- * @returns {Function} Returns `accumulator`.
- */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;}/**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */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;}/**
- * A specialized version of `_.forEachRight` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */function arrayEachRight(array,iteratee){var length=array==null?0:array.length;while(length--){if(iteratee(array[length],length,array)===false){break;}}return array;}/**
- * A specialized version of `_.every` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check,
- * else `false`.
- */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;}/**
- * A specialized version of `_.filter` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- */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;}/**
- * A specialized version of `_.includes` for arrays without support for
- * specifying an index to search from.
- *
- * @private
- * @param {Array} [array] The array to inspect.
- * @param {*} target The value to search for.
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
- */function arrayIncludes(array,value){var length=array==null?0:array.length;return !!length&&baseIndexOf(array,value,0)>-1;}/**
- * This function is like `arrayIncludes` except that it accepts a comparator.
- *
- * @private
- * @param {Array} [array] The array to inspect.
- * @param {*} target The value to search for.
- * @param {Function} comparator The comparator invoked per element.
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
- */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;}/**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */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;}/**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length){array[offset+index]=values[index];}return array;}/**
- * A specialized version of `_.reduce` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */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;}/**
- * A specialized version of `_.reduceRight` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the last element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */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;}/**
- * A specialized version of `_.some` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */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;}/**
- * Gets the size of an ASCII `string`.
- *
- * @private
- * @param {string} string The string inspect.
- * @returns {number} Returns the string size.
- */var asciiSize=baseProperty('length');/**
- * Converts an ASCII `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */function asciiToArray(string){return string.split('');}/**
- * Splits an ASCII `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */function asciiWords(string){return string.match(reAsciiWord)||[];}/**
- * The base implementation of methods like `_.findKey` and `_.findLastKey`,
- * without support for iteratee shorthands, which iterates over `collection`
- * using `eachFunc`.
- *
- * @private
- * @param {Array|Object} collection The collection to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {Function} eachFunc The function to iterate over `collection`.
- * @returns {*} Returns the found element or its key, else `undefined`.
- */function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key;return false;}});return result;}/**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */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;}/**
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex);}/**
- * This function is like `baseIndexOf` except that it accepts a comparator.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @param {Function} comparator The comparator invoked per element.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */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;}/**
- * The base implementation of `_.isNaN` without support for number objects.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
- */function baseIsNaN(value){return value!==value;}/**
- * The base implementation of `_.mean` and `_.meanBy` without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {number} Returns the mean.
- */function baseMean(array,iteratee){var length=array==null?0:array.length;return length?baseSum(array,iteratee)/length:NAN;}/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */function baseProperty(key){return function(object){return object==null?undefined$1:object[key];};}/**
- * The base implementation of `_.propertyOf` without support for deep paths.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Function} Returns the new accessor function.
- */function basePropertyOf(object){return function(key){return object==null?undefined$1:object[key];};}/**
- * The base implementation of `_.reduce` and `_.reduceRight`, without support
- * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} accumulator The initial value.
- * @param {boolean} initAccum Specify using the first or last element of
- * `collection` as the initial value.
- * @param {Function} eachFunc The function to iterate over `collection`.
- * @returns {*} Returns the accumulated value.
- */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;}/**
- * The base implementation of `_.sortBy` which uses `comparer` to define the
- * sort order of `array` and replaces criteria objects with their corresponding
- * values.
- *
- * @private
- * @param {Array} array The array to sort.
- * @param {Function} comparer The function to define sort order.
- * @returns {Array} Returns `array`.
- */function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--){array[length]=array[length].value;}return array;}/**
- * The base implementation of `_.sum` and `_.sumBy` without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {number} Returns the sum.
- */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;}/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n){result[index]=iteratee(index);}return result;}/**
- * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
- * of key-value pairs for `object` corresponding to the property names of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the key-value pairs.
- */function baseToPairs(object,props){return arrayMap(props,function(key){return [key,object[key]];});}/**
- * The base implementation of `_.trim`.
- *
- * @private
- * @param {string} string The string to trim.
- * @returns {string} Returns the trimmed string.
- */function baseTrim(string){return string?string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,''):string;}/**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */function baseUnary(func){return function(value){return func(value);};}/**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
- */function baseValues(object,props){return arrayMap(props,function(key){return object[key];});}/**
- * Checks if a `cache` value for `key` exists.
- *
- * @private
- * @param {Object} cache The cache to query.
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */function cacheHas(cache,key){return cache.has(key);}/**
- * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
- * that is not found in the character symbols.
- *
- * @private
- * @param {Array} strSymbols The string symbols to inspect.
- * @param {Array} chrSymbols The character symbols to find.
- * @returns {number} Returns the index of the first unmatched string symbol.
- */function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length;while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index;}/**
- * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
- * that is not found in the character symbols.
- *
- * @private
- * @param {Array} strSymbols The string symbols to inspect.
- * @param {Array} chrSymbols The character symbols to find.
- * @returns {number} Returns the index of the last unmatched string symbol.
- */function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index;}/**
- * Gets the number of `placeholder` occurrences in `array`.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} placeholder The placeholder to search for.
- * @returns {number} Returns the placeholder count.
- */function countHolders(array,placeholder){var length=array.length,result=0;while(length--){if(array[length]===placeholder){++result;}}return result;}/**
- * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
- * letters to basic Latin letters.
- *
- * @private
- * @param {string} letter The matched letter to deburr.
- * @returns {string} Returns the deburred letter.
- */var deburrLetter=basePropertyOf(deburredLetters);/**
- * Used by `_.escape` to convert characters to HTML entities.
- *
- * @private
- * @param {string} chr The matched character to escape.
- * @returns {string} Returns the escaped character.
- */var escapeHtmlChar=basePropertyOf(htmlEscapes);/**
- * Used by `_.template` to escape characters for inclusion in compiled string literals.
- *
- * @private
- * @param {string} chr The matched character to escape.
- * @returns {string} Returns the escaped character.
- */function escapeStringChar(chr){return '\\'+stringEscapes[chr];}/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */function getValue(object,key){return object==null?undefined$1:object[key];}/**
- * Checks if `string` contains Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
- */function hasUnicode(string){return reHasUnicode.test(string);}/**
- * Checks if `string` contains a word composed of Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a word is found, else `false`.
- */function hasUnicodeWord(string){return reHasUnicodeWord.test(string);}/**
- * Converts `iterator` to an array.
- *
- * @private
- * @param {Object} iterator The iterator to convert.
- * @returns {Array} Returns the converted array.
- */function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done){result.push(data.value);}return result;}/**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value];});return result;}/**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */function overArg(func,transform){return function(arg){return func(transform(arg));};}/**
- * Replaces all `placeholder` elements in `array` with an internal placeholder
- * and returns an array of their indexes.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {*} placeholder The placeholder to replace.
- * @returns {Array} Returns the new array of placeholder indexes.
- */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;}/**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value;});return result;}/**
- * Converts `set` to its value-value pairs.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the value-value pairs.
- */function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value];});return result;}/**
- * A specialized version of `_.indexOf` which performs strict equality
- * comparisons of values, i.e. `===`.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */function strictIndexOf(array,value,fromIndex){var index=fromIndex-1,length=array.length;while(++index<length){if(array[index]===value){return index;}}return -1;}/**
- * A specialized version of `_.lastIndexOf` which performs strict equality
- * comparisons of values, i.e. `===`.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */function strictLastIndexOf(array,value,fromIndex){var index=fromIndex+1;while(index--){if(array[index]===value){return index;}}return index;}/**
- * Gets the number of symbols in `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the string size.
- */function stringSize(string){return hasUnicode(string)?unicodeSize(string):asciiSize(string);}/**
- * Converts `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string);}/**
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the last non-whitespace character.
- */function trimmedEndIndex(string){var index=string.length;while(index--&&reWhitespace.test(string.charAt(index))){}return index;}/**
- * Used by `_.unescape` to convert HTML entities to characters.
- *
- * @private
- * @param {string} chr The matched character to unescape.
- * @returns {string} Returns the unescaped character.
- */var unescapeHtmlChar=basePropertyOf(htmlUnescapes);/**
- * Gets the size of a Unicode `string`.
- *
- * @private
- * @param {string} string The string inspect.
- * @returns {number} Returns the string size.
- */function unicodeSize(string){var result=reUnicode.lastIndex=0;while(reUnicode.test(string)){++result;}return result;}/**
- * Converts a Unicode `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */function unicodeToArray(string){return string.match(reUnicode)||[];}/**
- * Splits a Unicode `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */function unicodeWords(string){return string.match(reUnicodeWord)||[];}/*--------------------------------------------------------------------------*/ /**
- * Create a new pristine `lodash` function using the `context` object.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Util
- * @param {Object} [context=root] The context object.
- * @returns {Function} Returns a new `lodash` function.
- * @example
- *
- * _.mixin({ 'foo': _.constant('foo') });
- *
- * var lodash = _.runInContext();
- * lodash.mixin({ 'bar': lodash.constant('bar') });
- *
- * _.isFunction(_.foo);
- * // => true
- * _.isFunction(_.bar);
- * // => false
- *
- * lodash.isFunction(lodash.foo);
- * // => false
- * lodash.isFunction(lodash.bar);
- * // => true
- *
- * // Create a suped-up `defer` in Node.js.
- * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
- */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:'';}();/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */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;/*------------------------------------------------------------------------*/ /**
- * Creates a `lodash` object which wraps `value` to enable implicit method
- * chain sequences. Methods that operate on and return arrays, collections,
- * and functions can be chained together. Methods that retrieve a single value
- * or may return a primitive value will automatically end the chain sequence
- * and return the unwrapped value. Otherwise, the value must be unwrapped
- * with `_#value`.
- *
- * Explicit chain sequences, which must be unwrapped with `_#value`, may be
- * enabled using `_.chain`.
- *
- * The execution of chained methods is lazy, that is, it's deferred until
- * `_#value` is implicitly or explicitly called.
- *
- * Lazy evaluation allows several methods to support shortcut fusion.
- * Shortcut fusion is an optimization to merge iteratee calls; this avoids
- * the creation of intermediate arrays and can greatly reduce the number of
- * iteratee executions. Sections of a chain sequence qualify for shortcut
- * fusion if the section is applied to an array and iteratees accept only
- * one argument. The heuristic for whether a section qualifies for shortcut
- * fusion is subject to change.
- *
- * Chaining is supported in custom builds as long as the `_#value` method is
- * directly or indirectly included in the build.
- *
- * In addition to lodash methods, wrappers have `Array` and `String` methods.
- *
- * The wrapper `Array` methods are:
- * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
- *
- * The wrapper `String` methods are:
- * `replace` and `split`
- *
- * The wrapper methods that support shortcut fusion are:
- * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
- * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
- * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
- *
- * The chainable wrapper methods are:
- * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
- * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
- * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
- * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
- * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
- * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
- * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
- * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
- * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
- * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
- * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
- * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
- * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
- * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
- * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
- * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
- * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
- * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
- * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
- * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
- * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
- * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
- * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
- * `zipObject`, `zipObjectDeep`, and `zipWith`
- *
- * The wrapper methods that are **not** chainable by default are:
- * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
- * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
- * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
- * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
- * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
- * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
- * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
- * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
- * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
- * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
- * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
- * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
- * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
- * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
- * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
- * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
- * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
- * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
- * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
- * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
- * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
- * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
- * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
- * `upperFirst`, `value`, and `words`
- *
- * @name _
- * @constructor
- * @category Seq
- * @param {*} value The value to wrap in a `lodash` instance.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * var wrapped = _([1, 2, 3]);
- *
- * // Returns an unwrapped value.
- * wrapped.reduce(_.add);
- * // => 6
- *
- * // Returns a wrapped value.
- * var squares = wrapped.map(square);
- *
- * _.isArray(squares);
- * // => false
- *
- * _.isArray(squares.value());
- * // => true
- */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);}/**
- * The base implementation of `_.create` without support for assigning
- * properties to the created object.
- *
- * @private
- * @param {Object} proto The object to inherit from.
- * @returns {Object} Returns the new object.
- */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;};}();/**
- * The function whose prototype chain sequence wrappers inherit from.
- *
- * @private
- */function baseLodash(){// No operation performed.
- }/**
- * The base constructor for creating `lodash` wrapper objects.
- *
- * @private
- * @param {*} value The value to wrap.
- * @param {boolean} [chainAll] Enable explicit method chain sequences.
- */function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined$1;}/**
- * By default, the template delimiters used by lodash are like those in
- * embedded Ruby (ERB) as well as ES2015 template strings. Change the
- * following template settings to use alternative delimiters.
- *
- * @static
- * @memberOf _
- * @type {Object}
- */lodash.templateSettings={/**
- * Used to detect `data` property values to be HTML-escaped.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */'escape':reEscape,/**
- * Used to detect code to be evaluated.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */'evaluate':reEvaluate,/**
- * Used to detect `data` property values to inject.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */'interpolate':reInterpolate,/**
- * Used to reference the data object in the template text.
- *
- * @memberOf _.templateSettings
- * @type {string}
- */'variable':'',/**
- * Used to import variables into the compiled template.
- *
- * @memberOf _.templateSettings
- * @type {Object}
- */'imports':{/**
- * A reference to the `lodash` function.
- *
- * @memberOf _.templateSettings.imports
- * @type {Function}
- */'_':lodash}};// Ensure wrappers are instances of `baseLodash`.
- lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype);LodashWrapper.prototype.constructor=LodashWrapper;/*------------------------------------------------------------------------*/ /**
- * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
- *
- * @private
- * @constructor
- * @param {*} value The value to wrap.
- */function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[];}/**
- * Creates a clone of the lazy wrapper object.
- *
- * @private
- * @name clone
- * @memberOf LazyWrapper
- * @returns {Object} Returns the cloned `LazyWrapper` object.
- */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;}/**
- * Reverses the direction of lazy iteration.
- *
- * @private
- * @name reverse
- * @memberOf LazyWrapper
- * @returns {Object} Returns the new reversed `LazyWrapper` object.
- */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;}/**
- * Extracts the unwrapped value from its lazy wrapper.
- *
- * @private
- * @name value
- * @memberOf LazyWrapper
- * @returns {*} Returns the unwrapped value.
- */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`.
- LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;/*------------------------------------------------------------------------*/ /**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */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]);}}/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0;}/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0;return result;}/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */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;}/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined$1:hasOwnProperty.call(data,key);}/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */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`.
- Hash.prototype.clear=hashClear;Hash.prototype['delete']=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;/*------------------------------------------------------------------------*/ /**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */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]);}}/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */function listCacheClear(){this.__data__=[];this.size=0;}/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */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;}/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined$1:data[index][1];}/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1;}/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */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`.
- ListCache.prototype.clear=listCacheClear;ListCache.prototype['delete']=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;/*------------------------------------------------------------------------*/ /**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */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]);}}/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */function mapCacheDelete(key){var result=getMapData(this,key)['delete'](key);this.size-=result?1:0;return result;}/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */function mapCacheGet(key){return getMapData(this,key).get(key);}/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */function mapCacheHas(key){return getMapData(this,key).has(key);}/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */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`.
- MapCache.prototype.clear=mapCacheClear;MapCache.prototype['delete']=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;/*------------------------------------------------------------------------*/ /**
- *
- * Creates an array cache object to store unique values.
- *
- * @private
- * @constructor
- * @param {Array} [values] The values to cache.
- */function SetCache(values){var index=-1,length=values==null?0:values.length;this.__data__=new MapCache();while(++index<length){this.add(values[index]);}}/**
- * Adds `value` to the array cache.
- *
- * @private
- * @name add
- * @memberOf SetCache
- * @alias push
- * @param {*} value The value to cache.
- * @returns {Object} Returns the cache instance.
- */function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this;}/**
- * Checks if `value` is in the array cache.
- *
- * @private
- * @name has
- * @memberOf SetCache
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
- */function setCacheHas(value){return this.__data__.has(value);}// Add methods to `SetCache`.
- SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;/*------------------------------------------------------------------------*/ /**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size;}/**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */function stackClear(){this.__data__=new ListCache();this.size=0;}/**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */function stackDelete(key){var data=this.__data__,result=data['delete'](key);this.size=data.size;return result;}/**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */function stackGet(key){return this.__data__.get(key);}/**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */function stackHas(key){return this.__data__.has(key);}/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */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`.
- Stack.prototype.clear=stackClear;Stack.prototype['delete']=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;/*------------------------------------------------------------------------*/ /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */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.
- key=='length'||// Node.js 0.10 has enumerable non-index properties on buffers.
- isBuff&&(key=='offset'||key=='parent')||// PhantomJS 2 has enumerable non-index properties on typed arrays.
- isType&&(key=='buffer'||key=='byteLength'||key=='byteOffset')||// Skip index properties.
- isIndex(key,length)))){result.push(key);}}return result;}/**
- * A specialized version of `_.sample` for arrays.
- *
- * @private
- * @param {Array} array The array to sample.
- * @returns {*} Returns the random element.
- */function arraySample(array){var length=array.length;return length?array[baseRandom(0,length-1)]:undefined$1;}/**
- * A specialized version of `_.sampleSize` for arrays.
- *
- * @private
- * @param {Array} array The array to sample.
- * @param {number} n The number of elements to sample.
- * @returns {Array} Returns the random elements.
- */function arraySampleSize(array,n){return shuffleSelf(copyArray(array),baseClamp(n,0,array.length));}/**
- * A specialized version of `_.shuffle` for arrays.
- *
- * @private
- * @param {Array} array The array to shuffle.
- * @returns {Array} Returns the new shuffled array.
- */function arrayShuffle(array){return shuffleSelf(copyArray(array));}/**
- * This function is like `assignValue` except that it doesn't assign
- * `undefined` values.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */function assignMergeValue(object,key,value){if(value!==undefined$1&&!eq(object[key],value)||value===undefined$1&&!(key in object)){baseAssignValue(object,key,value);}}/**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */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);}}/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length;}}return -1;}/**
- * Aggregates elements of `collection` on `accumulator` with keys transformed
- * by `iteratee` and values set by `setter`.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} setter The function to set `accumulator` values.
- * @param {Function} iteratee The iteratee to transform keys.
- * @param {Object} accumulator The initial aggregated object.
- * @returns {Function} Returns `accumulator`.
- */function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator,value,iteratee(value),collection);});return accumulator;}/**
- * The base implementation of `_.assign` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */function baseAssign(object,source){return object&©Object(source,keys(source),object);}/**
- * The base implementation of `_.assignIn` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */function baseAssignIn(object,source){return object&©Object(source,keysIn(source),object);}/**
- * The base implementation of `assignValue` and `assignMergeValue` without
- * value checks.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */function baseAssignValue(object,key,value){if(key=='__proto__'&&defineProperty){defineProperty(object,key,{'configurable':true,'enumerable':true,'value':value,'writable':true});}else {object[key]=value;}}/**
- * The base implementation of `_.at` without support for individual paths.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {string[]} paths The property paths to pick.
- * @returns {Array} Returns the picked elements.
- */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;}/**
- * The base implementation of `_.clamp` which doesn't coerce arguments.
- *
- * @private
- * @param {number} number The number to clamp.
- * @param {number} [lower] The lower bound.
- * @param {number} upper The upper bound.
- * @returns {number} Returns the clamped number.
- */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;}/**
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
- * traversed objects.
- *
- * @private
- * @param {*} value The value to clone.
- * @param {boolean} bitmask The bitmask flags.
- * 1 - Deep clone
- * 2 - Flatten inherited properties
- * 4 - Clone symbols
- * @param {Function} [customizer] The function to customize cloning.
- * @param {string} [key] The key of `value`.
- * @param {Object} [object] The parent object of `value`.
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
- * @returns {*} Returns the cloned value.
- */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.
- 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).
- assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack));});return result;}/**
- * The base implementation of `_.conforms` which doesn't clone `source`.
- *
- * @private
- * @param {Object} source The object of property predicates to conform to.
- * @returns {Function} Returns the new spec function.
- */function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props);};}/**
- * The base implementation of `_.conformsTo` which accepts `props` to check.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property predicates to conform to.
- * @returns {boolean} Returns `true` if `object` conforms, else `false`.
- */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;}/**
- * The base implementation of `_.delay` and `_.defer` which accepts `args`
- * to provide to `func`.
- *
- * @private
- * @param {Function} func The function to delay.
- * @param {number} wait The number of milliseconds to delay invocation.
- * @param {Array} args The arguments to provide to `func`.
- * @returns {number|Object} Returns the timer id or timeout object.
- */function baseDelay(func,wait,args){if(typeof func!='function'){throw new TypeError(FUNC_ERROR_TEXT);}return setTimeout(function(){func.apply(undefined$1,args);},wait);}/**
- * The base implementation of methods like `_.difference` without support
- * for excluding multiple arrays or iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Array} values The values to exclude.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of filtered values.
- */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;}/**
- * The base implementation of `_.forEach` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- */var baseEach=createBaseEach(baseForOwn);/**
- * The base implementation of `_.forEachRight` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- */var baseEachRight=createBaseEach(baseForOwnRight,true);/**
- * The base implementation of `_.every` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check,
- * else `false`
- */function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result;});return result;}/**
- * The base implementation of methods like `_.max` and `_.min` which accepts a
- * `comparator` to determine the extremum value.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The iteratee invoked per iteration.
- * @param {Function} comparator The comparator used to compare values.
- * @returns {*} Returns the extremum value.
- */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;}/**
- * The base implementation of `_.fill` without an iteratee call guard.
- *
- * @private
- * @param {Array} array The array to fill.
- * @param {*} value The value to fill `array` with.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns `array`.
- */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;}/**
- * The base implementation of `_.filter` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- */function baseFilter(collection,predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection)){result.push(value);}});return result;}/**
- * The base implementation of `_.flatten` with support for restricting flattening.
- *
- * @private
- * @param {Array} array The array to flatten.
- * @param {number} depth The maximum recursion depth.
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
- * @param {Array} [result=[]] The initial result value.
- * @returns {Array} Returns the new flattened array.
- */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).
- baseFlatten(value,depth-1,predicate,isStrict,result);}else {arrayPush(result,value);}}else if(!isStrict){result[result.length]=value;}}return result;}/**
- * The base implementation of `baseForOwn` which iterates over `object`
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */var baseFor=createBaseFor();/**
- * This function is like `baseFor` except that it iterates over properties
- * in the opposite order.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */var baseForRight=createBaseFor(true);/**
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys);}/**
- * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys);}/**
- * The base implementation of `_.functions` which creates an array of
- * `object` function property names filtered from `props`.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Array} props The property names to filter.
- * @returns {Array} Returns the function names.
- */function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key]);});}/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */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;}/**
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
- * @returns {Array} Returns the array of property names and symbols.
- */function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object));}/**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */function baseGetTag(value){if(value==null){return value===undefined$1?undefinedTag:nullTag;}return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value);}/**
- * The base implementation of `_.gt` which doesn't coerce arguments.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than `other`,
- * else `false`.
- */function baseGt(value,other){return value>other;}/**
- * The base implementation of `_.has` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key);}/**
- * The base implementation of `_.hasIn` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */function baseHasIn(object,key){return object!=null&&key in Object(object);}/**
- * The base implementation of `_.inRange` which doesn't coerce arguments.
- *
- * @private
- * @param {number} number The number to check.
- * @param {number} start The start of the range.
- * @param {number} end The end of the range.
- * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
- */function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end);}/**
- * The base implementation of methods like `_.intersection`, without support
- * for iteratee shorthands, that accepts an array of arrays to inspect.
- *
- * @private
- * @param {Array} arrays The arrays to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of shared values.
- */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;}/**
- * The base implementation of `_.invert` and `_.invertBy` which inverts
- * `object` with values transformed by `iteratee` and set by `setter`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} setter The function to set `accumulator` values.
- * @param {Function} iteratee The iteratee to transform values.
- * @param {Object} accumulator The initial inverted object.
- * @returns {Function} Returns `accumulator`.
- */function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object);});return accumulator;}/**
- * The base implementation of `_.invoke` without support for individual
- * method arguments.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the method to invoke.
- * @param {Array} args The arguments to invoke the method with.
- * @returns {*} Returns the result of the invoked method.
- */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);}/**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag;}/**
- * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
- */function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag;}/**
- * The base implementation of `_.isDate` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
- */function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag;}/**
- * The base implementation of `_.isEqual` which supports partial comparisons
- * and tracks traversed objects.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {boolean} bitmask The bitmask flags.
- * 1 - Unordered comparison
- * 2 - Partial comparison
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */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);}/**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */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);}/**
- * The base implementation of `_.isMap` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
- */function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag;}/**
- * The base implementation of `_.isMatch` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @param {Array} matchData The property names, values, and compare flags to match.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- */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;}/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false;}var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value));}/**
- * The base implementation of `_.isRegExp` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
- */function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag;}/**
- * The base implementation of `_.isSet` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
- */function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag;}/**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)];}/**
- * The base implementation of `_.iteratee`.
- *
- * @private
- * @param {*} [value=_.identity] The value to convert to an iteratee.
- * @returns {Function} Returns the iteratee.
- */function baseIteratee(value){// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
- // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
- 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);}/**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */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;}/**
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */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;}/**
- * The base implementation of `_.lt` which doesn't coerce arguments.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than `other`,
- * else `false`.
- */function baseLt(value,other){return value<other;}/**
- * The base implementation of `_.map` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */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;}/**
- * The base implementation of `_.matches` which doesn't clone `source`.
- *
- * @private
- * @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new spec function.
- */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);};}/**
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
- *
- * @private
- * @param {string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */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);};}/**
- * The base implementation of `_.merge` without support for multiple sources.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {number} srcIndex The index of `source`.
- * @param {Function} [customizer] The function to customize merged values.
- * @param {Object} [stack] Tracks traversed source values and their merged
- * counterparts.
- */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);}/**
- * A specialized version of `baseMerge` for arrays and objects which performs
- * deep merges and tracks traversed objects enabling objects with circular
- * references to be merged.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {string} key The key of the value to merge.
- * @param {number} srcIndex The index of `source`.
- * @param {Function} mergeFunc The function to merge values.
- * @param {Function} [customizer] The function to customize assigned values.
- * @param {Object} [stack] Tracks traversed source values and their merged
- * counterparts.
- */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).
- stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,stack);stack['delete'](srcValue);}assignMergeValue(object,key,newValue);}/**
- * The base implementation of `_.nth` which doesn't coerce arguments.
- *
- * @private
- * @param {Array} array The array to query.
- * @param {number} n The index of the element to return.
- * @returns {*} Returns the nth element of `array`.
- */function baseNth(array,n){var length=array.length;if(!length){return;}n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined$1;}/**
- * The base implementation of `_.orderBy` without param guards.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
- * @param {string[]} orders The sort orders of `iteratees`.
- * @returns {Array} Returns the new sorted array.
- */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);});}/**
- * The base implementation of `_.pick` without support for individual
- * property identifiers.
- *
- * @private
- * @param {Object} object The source object.
- * @param {string[]} paths The property paths to pick.
- * @returns {Object} Returns the new object.
- */function basePick(object,paths){return basePickBy(object,paths,function(value,path){return hasIn(object,path);});}/**
- * The base implementation of `_.pickBy` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The source object.
- * @param {string[]} paths The property paths to pick.
- * @param {Function} predicate The function invoked per property.
- * @returns {Object} Returns the new object.
- */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;}/**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- */function basePropertyDeep(path){return function(object){return baseGet(object,path);};}/**
- * The base implementation of `_.pullAllBy` without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to remove.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns `array`.
- */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;}/**
- * The base implementation of `_.pullAt` without support for individual
- * indexes or capturing the removed elements.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {number[]} indexes The indexes of elements to remove.
- * @returns {Array} Returns `array`.
- */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;}/**
- * The base implementation of `_.random` without support for returning
- * floating-point numbers.
- *
- * @private
- * @param {number} lower The lower bound.
- * @param {number} upper The upper bound.
- * @returns {number} Returns the random number.
- */function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1));}/**
- * The base implementation of `_.range` and `_.rangeRight` which doesn't
- * coerce arguments.
- *
- * @private
- * @param {number} start The start of the range.
- * @param {number} end The end of the range.
- * @param {number} step The value to increment or decrement by.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Array} Returns the range of numbers.
- */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;}/**
- * The base implementation of `_.repeat` which doesn't coerce arguments.
- *
- * @private
- * @param {string} string The string to repeat.
- * @param {number} n The number of times to repeat the string.
- * @returns {string} Returns the repeated string.
- */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.
- // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
- do{if(n%2){result+=string;}n=nativeFloor(n/2);if(n){string+=string;}}while(n);return result;}/**
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- */function baseRest(func,start){return setToString(overRest(func,start,identity),func+'');}/**
- * The base implementation of `_.sample`.
- *
- * @private
- * @param {Array|Object} collection The collection to sample.
- * @returns {*} Returns the random element.
- */function baseSample(collection){return arraySample(values(collection));}/**
- * The base implementation of `_.sampleSize` without param guards.
- *
- * @private
- * @param {Array|Object} collection The collection to sample.
- * @param {number} n The number of elements to sample.
- * @returns {Array} Returns the random elements.
- */function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length));}/**
- * The base implementation of `_.set`.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {*} value The value to set.
- * @param {Function} [customizer] The function to customize path creation.
- * @returns {Object} Returns `object`.
- */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;}/**
- * The base implementation of `setData` without support for hot loop shorting.
- *
- * @private
- * @param {Function} func The function to associate metadata with.
- * @param {*} data The metadata.
- * @returns {Function} Returns `func`.
- */var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func;};/**
- * The base implementation of `setToString` without support for hot loop shorting.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
- */var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,'toString',{'configurable':true,'enumerable':false,'value':constant(string),'writable':true});};/**
- * The base implementation of `_.shuffle`.
- *
- * @private
- * @param {Array|Object} collection The collection to shuffle.
- * @returns {Array} Returns the new shuffled array.
- */function baseShuffle(collection){return shuffleSelf(values(collection));}/**
- * The base implementation of `_.slice` without an iteratee call guard.
- *
- * @private
- * @param {Array} array The array to slice.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the slice of `array`.
- */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;}/**
- * The base implementation of `_.some` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return !result;});return !!result;}/**
- * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
- * performs a binary search of `array` to determine the index at which `value`
- * should be inserted into `array` in order to maintain its sort order.
- *
- * @private
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @param {boolean} [retHighest] Specify returning the highest qualified index.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- */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);}/**
- * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
- * which invokes `iteratee` for `value` and each element of `array` to compute
- * their sort ranking. The iteratee is invoked with one argument; (value).
- *
- * @private
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @param {Function} iteratee The iteratee invoked per element.
- * @param {boolean} [retHighest] Specify returning the highest qualified index.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- */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);}/**
- * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
- * support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- */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;}/**
- * The base implementation of `_.toNumber` which doesn't ensure correct
- * conversions of binary, hexadecimal, or octal string values.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- */function baseToNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}return +value;}/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */function baseToString(value){// Exit early for strings to avoid a performance hit in some environments.
- if(typeof value=='string'){return value;}if(isArray(value)){// Recursively convert values (susceptible to call stack limits).
- return arrayMap(value,baseToString)+'';}if(isSymbol(value)){return symbolToString?symbolToString.call(value):'';}var result=value+'';return result=='0'&&1/value==-INFINITY?'-0':result;}/**
- * The base implementation of `_.uniqBy` without support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- */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;}/**
- * The base implementation of `_.unset`.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {Array|string} path The property path to unset.
- * @returns {boolean} Returns `true` if the property is deleted, else `false`.
- */function baseUnset(object,path){path=castPath(path,object);object=parent(object,path);return object==null||delete object[toKey(last(path))];}/**
- * The base implementation of `_.update`.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to update.
- * @param {Function} updater The function to produce the updated value.
- * @param {Function} [customizer] The function to customize path creation.
- * @returns {Object} Returns `object`.
- */function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer);}/**
- * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
- * without support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to query.
- * @param {Function} predicate The function invoked per iteration.
- * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Array} Returns the slice of `array`.
- */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);}/**
- * The base implementation of `wrapperValue` which returns the result of
- * performing a sequence of actions on the unwrapped `value`, where each
- * successive action is supplied the return value of the previous.
- *
- * @private
- * @param {*} value The unwrapped value.
- * @param {Array} actions Actions to perform to resolve the unwrapped value.
- * @returns {*} Returns the resolved value.
- */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);}/**
- * The base implementation of methods like `_.xor`, without support for
- * iteratee shorthands, that accepts an array of arrays to inspect.
- *
- * @private
- * @param {Array} arrays The arrays to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of values.
- */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);}/**
- * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
- *
- * @private
- * @param {Array} props The property identifiers.
- * @param {Array} values The property values.
- * @param {Function} assignFunc The function to assign values.
- * @returns {Object} Returns the new object.
- */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;}/**
- * Casts `value` to an empty array if it's not an array like object.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array|Object} Returns the cast array-like object.
- */function castArrayLikeObject(value){return isArrayLikeObject(value)?value:[];}/**
- * Casts `value` to `identity` if it's not a function.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Function} Returns cast function.
- */function castFunction(value){return typeof value=='function'?value:identity;}/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @param {Object} [object] The object to query keys on.
- * @returns {Array} Returns the cast property path array.
- */function castPath(value,object){if(isArray(value)){return value;}return isKey(value,object)?[value]:stringToPath(toString(value));}/**
- * A `baseRest` alias which can be replaced with `identity` by module
- * replacement plugins.
- *
- * @private
- * @type {Function}
- * @param {Function} func The function to apply a rest parameter to.
- * @returns {Function} Returns the new function.
- */var castRest=baseRest;/**
- * Casts `array` to a slice if it's needed.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {number} start The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the cast slice.
- */function castSlice(array,start,end){var length=array.length;end=end===undefined$1?length:end;return !start&&end>=length?array:baseSlice(array,start,end);}/**
- * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
- *
- * @private
- * @param {number|Object} id The timer id or timeout object of the timer to clear.
- */var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id);};/**
- * Creates a clone of `buffer`.
- *
- * @private
- * @param {Buffer} buffer The buffer to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Buffer} Returns the cloned buffer.
- */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;}/**
- * Creates a clone of `arrayBuffer`.
- *
- * @private
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
- */function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result;}/**
- * Creates a clone of `dataView`.
- *
- * @private
- * @param {Object} dataView The data view to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned data view.
- */function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength);}/**
- * Creates a clone of `regexp`.
- *
- * @private
- * @param {Object} regexp The regexp to clone.
- * @returns {Object} Returns the cloned regexp.
- */function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result;}/**
- * Creates a clone of the `symbol` object.
- *
- * @private
- * @param {Object} symbol The symbol object to clone.
- * @returns {Object} Returns the cloned symbol object.
- */function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{};}/**
- * Creates a clone of `typedArray`.
- *
- * @private
- * @param {Object} typedArray The typed array to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned typed array.
- */function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length);}/**
- * Compares values to sort them in ascending order.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {number} Returns the sort order indicator for `value`.
- */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;}/**
- * Used by `_.orderBy` to compare multiple properties of a value to another
- * and stable sort them.
- *
- * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
- * specify an order of "desc" for descending or "asc" for ascending sort order
- * of corresponding values.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {boolean[]|string[]} orders The order to sort by for each property.
- * @returns {number} Returns the sort order indicator for `object`.
- */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
- // that causes it, under certain circumstances, to provide the same value for
- // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
- // for more details.
- //
- // This also ensures a stable sort in V8 and other engines.
- // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
- return object.index-other.index;}/**
- * Creates an array that is the composition of partially applied arguments,
- * placeholders, and provided arguments into a single array of arguments.
- *
- * @private
- * @param {Array} args The provided arguments.
- * @param {Array} partials The arguments to prepend to those provided.
- * @param {Array} holders The `partials` placeholder indexes.
- * @params {boolean} [isCurried] Specify composing for a curried function.
- * @returns {Array} Returns the new array of composed arguments.
- */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;}/**
- * This function is like `composeArgs` except that the arguments composition
- * is tailored for `_.partialRight`.
- *
- * @private
- * @param {Array} args The provided arguments.
- * @param {Array} partials The arguments to append to those provided.
- * @param {Array} holders The `partials` placeholder indexes.
- * @params {boolean} [isCurried] Specify composing for a curried function.
- * @returns {Array} Returns the new array of composed arguments.
- */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;}/**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index];}return array;}/**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property identifiers to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @param {Function} [customizer] The function to customize copied values.
- * @returns {Object} Returns `object`.
- */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;}/**
- * Copies own symbols of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
- * @returns {Object} Returns `object`.
- */function copySymbols(source,object){return copyObject(source,getSymbols(source),object);}/**
- * Copies own and inherited symbols of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
- * @returns {Object} Returns `object`.
- */function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object);}/**
- * Creates a function like `_.groupBy`.
- *
- * @private
- * @param {Function} setter The function to set accumulator values.
- * @param {Function} [initializer] The accumulator object initializer.
- * @returns {Function} Returns the new aggregator function.
- */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);};}/**
- * Creates a function like `_.assign`.
- *
- * @private
- * @param {Function} assigner The function to assign values.
- * @returns {Function} Returns the new assigner function.
- */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;});}/**
- * Creates a `baseEach` or `baseEachRight` function.
- *
- * @private
- * @param {Function} eachFunc The function to iterate over a collection.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */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;};}/**
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */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;};}/**
- * Creates a function that wraps `func` to invoke it with the optional `this`
- * binding of `thisArg`.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @param {*} [thisArg] The `this` binding of `func`.
- * @returns {Function} Returns the new wrapped function.
- */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;}/**
- * Creates a function like `_.lowerFirst`.
- *
- * @private
- * @param {string} methodName The name of the `String` case method to use.
- * @returns {Function} Returns the new case function.
- */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;};}/**
- * Creates a function like `_.camelCase`.
- *
- * @private
- * @param {Function} callback The function to combine each word.
- * @returns {Function} Returns the new compounder function.
- */function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,'')),callback,'');};}/**
- * Creates a function that produces an instance of `Ctor` regardless of
- * whether it was invoked as part of a `new` expression or by `call` or `apply`.
- *
- * @private
- * @param {Function} Ctor The constructor to wrap.
- * @returns {Function} Returns the new wrapped function.
- */function createCtor(Ctor){return function(){// Use a `switch` statement to work with class constructors. See
- // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
- // for more details.
- 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.
- // See https://es5.github.io/#x13.2.2 for more details.
- return isObject(result)?result:thisBinding;};}/**
- * Creates a function that wraps `func` to enable currying.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @param {number} arity The arity of `func`.
- * @returns {Function} Returns the new wrapped function.
- */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;}/**
- * Creates a `_.find` or `_.findLast` function.
- *
- * @private
- * @param {Function} findIndexFunc The function to find the collection index.
- * @returns {Function} Returns the new find function.
- */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;};}/**
- * Creates a `_.flow` or `_.flowRight` function.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new flow function.
- */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;};});}/**
- * Creates a function that wraps `func` to invoke it with optional `this`
- * binding of `thisArg`, partial application, and currying.
- *
- * @private
- * @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to
- * the new function.
- * @param {Array} [holders] The `partials` placeholder indexes.
- * @param {Array} [partialsRight] The arguments to append to those provided
- * to the new function.
- * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
- * @param {Array} [argPos] The argument positions of the new function.
- * @param {number} [ary] The arity cap of `func`.
- * @param {number} [arity] The arity of `func`.
- * @returns {Function} Returns the new wrapped function.
- */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;}/**
- * Creates a function like `_.invertBy`.
- *
- * @private
- * @param {Function} setter The function to set accumulator values.
- * @param {Function} toIteratee The function to resolve iteratees.
- * @returns {Function} Returns the new inverter function.
- */function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{});};}/**
- * Creates a function that performs a mathematical operation on two values.
- *
- * @private
- * @param {Function} operator The function to perform the operation.
- * @param {number} [defaultValue] The value used for `undefined` arguments.
- * @returns {Function} Returns the new mathematical operation function.
- */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;};}/**
- * Creates a function like `_.over`.
- *
- * @private
- * @param {Function} arrayFunc The function to iterate over iteratees.
- * @returns {Function} Returns the new over function.
- */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);});});});}/**
- * Creates the padding for `string` based on `length`. The `chars` string
- * is truncated if the number of characters exceeds `length`.
- *
- * @private
- * @param {number} length The padding length.
- * @param {string} [chars=' '] The string used as padding.
- * @returns {string} Returns the padding for `string`.
- */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);}/**
- * Creates a function that wraps `func` to invoke it with the `this` binding
- * of `thisArg` and `partials` prepended to the arguments it receives.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {Array} partials The arguments to prepend to those provided to
- * the new function.
- * @returns {Function} Returns the new wrapped function.
- */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;}/**
- * Creates a `_.range` or `_.rangeRight` function.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new range function.
- */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.
- 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);};}/**
- * Creates a function that performs a relational operation on two values.
- *
- * @private
- * @param {Function} operator The function to perform the operation.
- * @returns {Function} Returns the new relational operation function.
- */function createRelationalOperation(operator){return function(value,other){if(!(typeof value=='string'&&typeof other=='string')){value=toNumber(value);other=toNumber(other);}return operator(value,other);};}/**
- * Creates a function that wraps `func` to continue currying.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @param {Function} wrapFunc The function to create the `func` wrapper.
- * @param {*} placeholder The placeholder value.
- * @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to
- * the new function.
- * @param {Array} [holders] The `partials` placeholder indexes.
- * @param {Array} [argPos] The argument positions of the new function.
- * @param {number} [ary] The arity cap of `func`.
- * @param {number} [arity] The arity of `func`.
- * @returns {Function} Returns the new wrapped function.
- */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);}/**
- * Creates a function like `_.round`.
- *
- * @private
- * @param {string} methodName The name of the `Math` method to use when rounding.
- * @returns {Function} Returns the new round function.
- */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.
- // See [MDN](https://mdn.io/round#Examples) for more details.
- 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);};}/**
- * Creates a set object of `values`.
- *
- * @private
- * @param {Array} values The values to add to the set.
- * @returns {Object} Returns the new set.
- */var createSet=!(Set&&1/setToArray(new Set([,-0]))[1]==INFINITY)?noop:function(values){return new Set(values);};/**
- * Creates a `_.toPairs` or `_.toPairsIn` function.
- *
- * @private
- * @param {Function} keysFunc The function to get the keys of a given object.
- * @returns {Function} Returns the new pairs function.
- */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));};}/**
- * Creates a function that either curries or invokes `func` with optional
- * `this` binding and partially applied arguments.
- *
- * @private
- * @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask flags.
- * 1 - `_.bind`
- * 2 - `_.bindKey`
- * 4 - `_.curry` or `_.curryRight` of a bound function
- * 8 - `_.curry`
- * 16 - `_.curryRight`
- * 32 - `_.partial`
- * 64 - `_.partialRight`
- * 128 - `_.rearg`
- * 256 - `_.ary`
- * 512 - `_.flip`
- * @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to be partially applied.
- * @param {Array} [holders] The `partials` placeholder indexes.
- * @param {Array} [argPos] The argument positions of the new function.
- * @param {number} [ary] The arity cap of `func`.
- * @param {number} [arity] The arity of `func`.
- * @returns {Function} Returns the new wrapped function.
- */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);}/**
- * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
- * of source objects to the destination object for all destination properties
- * that resolve to `undefined`.
- *
- * @private
- * @param {*} objValue The destination value.
- * @param {*} srcValue The source value.
- * @param {string} key The key of the property to assign.
- * @param {Object} object The parent object of `objValue`.
- * @returns {*} Returns the value to assign.
- */function customDefaultsAssignIn(objValue,srcValue,key,object){if(objValue===undefined$1||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key)){return srcValue;}return objValue;}/**
- * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
- * objects into destination objects that are passed thru.
- *
- * @private
- * @param {*} objValue The destination value.
- * @param {*} srcValue The source value.
- * @param {string} key The key of the property to merge.
- * @param {Object} object The parent object of `objValue`.
- * @param {Object} source The parent object of `srcValue`.
- * @param {Object} [stack] Tracks traversed source values and their merged
- * counterparts.
- * @returns {*} Returns the value to assign.
- */function customDefaultsMerge(objValue,srcValue,key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){// Recursively merge objects and arrays (susceptible to call stack limits).
- stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined$1,customDefaultsMerge,stack);stack['delete'](srcValue);}return objValue;}/**
- * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
- * objects.
- *
- * @private
- * @param {*} value The value to inspect.
- * @param {string} key The key of the property to inspect.
- * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
- */function customOmitClone(value){return isPlainObject(value)?undefined$1:value;}/**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `array` and `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */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.
- 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.
- 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).
- 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;}/**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */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.
- // Invalid dates are coerced to `NaN`.
- 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,
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
- // for more details.
- 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.
- var stacked=stack.get(object);if(stacked){return stacked==other;}bitmask|=COMPARE_UNORDERED_FLAG;// Recursively compare objects (susceptible to call stack limits).
- 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;}/**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */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.
- 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).
- 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.
- 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;}/**
- * A specialized version of `baseRest` which flattens the rest array.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @returns {Function} Returns the new function.
- */function flatRest(func){return setToString(overRest(func,undefined$1,flatten),func+'');}/**
- * Creates an array of own enumerable property names and symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols);}/**
- * Creates an array of own and inherited enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn);}/**
- * Gets metadata for `func`.
- *
- * @private
- * @param {Function} func The function to query.
- * @returns {*} Returns the metadata for `func`.
- */var getData=!metaMap?noop:function(func){return metaMap.get(func);};/**
- * Gets the name of `func`.
- *
- * @private
- * @param {Function} func The function to query.
- * @returns {string} Returns the function name.
- */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;}/**
- * Gets the argument placeholder value for `func`.
- *
- * @private
- * @param {Function} func The function to inspect.
- * @returns {*} Returns the placeholder value.
- */function getHolder(func){var object=hasOwnProperty.call(lodash,'placeholder')?lodash:func;return object.placeholder;}/**
- * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
- * this function returns the custom method, otherwise it returns `baseIteratee`.
- * If arguments are provided, the chosen function is invoked with them and
- * its result is returned.
- *
- * @private
- * @param {*} [value] The value to convert to an iteratee.
- * @param {number} [arity] The arity of the created iteratee.
- * @returns {Function} Returns the chosen function or its result.
- */function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length?result(arguments[0],arguments[1]):result;}/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=='string'?'string':'hash']:data.map;}/**
- * Gets the property names, values, and compare flags of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the match data of `object`.
- */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;}/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined$1;}/**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */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;}/**
- * Creates an array of the own enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null){return [];}object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol);});};/**
- * Creates an array of the own and inherited enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */var getSymbolsIn=!nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object);}return result;};/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */var getTag=baseGetTag;// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
- 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;};}/**
- * Gets the view, applying any `transforms` to the `start` and `end` positions.
- *
- * @private
- * @param {number} start The start of the view.
- * @param {number} end The end of the view.
- * @param {Array} transforms The transformations to apply to the view.
- * @returns {Object} Returns an object containing the `start` and `end`
- * positions of the view.
- */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};}/**
- * Extracts wrapper details from the `source` body comment.
- *
- * @private
- * @param {string} source The source to inspect.
- * @returns {Array} Returns the wrapper details.
- */function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[];}/**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */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));}/**
- * Initializes an array clone.
- *
- * @private
- * @param {Array} array The array to clone.
- * @returns {Array} Returns the initialized clone.
- */function initCloneArray(array){var length=array.length,result=new array.constructor(length);// Add properties assigned by `RegExp#exec`.
- if(length&&typeof array[0]=='string'&&hasOwnProperty.call(array,'index')){result.index=array.index;result.input=array.input;}return result;}/**
- * Initializes an object clone.
- *
- * @private
- * @param {Object} object The object to clone.
- * @returns {Object} Returns the initialized clone.
- */function initCloneObject(object){return typeof object.constructor=='function'&&!isPrototype(object)?baseCreate(getPrototype(object)):{};}/**
- * Initializes an object clone based on its `toStringTag`.
- *
- * **Note:** This function only supports cloning values with tags of
- * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
- *
- * @private
- * @param {Object} object The object to clone.
- * @param {string} tag The `toStringTag` of the object to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the initialized clone.
- */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);}}/**
- * Inserts wrapper `details` in a comment at the top of the `source` body.
- *
- * @private
- * @param {string} source The source to modify.
- * @returns {Array} details The details to insert.
- * @returns {string} Returns the modified source.
- */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');}/**
- * Checks if `value` is a flattenable `arguments` object or array.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
- */function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol]);}/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */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;}/**
- * Checks if the given arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
- * else `false`.
- */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;}/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */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);}/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */function isKeyable(value){var type=typeof value;return type=='string'||type=='number'||type=='symbol'||type=='boolean'?value!=='__proto__':value===null;}/**
- * Checks if `func` has a lazy counterpart.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
- * else `false`.
- */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];}/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */function isMasked(func){return !!maskSrcKey&&maskSrcKey in func;}/**
- * Checks if `func` is capable of being masked.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
- */var isMaskable=coreJsData?isFunction:stubFalse;/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=='function'&&Ctor.prototype||objectProto;return value===proto;}/**
- * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` if suitable for strict
- * equality comparisons, else `false`.
- */function isStrictComparable(value){return value===value&&!isObject(value);}/**
- * A specialized version of `matchesProperty` for source values suitable
- * for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false;}return object[key]===srcValue&&(srcValue!==undefined$1||key in Object(object));};}/**
- * A specialized version of `_.memoize` which clears the memoized function's
- * cache when it exceeds `MAX_MEMOIZE_SIZE`.
- *
- * @private
- * @param {Function} func The function to have its output memoized.
- * @returns {Function} Returns the new memoized function.
- */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;}/**
- * Merges the function metadata of `source` into `data`.
- *
- * Merging metadata reduces the number of wrappers used to invoke a function.
- * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
- * may be applied regardless of execution order. Methods like `_.ary` and
- * `_.rearg` modify function arguments, making the order in which they are
- * executed important, preventing the merging of metadata. However, we make
- * an exception for a safe combined case where curried functions have `_.ary`
- * and or `_.rearg` applied.
- *
- * @private
- * @param {Array} data The destination metadata.
- * @param {Array} source The source metadata.
- * @returns {Array} Returns `data`.
- */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.
- if(!(isCommon||isCombo)){return data;}// Use source `thisArg` if available.
- if(srcBitmask&WRAP_BIND_FLAG){data[2]=source[2];// Set when currying a bound function.
- newBitmask|=bitmask&WRAP_BIND_FLAG?0:WRAP_CURRY_BOUND_FLAG;}// Compose partial arguments.
- 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.
- 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.
- value=source[7];if(value){data[7]=value;}// Use source `ary` if it's smaller.
- 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.
- if(data[9]==null){data[9]=source[9];}// Use source `func` and merge bitmasks.
- data[0]=source[0];data[1]=newBitmask;return data;}/**
- * This function is like
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * except that it includes inherited enumerable properties.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key);}}return result;}/**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */function objectToString(value){return nativeObjectToString.call(value);}/**
- * A specialized version of `baseRest` which transforms the rest array.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @param {Function} transform The rest array transform.
- * @returns {Function} Returns the new function.
- */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);};}/**
- * Gets the parent value at `path` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} path The path to get the parent value of.
- * @returns {*} Returns the parent value.
- */function parent(object,path){return path.length<2?object:baseGet(object,baseSlice(path,0,-1));}/**
- * Reorder `array` according to the specified indexes where the element at
- * the first index is assigned as the first element, the element at
- * the second index is assigned as the second element, and so on.
- *
- * @private
- * @param {Array} array The array to reorder.
- * @param {Array} indexes The arranged array indexes.
- * @returns {Array} Returns `array`.
- */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;}/**
- * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */function safeGet(object,key){if(key==='constructor'&&typeof object[key]==='function'){return;}if(key=='__proto__'){return;}return object[key];}/**
- * Sets metadata for `func`.
- *
- * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
- * period of time, it will trip its breaker and transition to an identity
- * function to avoid garbage collection pauses in V8. See
- * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
- * for more details.
- *
- * @private
- * @param {Function} func The function to associate metadata with.
- * @param {*} data The metadata.
- * @returns {Function} Returns `func`.
- */var setData=shortOut(baseSetData);/**
- * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
- *
- * @private
- * @param {Function} func The function to delay.
- * @param {number} wait The number of milliseconds to delay invocation.
- * @returns {number|Object} Returns the timer id or timeout object.
- */var setTimeout=ctxSetTimeout||function(func,wait){return root.setTimeout(func,wait);};/**
- * Sets the `toString` method of `func` to return `string`.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
- */var setToString=shortOut(baseSetToString);/**
- * Sets the `toString` method of `wrapper` to mimic the source of `reference`
- * with wrapper details in a comment at the top of the source body.
- *
- * @private
- * @param {Function} wrapper The function to modify.
- * @param {Function} reference The reference function.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @returns {Function} Returns `wrapper`.
- */function setWrapToString(wrapper,reference,bitmask){var source=reference+'';return setToString(wrapper,insertWrapDetails(source,updateWrapDetails(getWrapDetails(source),bitmask)));}/**
- * Creates a function that'll short out and invoke `identity` instead
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
- * milliseconds.
- *
- * @private
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new shortable function.
- */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);};}/**
- * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
- *
- * @private
- * @param {Array} array The array to shuffle.
- * @param {number} [size=array.length] The size of `array`.
- * @returns {Array} Returns `array`.
- */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;}/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */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;});/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */function toKey(value){if(typeof value=='string'||isSymbol(value)){return value;}var result=value+'';return result=='0'&&1/value==-INFINITY?'-0':result;}/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to convert.
- * @returns {string} Returns the source code.
- */function toSource(func){if(func!=null){try{return funcToString.call(func);}catch(e){}try{return func+'';}catch(e){}}return '';}/**
- * Updates wrapper `details` based on `bitmask` flags.
- *
- * @private
- * @returns {Array} details The details to modify.
- * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
- * @returns {Array} Returns `details`.
- */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();}/**
- * Creates a clone of `wrapper`.
- *
- * @private
- * @param {Object} wrapper The wrapper to clone.
- * @returns {Object} Returns the cloned wrapper.
- */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;}/*------------------------------------------------------------------------*/ /**
- * Creates an array of elements split into groups the length of `size`.
- * If `array` can't be split evenly, the final chunk will be the remaining
- * elements.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to process.
- * @param {number} [size=1] The length of each chunk
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the new array of chunks.
- * @example
- *
- * _.chunk(['a', 'b', 'c', 'd'], 2);
- * // => [['a', 'b'], ['c', 'd']]
- *
- * _.chunk(['a', 'b', 'c', 'd'], 3);
- * // => [['a', 'b', 'c'], ['d']]
- */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;}/**
- * Creates an array with all falsey values removed. The values `false`, `null`,
- * `0`, `""`, `undefined`, and `NaN` are falsey.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to compact.
- * @returns {Array} Returns the new array of filtered values.
- * @example
- *
- * _.compact([0, 1, false, 2, '', 3]);
- * // => [1, 2, 3]
- */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;}/**
- * Creates a new array concatenating `array` with any additional arrays
- * and/or values.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to concatenate.
- * @param {...*} [values] The values to concatenate.
- * @returns {Array} Returns the new concatenated array.
- * @example
- *
- * var array = [1];
- * var other = _.concat(array, 2, [3], [[4]]);
- *
- * console.log(other);
- * // => [1, 2, 3, [4]]
- *
- * console.log(array);
- * // => [1]
- */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));}/**
- * Creates an array of `array` values not included in the other given arrays
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons. The order and references of result values are
- * determined by the first array.
- *
- * **Note:** Unlike `_.pullAll`, this method returns a new array.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {...Array} [values] The values to exclude.
- * @returns {Array} Returns the new array of filtered values.
- * @see _.without, _.xor
- * @example
- *
- * _.difference([2, 1], [2, 3]);
- * // => [1]
- */var difference=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)):[];});/**
- * This method is like `_.difference` except that it accepts `iteratee` which
- * is invoked for each element of `array` and `values` to generate the criterion
- * by which they're compared. The order and references of result values are
- * determined by the first array. The iteratee is invoked with one argument:
- * (value).
- *
- * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {...Array} [values] The values to exclude.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new array of filtered values.
- * @example
- *
- * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
- * // => [1.2]
- *
- * // The `_.property` iteratee shorthand.
- * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
- * // => [{ 'x': 2 }]
- */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)):[];});/**
- * This method is like `_.difference` except that it accepts `comparator`
- * which is invoked to compare elements of `array` to `values`. The order and
- * references of result values are determined by the first array. The comparator
- * is invoked with two arguments: (arrVal, othVal).
- *
- * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {...Array} [values] The values to exclude.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of filtered values.
- * @example
- *
- * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
- *
- * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
- * // => [{ 'x': 2, 'y': 1 }]
- */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):[];});/**
- * Creates a slice of `array` with `n` elements dropped from the beginning.
- *
- * @static
- * @memberOf _
- * @since 0.5.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.drop([1, 2, 3]);
- * // => [2, 3]
- *
- * _.drop([1, 2, 3], 2);
- * // => [3]
- *
- * _.drop([1, 2, 3], 5);
- * // => []
- *
- * _.drop([1, 2, 3], 0);
- * // => [1, 2, 3]
- */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);}/**
- * Creates a slice of `array` with `n` elements dropped from the end.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.dropRight([1, 2, 3]);
- * // => [1, 2]
- *
- * _.dropRight([1, 2, 3], 2);
- * // => [1]
- *
- * _.dropRight([1, 2, 3], 5);
- * // => []
- *
- * _.dropRight([1, 2, 3], 0);
- * // => [1, 2, 3]
- */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);}/**
- * Creates a slice of `array` excluding elements dropped from the end.
- * Elements are dropped until `predicate` returns falsey. The predicate is
- * invoked with three arguments: (value, index, array).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': true },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': false }
- * ];
- *
- * _.dropRightWhile(users, function(o) { return !o.active; });
- * // => objects for ['barney']
- *
- * // The `_.matches` iteratee shorthand.
- * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
- * // => objects for ['barney', 'fred']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.dropRightWhile(users, ['active', false]);
- * // => objects for ['barney']
- *
- * // The `_.property` iteratee shorthand.
- * _.dropRightWhile(users, 'active');
- * // => objects for ['barney', 'fred', 'pebbles']
- */function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[];}/**
- * Creates a slice of `array` excluding elements dropped from the beginning.
- * Elements are dropped until `predicate` returns falsey. The predicate is
- * invoked with three arguments: (value, index, array).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.dropWhile(users, function(o) { return !o.active; });
- * // => objects for ['pebbles']
- *
- * // The `_.matches` iteratee shorthand.
- * _.dropWhile(users, { 'user': 'barney', 'active': false });
- * // => objects for ['fred', 'pebbles']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.dropWhile(users, ['active', false]);
- * // => objects for ['pebbles']
- *
- * // The `_.property` iteratee shorthand.
- * _.dropWhile(users, 'active');
- * // => objects for ['barney', 'fred', 'pebbles']
- */function dropWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true):[];}/**
- * Fills elements of `array` with `value` from `start` up to, but not
- * including, `end`.
- *
- * **Note:** This method mutates `array`.
- *
- * @static
- * @memberOf _
- * @since 3.2.0
- * @category Array
- * @param {Array} array The array to fill.
- * @param {*} value The value to fill `array` with.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = [1, 2, 3];
- *
- * _.fill(array, 'a');
- * console.log(array);
- * // => ['a', 'a', 'a']
- *
- * _.fill(Array(3), 2);
- * // => [2, 2, 2]
- *
- * _.fill([4, 6, 8, 10], '*', 1, 3);
- * // => [4, '*', '*', 10]
- */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);}/**
- * This method is like `_.find` except that it returns the index of the first
- * element `predicate` returns truthy for instead of the element itself.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the found element, else `-1`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.findIndex(users, function(o) { return o.user == 'barney'; });
- * // => 0
- *
- * // The `_.matches` iteratee shorthand.
- * _.findIndex(users, { 'user': 'fred', 'active': false });
- * // => 1
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findIndex(users, ['active', false]);
- * // => 0
- *
- * // The `_.property` iteratee shorthand.
- * _.findIndex(users, 'active');
- * // => 2
- */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);}/**
- * This method is like `_.findIndex` except that it iterates over elements
- * of `collection` from right to left.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=array.length-1] The index to search from.
- * @returns {number} Returns the index of the found element, else `-1`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': true },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': false }
- * ];
- *
- * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
- * // => 2
- *
- * // The `_.matches` iteratee shorthand.
- * _.findLastIndex(users, { 'user': 'barney', 'active': true });
- * // => 0
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findLastIndex(users, ['active', false]);
- * // => 2
- *
- * // The `_.property` iteratee shorthand.
- * _.findLastIndex(users, 'active');
- * // => 0
- */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);}/**
- * Flattens `array` a single level deep.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to flatten.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * _.flatten([1, [2, [3, [4]], 5]]);
- * // => [1, 2, [3, [4]], 5]
- */function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[];}/**
- * Recursively flattens `array`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to flatten.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * _.flattenDeep([1, [2, [3, [4]], 5]]);
- * // => [1, 2, 3, 4, 5]
- */function flattenDeep(array){var length=array==null?0:array.length;return length?baseFlatten(array,INFINITY):[];}/**
- * Recursively flatten `array` up to `depth` times.
- *
- * @static
- * @memberOf _
- * @since 4.4.0
- * @category Array
- * @param {Array} array The array to flatten.
- * @param {number} [depth=1] The maximum recursion depth.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * var array = [1, [2, [3, [4]], 5]];
- *
- * _.flattenDepth(array, 1);
- * // => [1, 2, [3, [4]], 5]
- *
- * _.flattenDepth(array, 2);
- * // => [1, 2, 3, [4], 5]
- */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);}/**
- * The inverse of `_.toPairs`; this method returns an object composed
- * from key-value `pairs`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} pairs The key-value pairs.
- * @returns {Object} Returns the new object.
- * @example
- *
- * _.fromPairs([['a', 1], ['b', 2]]);
- * // => { 'a': 1, 'b': 2 }
- */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;}/**
- * Gets the first element of `array`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @alias first
- * @category Array
- * @param {Array} array The array to query.
- * @returns {*} Returns the first element of `array`.
- * @example
- *
- * _.head([1, 2, 3]);
- * // => 1
- *
- * _.head([]);
- * // => undefined
- */function head(array){return array&&array.length?array[0]:undefined$1;}/**
- * Gets the index at which the first occurrence of `value` is found in `array`
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it's used as the
- * offset from the end of `array`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.indexOf([1, 2, 1, 2], 2);
- * // => 1
- *
- * // Search from the `fromIndex`.
- * _.indexOf([1, 2, 1, 2], 2, 2);
- * // => 3
- */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);}/**
- * Gets all but the last element of `array`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to query.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.initial([1, 2, 3]);
- * // => [1, 2]
- */function initial(array){var length=array==null?0:array.length;return length?baseSlice(array,0,-1):[];}/**
- * Creates an array of unique values that are included in all given arrays
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons. The order and references of result values are
- * determined by the first array.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @returns {Array} Returns the new array of intersecting values.
- * @example
- *
- * _.intersection([2, 1], [2, 3]);
- * // => [2]
- */var intersection=baseRest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[];});/**
- * This method is like `_.intersection` except that it accepts `iteratee`
- * which is invoked for each element of each `arrays` to generate the criterion
- * by which they're compared. The order and references of result values are
- * determined by the first array. The iteratee is invoked with one argument:
- * (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new array of intersecting values.
- * @example
- *
- * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
- * // => [2.1]
- *
- * // The `_.property` iteratee shorthand.
- * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
- * // => [{ 'x': 1 }]
- */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)):[];});/**
- * This method is like `_.intersection` except that it accepts `comparator`
- * which is invoked to compare elements of `arrays`. The order and references
- * of result values are determined by the first array. The comparator is
- * invoked with two arguments: (arrVal, othVal).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of intersecting values.
- * @example
- *
- * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
- * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
- *
- * _.intersectionWith(objects, others, _.isEqual);
- * // => [{ 'x': 1, 'y': 2 }]
- */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):[];});/**
- * Converts all elements in `array` into a string separated by `separator`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to convert.
- * @param {string} [separator=','] The element separator.
- * @returns {string} Returns the joined string.
- * @example
- *
- * _.join(['a', 'b', 'c'], '~');
- * // => 'a~b~c'
- */function join(array,separator){return array==null?'':nativeJoin.call(array,separator);}/**
- * Gets the last element of `array`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to query.
- * @returns {*} Returns the last element of `array`.
- * @example
- *
- * _.last([1, 2, 3]);
- * // => 3
- */function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined$1;}/**
- * This method is like `_.indexOf` except that it iterates over elements of
- * `array` from right to left.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} [fromIndex=array.length-1] The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.lastIndexOf([1, 2, 1, 2], 2);
- * // => 3
- *
- * // Search from the `fromIndex`.
- * _.lastIndexOf([1, 2, 1, 2], 2, 2);
- * // => 1
- */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);}/**
- * Gets the element at index `n` of `array`. If `n` is negative, the nth
- * element from the end is returned.
- *
- * @static
- * @memberOf _
- * @since 4.11.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {number} [n=0] The index of the element to return.
- * @returns {*} Returns the nth element of `array`.
- * @example
- *
- * var array = ['a', 'b', 'c', 'd'];
- *
- * _.nth(array, 1);
- * // => 'b'
- *
- * _.nth(array, -2);
- * // => 'c';
- */function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined$1;}/**
- * Removes all given values from `array` using
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
- * to remove elements from an array by predicate.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {...*} [values] The values to remove.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
- *
- * _.pull(array, 'a', 'c');
- * console.log(array);
- * // => ['b', 'b']
- */var pull=baseRest(pullAll);/**
- * This method is like `_.pull` except that it accepts an array of values to remove.
- *
- * **Note:** Unlike `_.difference`, this method mutates `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {Array} values The values to remove.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
- *
- * _.pullAll(array, ['a', 'c']);
- * console.log(array);
- * // => ['b', 'b']
- */function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array;}/**
- * This method is like `_.pullAll` except that it accepts `iteratee` which is
- * invoked for each element of `array` and `values` to generate the criterion
- * by which they're compared. The iteratee is invoked with one argument: (value).
- *
- * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {Array} values The values to remove.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
- *
- * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
- * console.log(array);
- * // => [{ 'x': 2 }]
- */function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee,2)):array;}/**
- * This method is like `_.pullAll` except that it accepts `comparator` which
- * is invoked to compare elements of `array` to `values`. The comparator is
- * invoked with two arguments: (arrVal, othVal).
- *
- * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
- *
- * @static
- * @memberOf _
- * @since 4.6.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {Array} values The values to remove.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
- *
- * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
- * console.log(array);
- * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
- */function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array,values,undefined$1,comparator):array;}/**
- * Removes elements from `array` corresponding to `indexes` and returns an
- * array of removed elements.
- *
- * **Note:** Unlike `_.at`, this method mutates `array`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {...(number|number[])} [indexes] The indexes of elements to remove.
- * @returns {Array} Returns the new array of removed elements.
- * @example
- *
- * var array = ['a', 'b', 'c', 'd'];
- * var pulled = _.pullAt(array, [1, 3]);
- *
- * console.log(array);
- * // => ['a', 'c']
- *
- * console.log(pulled);
- * // => ['b', 'd']
- */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;});/**
- * Removes all elements from `array` that `predicate` returns truthy for
- * and returns an array of the removed elements. The predicate is invoked
- * with three arguments: (value, index, array).
- *
- * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
- * to pull elements from an array by value.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new array of removed elements.
- * @example
- *
- * var array = [1, 2, 3, 4];
- * var evens = _.remove(array, function(n) {
- * return n % 2 == 0;
- * });
- *
- * console.log(array);
- * // => [1, 3]
- *
- * console.log(evens);
- * // => [2, 4]
- */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;}/**
- * Reverses `array` so that the first element becomes the last, the second
- * element becomes the second to last, and so on.
- *
- * **Note:** This method mutates `array` and is based on
- * [`Array#reverse`](https://mdn.io/Array/reverse).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to modify.
- * @returns {Array} Returns `array`.
- * @example
- *
- * var array = [1, 2, 3];
- *
- * _.reverse(array);
- * // => [3, 2, 1]
- *
- * console.log(array);
- * // => [3, 2, 1]
- */function reverse(array){return array==null?array:nativeReverse.call(array);}/**
- * Creates a slice of `array` from `start` up to, but not including, `end`.
- *
- * **Note:** This method is used instead of
- * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
- * returned.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to slice.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the slice of `array`.
- */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);}/**
- * Uses a binary search to determine the lowest index at which `value`
- * should be inserted into `array` in order to maintain its sort order.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- * @example
- *
- * _.sortedIndex([30, 50], 40);
- * // => 1
- */function sortedIndex(array,value){return baseSortedIndex(array,value);}/**
- * This method is like `_.sortedIndex` except that it accepts `iteratee`
- * which is invoked for `value` and each element of `array` to compute their
- * sort ranking. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- * @example
- *
- * var objects = [{ 'x': 4 }, { 'x': 5 }];
- *
- * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
- * // => 0
- *
- * // The `_.property` iteratee shorthand.
- * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
- * // => 0
- */function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2));}/**
- * This method is like `_.indexOf` except that it performs a binary
- * search on a sorted `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
- * // => 1
- */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;}/**
- * This method is like `_.sortedIndex` except that it returns the highest
- * index at which `value` should be inserted into `array` in order to
- * maintain its sort order.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- * @example
- *
- * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
- * // => 4
- */function sortedLastIndex(array,value){return baseSortedIndex(array,value,true);}/**
- * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
- * which is invoked for `value` and each element of `array` to compute their
- * sort ranking. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The sorted array to inspect.
- * @param {*} value The value to evaluate.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted
- * into `array`.
- * @example
- *
- * var objects = [{ 'x': 4 }, { 'x': 5 }];
- *
- * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
- * // => 1
- *
- * // The `_.property` iteratee shorthand.
- * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
- * // => 1
- */function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2),true);}/**
- * This method is like `_.lastIndexOf` except that it performs a binary
- * search on a sorted `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
- * // => 3
- */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;}/**
- * This method is like `_.uniq` except that it's designed and optimized
- * for sorted arrays.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * _.sortedUniq([1, 1, 2]);
- * // => [1, 2]
- */function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[];}/**
- * This method is like `_.uniqBy` except that it's designed and optimized
- * for sorted arrays.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
- * // => [1.1, 2.3]
- */function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee,2)):[];}/**
- * Gets all but the first element of `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.tail([1, 2, 3]);
- * // => [2, 3]
- */function tail(array){var length=array==null?0:array.length;return length?baseSlice(array,1,length):[];}/**
- * Creates a slice of `array` with `n` elements taken from the beginning.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.take([1, 2, 3]);
- * // => [1]
- *
- * _.take([1, 2, 3], 2);
- * // => [1, 2]
- *
- * _.take([1, 2, 3], 5);
- * // => [1, 2, 3]
- *
- * _.take([1, 2, 3], 0);
- * // => []
- */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);}/**
- * Creates a slice of `array` with `n` elements taken from the end.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * _.takeRight([1, 2, 3]);
- * // => [3]
- *
- * _.takeRight([1, 2, 3], 2);
- * // => [2, 3]
- *
- * _.takeRight([1, 2, 3], 5);
- * // => [1, 2, 3]
- *
- * _.takeRight([1, 2, 3], 0);
- * // => []
- */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);}/**
- * Creates a slice of `array` with elements taken from the end. Elements are
- * taken until `predicate` returns falsey. The predicate is invoked with
- * three arguments: (value, index, array).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': true },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': false }
- * ];
- *
- * _.takeRightWhile(users, function(o) { return !o.active; });
- * // => objects for ['fred', 'pebbles']
- *
- * // The `_.matches` iteratee shorthand.
- * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
- * // => objects for ['pebbles']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.takeRightWhile(users, ['active', false]);
- * // => objects for ['fred', 'pebbles']
- *
- * // The `_.property` iteratee shorthand.
- * _.takeRightWhile(users, 'active');
- * // => []
- */function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[];}/**
- * Creates a slice of `array` with elements taken from the beginning. Elements
- * are taken until `predicate` returns falsey. The predicate is invoked with
- * three arguments: (value, index, array).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Array
- * @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the slice of `array`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.takeWhile(users, function(o) { return !o.active; });
- * // => objects for ['barney', 'fred']
- *
- * // The `_.matches` iteratee shorthand.
- * _.takeWhile(users, { 'user': 'barney', 'active': false });
- * // => objects for ['barney']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.takeWhile(users, ['active', false]);
- * // => objects for ['barney', 'fred']
- *
- * // The `_.property` iteratee shorthand.
- * _.takeWhile(users, 'active');
- * // => []
- */function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[];}/**
- * Creates an array of unique values, in order, from all given arrays using
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @returns {Array} Returns the new array of combined values.
- * @example
- *
- * _.union([2], [1, 2]);
- * // => [2, 1]
- */var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true));});/**
- * This method is like `_.union` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by
- * which uniqueness is computed. Result values are chosen from the first
- * array in which the value occurs. The iteratee is invoked with one argument:
- * (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new array of combined values.
- * @example
- *
- * _.unionBy([2.1], [1.2, 2.3], Math.floor);
- * // => [2.1, 1.2]
- *
- * // The `_.property` iteratee shorthand.
- * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
- * // => [{ 'x': 1 }, { 'x': 2 }]
- */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));});/**
- * This method is like `_.union` except that it accepts `comparator` which
- * is invoked to compare elements of `arrays`. Result values are chosen from
- * the first array in which the value occurs. The comparator is invoked
- * with two arguments: (arrVal, othVal).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of combined values.
- * @example
- *
- * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
- * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
- *
- * _.unionWith(objects, others, _.isEqual);
- * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
- */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);});/**
- * Creates a duplicate-free version of an array, using
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons, in which only the first occurrence of each element
- * is kept. The order of result values is determined by the order they occur
- * in the array.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * _.uniq([2, 1, 2]);
- * // => [2, 1]
- */function uniq(array){return array&&array.length?baseUniq(array):[];}/**
- * This method is like `_.uniq` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the criterion by which
- * uniqueness is computed. The order of result values is determined by the
- * order they occur in the array. The iteratee is invoked with one argument:
- * (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
- * // => [2.1, 1.2]
- *
- * // The `_.property` iteratee shorthand.
- * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
- * // => [{ 'x': 1 }, { 'x': 2 }]
- */function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee,2)):[];}/**
- * This method is like `_.uniq` except that it accepts `comparator` which
- * is invoked to compare elements of `array`. The order of result values is
- * determined by the order they occur in the array.The comparator is invoked
- * with two arguments: (arrVal, othVal).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
- *
- * _.uniqWith(objects, _.isEqual);
- * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
- */function uniqWith(array,comparator){comparator=typeof comparator=='function'?comparator:undefined$1;return array&&array.length?baseUniq(array,undefined$1,comparator):[];}/**
- * This method is like `_.zip` except that it accepts an array of grouped
- * elements and creates an array regrouping the elements to their pre-zip
- * configuration.
- *
- * @static
- * @memberOf _
- * @since 1.2.0
- * @category Array
- * @param {Array} array The array of grouped elements to process.
- * @returns {Array} Returns the new array of regrouped elements.
- * @example
- *
- * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
- * // => [['a', 1, true], ['b', 2, false]]
- *
- * _.unzip(zipped);
- * // => [['a', 'b'], [1, 2], [true, false]]
- */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));});}/**
- * This method is like `_.unzip` except that it accepts `iteratee` to specify
- * how regrouped values should be combined. The iteratee is invoked with the
- * elements of each group: (...group).
- *
- * @static
- * @memberOf _
- * @since 3.8.0
- * @category Array
- * @param {Array} array The array of grouped elements to process.
- * @param {Function} [iteratee=_.identity] The function to combine
- * regrouped values.
- * @returns {Array} Returns the new array of regrouped elements.
- * @example
- *
- * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
- * // => [[1, 10, 100], [2, 20, 200]]
- *
- * _.unzipWith(zipped, _.add);
- * // => [3, 30, 300]
- */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);});}/**
- * Creates an array excluding all given values using
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * **Note:** Unlike `_.pull`, this method returns a new array.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {...*} [values] The values to exclude.
- * @returns {Array} Returns the new array of filtered values.
- * @see _.difference, _.xor
- * @example
- *
- * _.without([2, 1, 2, 3], 1, 2);
- * // => [3]
- */var without=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[];});/**
- * Creates an array of unique values that is the
- * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
- * of the given arrays. The order of result values is determined by the order
- * they occur in the arrays.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @returns {Array} Returns the new array of filtered values.
- * @see _.difference, _.without
- * @example
- *
- * _.xor([2, 1], [2, 3]);
- * // => [1, 3]
- */var xor=baseRest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject));});/**
- * This method is like `_.xor` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by
- * which by which they're compared. The order of result values is determined
- * by the order they occur in the arrays. The iteratee is invoked with one
- * argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Array} Returns the new array of filtered values.
- * @example
- *
- * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
- * // => [1.2, 3.4]
- *
- * // The `_.property` iteratee shorthand.
- * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
- * // => [{ 'x': 2 }]
- */var xorBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined$1;}return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee,2));});/**
- * This method is like `_.xor` except that it accepts `comparator` which is
- * invoked to compare elements of `arrays`. The order of result values is
- * determined by the order they occur in the arrays. The comparator is invoked
- * with two arguments: (arrVal, othVal).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of filtered values.
- * @example
- *
- * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
- * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
- *
- * _.xorWith(objects, others, _.isEqual);
- * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
- */var xorWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=='function'?comparator:undefined$1;return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined$1,comparator);});/**
- * Creates an array of grouped elements, the first of which contains the
- * first elements of the given arrays, the second of which contains the
- * second elements of the given arrays, and so on.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {...Array} [arrays] The arrays to process.
- * @returns {Array} Returns the new array of grouped elements.
- * @example
- *
- * _.zip(['a', 'b'], [1, 2], [true, false]);
- * // => [['a', 1, true], ['b', 2, false]]
- */var zip=baseRest(unzip);/**
- * This method is like `_.fromPairs` except that it accepts two arrays,
- * one of property identifiers and one of corresponding values.
- *
- * @static
- * @memberOf _
- * @since 0.4.0
- * @category Array
- * @param {Array} [props=[]] The property identifiers.
- * @param {Array} [values=[]] The property values.
- * @returns {Object} Returns the new object.
- * @example
- *
- * _.zipObject(['a', 'b'], [1, 2]);
- * // => { 'a': 1, 'b': 2 }
- */function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue);}/**
- * This method is like `_.zipObject` except that it supports property paths.
- *
- * @static
- * @memberOf _
- * @since 4.1.0
- * @category Array
- * @param {Array} [props=[]] The property identifiers.
- * @param {Array} [values=[]] The property values.
- * @returns {Object} Returns the new object.
- * @example
- *
- * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
- * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
- */function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet);}/**
- * This method is like `_.zip` except that it accepts `iteratee` to specify
- * how grouped values should be combined. The iteratee is invoked with the
- * elements of each group: (...group).
- *
- * @static
- * @memberOf _
- * @since 3.8.0
- * @category Array
- * @param {...Array} [arrays] The arrays to process.
- * @param {Function} [iteratee=_.identity] The function to combine
- * grouped values.
- * @returns {Array} Returns the new array of grouped elements.
- * @example
- *
- * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
- * return a + b + c;
- * });
- * // => [111, 222]
- */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);});/*------------------------------------------------------------------------*/ /**
- * Creates a `lodash` wrapper instance that wraps `value` with explicit method
- * chain sequences enabled. The result of such sequences must be unwrapped
- * with `_#value`.
- *
- * @static
- * @memberOf _
- * @since 1.3.0
- * @category Seq
- * @param {*} value The value to wrap.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 },
- * { 'user': 'pebbles', 'age': 1 }
- * ];
- *
- * var youngest = _
- * .chain(users)
- * .sortBy('age')
- * .map(function(o) {
- * return o.user + ' is ' + o.age;
- * })
- * .head()
- * .value();
- * // => 'pebbles is 1'
- */function chain(value){var result=lodash(value);result.__chain__=true;return result;}/**
- * This method invokes `interceptor` and returns `value`. The interceptor
- * is invoked with one argument; (value). The purpose of this method is to
- * "tap into" a method chain sequence in order to modify intermediate results.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Seq
- * @param {*} value The value to provide to `interceptor`.
- * @param {Function} interceptor The function to invoke.
- * @returns {*} Returns `value`.
- * @example
- *
- * _([1, 2, 3])
- * .tap(function(array) {
- * // Mutate input array.
- * array.pop();
- * })
- * .reverse()
- * .value();
- * // => [2, 1]
- */function tap(value,interceptor){interceptor(value);return value;}/**
- * This method is like `_.tap` except that it returns the result of `interceptor`.
- * The purpose of this method is to "pass thru" values replacing intermediate
- * results in a method chain sequence.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Seq
- * @param {*} value The value to provide to `interceptor`.
- * @param {Function} interceptor The function to invoke.
- * @returns {*} Returns the result of `interceptor`.
- * @example
- *
- * _(' abc ')
- * .chain()
- * .trim()
- * .thru(function(value) {
- * return [value];
- * })
- * .value();
- * // => ['abc']
- */function thru(value,interceptor){return interceptor(value);}/**
- * This method is the wrapper version of `_.at`.
- *
- * @name at
- * @memberOf _
- * @since 1.0.0
- * @category Seq
- * @param {...(string|string[])} [paths] The property paths to pick.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
- *
- * _(object).at(['a[0].b.c', 'a[1]']).value();
- * // => [3, 4]
- */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;});});/**
- * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
- *
- * @name chain
- * @memberOf _
- * @since 0.1.0
- * @category Seq
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 }
- * ];
- *
- * // A sequence without explicit chaining.
- * _(users).head();
- * // => { 'user': 'barney', 'age': 36 }
- *
- * // A sequence with explicit chaining.
- * _(users)
- * .chain()
- * .head()
- * .pick('user')
- * .value();
- * // => { 'user': 'barney' }
- */function wrapperChain(){return chain(this);}/**
- * Executes the chain sequence and returns the wrapped result.
- *
- * @name commit
- * @memberOf _
- * @since 3.2.0
- * @category Seq
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var array = [1, 2];
- * var wrapped = _(array).push(3);
- *
- * console.log(array);
- * // => [1, 2]
- *
- * wrapped = wrapped.commit();
- * console.log(array);
- * // => [1, 2, 3]
- *
- * wrapped.last();
- * // => 3
- *
- * console.log(array);
- * // => [1, 2, 3]
- */function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__);}/**
- * Gets the next value on a wrapped object following the
- * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
- *
- * @name next
- * @memberOf _
- * @since 4.0.0
- * @category Seq
- * @returns {Object} Returns the next iterator value.
- * @example
- *
- * var wrapped = _([1, 2]);
- *
- * wrapped.next();
- * // => { 'done': false, 'value': 1 }
- *
- * wrapped.next();
- * // => { 'done': false, 'value': 2 }
- *
- * wrapped.next();
- * // => { 'done': true, 'value': undefined }
- */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};}/**
- * Enables the wrapper to be iterable.
- *
- * @name Symbol.iterator
- * @memberOf _
- * @since 4.0.0
- * @category Seq
- * @returns {Object} Returns the wrapper object.
- * @example
- *
- * var wrapped = _([1, 2]);
- *
- * wrapped[Symbol.iterator]() === wrapped;
- * // => true
- *
- * Array.from(wrapped);
- * // => [1, 2]
- */function wrapperToIterator(){return this;}/**
- * Creates a clone of the chain sequence planting `value` as the wrapped value.
- *
- * @name plant
- * @memberOf _
- * @since 3.2.0
- * @category Seq
- * @param {*} value The value to plant.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * var wrapped = _([1, 2]).map(square);
- * var other = wrapped.plant([3, 4]);
- *
- * other.value();
- * // => [9, 16]
- *
- * wrapped.value();
- * // => [1, 4]
- */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;}/**
- * This method is the wrapper version of `_.reverse`.
- *
- * **Note:** This method mutates the wrapped array.
- *
- * @name reverse
- * @memberOf _
- * @since 0.1.0
- * @category Seq
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var array = [1, 2, 3];
- *
- * _(array).reverse().value()
- * // => [3, 2, 1]
- *
- * console.log(array);
- * // => [3, 2, 1]
- */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);}/**
- * Executes the chain sequence to resolve the unwrapped value.
- *
- * @name value
- * @memberOf _
- * @since 0.1.0
- * @alias toJSON, valueOf
- * @category Seq
- * @returns {*} Returns the resolved unwrapped value.
- * @example
- *
- * _([1, 2, 3]).value();
- * // => [1, 2, 3]
- */function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__);}/*------------------------------------------------------------------------*/ /**
- * Creates an object composed of keys generated from the results of running
- * each element of `collection` thru `iteratee`. The corresponding value of
- * each key is the number of times the key was returned by `iteratee`. The
- * iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 0.5.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
- * @returns {Object} Returns the composed aggregate object.
- * @example
- *
- * _.countBy([6.1, 4.2, 6.3], Math.floor);
- * // => { '4': 1, '6': 2 }
- *
- * // The `_.property` iteratee shorthand.
- * _.countBy(['one', 'two', 'three'], 'length');
- * // => { '3': 2, '5': 1 }
- */var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){++result[key];}else {baseAssignValue(result,key,1);}});/**
- * Checks if `predicate` returns truthy for **all** elements of `collection`.
- * Iteration is stopped once `predicate` returns falsey. The predicate is
- * invoked with three arguments: (value, index|key, collection).
- *
- * **Note:** This method returns `true` for
- * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
- * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
- * elements of empty collections.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {boolean} Returns `true` if all elements pass the predicate check,
- * else `false`.
- * @example
- *
- * _.every([true, 1, null, 'yes'], Boolean);
- * // => false
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': false },
- * { 'user': 'fred', 'age': 40, 'active': false }
- * ];
- *
- * // The `_.matches` iteratee shorthand.
- * _.every(users, { 'user': 'barney', 'active': false });
- * // => false
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.every(users, ['active', false]);
- * // => true
- *
- * // The `_.property` iteratee shorthand.
- * _.every(users, 'active');
- * // => false
- */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));}/**
- * Iterates over elements of `collection`, returning an array of all elements
- * `predicate` returns truthy for. The predicate is invoked with three
- * arguments: (value, index|key, collection).
- *
- * **Note:** Unlike `_.remove`, this method returns a new array.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- * @see _.reject
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
- * ];
- *
- * _.filter(users, function(o) { return !o.active; });
- * // => objects for ['fred']
- *
- * // The `_.matches` iteratee shorthand.
- * _.filter(users, { 'age': 36, 'active': true });
- * // => objects for ['barney']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.filter(users, ['active', false]);
- * // => objects for ['fred']
- *
- * // The `_.property` iteratee shorthand.
- * _.filter(users, 'active');
- * // => objects for ['barney']
- *
- * // Combining several predicates using `_.overEvery` or `_.overSome`.
- * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
- * // => objects for ['fred', 'barney']
- */function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3));}/**
- * Iterates over elements of `collection`, returning the first element
- * `predicate` returns truthy for. The predicate is invoked with three
- * arguments: (value, index|key, collection).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {*} Returns the matched element, else `undefined`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false },
- * { 'user': 'pebbles', 'age': 1, 'active': true }
- * ];
- *
- * _.find(users, function(o) { return o.age < 40; });
- * // => object for 'barney'
- *
- * // The `_.matches` iteratee shorthand.
- * _.find(users, { 'age': 1, 'active': true });
- * // => object for 'pebbles'
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.find(users, ['active', false]);
- * // => object for 'fred'
- *
- * // The `_.property` iteratee shorthand.
- * _.find(users, 'active');
- * // => object for 'barney'
- */var find=createFind(findIndex);/**
- * This method is like `_.find` except that it iterates over elements of
- * `collection` from right to left.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=collection.length-1] The index to search from.
- * @returns {*} Returns the matched element, else `undefined`.
- * @example
- *
- * _.findLast([1, 2, 3, 4], function(n) {
- * return n % 2 == 1;
- * });
- * // => 3
- */var findLast=createFind(findLastIndex);/**
- * Creates a flattened array of values by running each element in `collection`
- * thru `iteratee` and flattening the mapped results. The iteratee is invoked
- * with three arguments: (value, index|key, collection).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * function duplicate(n) {
- * return [n, n];
- * }
- *
- * _.flatMap([1, 2], duplicate);
- * // => [1, 1, 2, 2]
- */function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1);}/**
- * This method is like `_.flatMap` except that it recursively flattens the
- * mapped results.
- *
- * @static
- * @memberOf _
- * @since 4.7.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * function duplicate(n) {
- * return [[[n, n]]];
- * }
- *
- * _.flatMapDeep([1, 2], duplicate);
- * // => [1, 1, 2, 2]
- */function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY);}/**
- * This method is like `_.flatMap` except that it recursively flattens the
- * mapped results up to `depth` times.
- *
- * @static
- * @memberOf _
- * @since 4.7.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {number} [depth=1] The maximum recursion depth.
- * @returns {Array} Returns the new flattened array.
- * @example
- *
- * function duplicate(n) {
- * return [[[n, n]]];
- * }
- *
- * _.flatMapDepth([1, 2], duplicate, 2);
- * // => [[1, 1], [2, 2]]
- */function flatMapDepth(collection,iteratee,depth){depth=depth===undefined$1?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth);}/**
- * Iterates over elements of `collection` and invokes `iteratee` for each element.
- * The iteratee is invoked with three arguments: (value, index|key, collection).
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * **Note:** As with other "Collections" methods, objects with a "length"
- * property are iterated like arrays. To avoid this behavior use `_.forIn`
- * or `_.forOwn` for object iteration.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @alias each
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- * @see _.forEachRight
- * @example
- *
- * _.forEach([1, 2], function(value) {
- * console.log(value);
- * });
- * // => Logs `1` then `2`.
- *
- * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'a' then 'b' (iteration order is not guaranteed).
- */function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,3));}/**
- * This method is like `_.forEach` except that it iterates over elements of
- * `collection` from right to left.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @alias eachRight
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- * @see _.forEach
- * @example
- *
- * _.forEachRight([1, 2], function(value) {
- * console.log(value);
- * });
- * // => Logs `2` then `1`.
- */function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3));}/**
- * Creates an object composed of keys generated from the results of running
- * each element of `collection` thru `iteratee`. The order of grouped values
- * is determined by the order they occur in `collection`. The corresponding
- * value of each key is an array of elements responsible for generating the
- * key. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
- * @returns {Object} Returns the composed aggregate object.
- * @example
- *
- * _.groupBy([6.1, 4.2, 6.3], Math.floor);
- * // => { '4': [4.2], '6': [6.1, 6.3] }
- *
- * // The `_.property` iteratee shorthand.
- * _.groupBy(['one', 'two', 'three'], 'length');
- * // => { '3': ['one', 'two'], '5': ['three'] }
- */var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value);}else {baseAssignValue(result,key,[value]);}});/**
- * Checks if `value` is in `collection`. If `collection` is a string, it's
- * checked for a substring of `value`, otherwise
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * is used for equality comparisons. If `fromIndex` is negative, it's used as
- * the offset from the end of `collection`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object|string} collection The collection to inspect.
- * @param {*} value The value to search for.
- * @param {number} [fromIndex=0] The index to search from.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
- * @returns {boolean} Returns `true` if `value` is found, else `false`.
- * @example
- *
- * _.includes([1, 2, 3], 1);
- * // => true
- *
- * _.includes([1, 2, 3], 1, 2);
- * // => false
- *
- * _.includes({ 'a': 1, 'b': 2 }, 1);
- * // => true
- *
- * _.includes('abcd', 'bc');
- * // => true
- */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;}/**
- * Invokes the method at `path` of each element in `collection`, returning
- * an array of the results of each invoked method. Any additional arguments
- * are provided to each invoked method. If `path` is a function, it's invoked
- * for, and `this` bound to, each element in `collection`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|string} path The path of the method to invoke or
- * the function invoked per iteration.
- * @param {...*} [args] The arguments to invoke each method with.
- * @returns {Array} Returns the array of results.
- * @example
- *
- * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
- * // => [[1, 5, 7], [1, 2, 3]]
- *
- * _.invokeMap([123, 456], String.prototype.split, '');
- * // => [['1', '2', '3'], ['4', '5', '6']]
- */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;});/**
- * Creates an object composed of keys generated from the results of running
- * each element of `collection` thru `iteratee`. The corresponding value of
- * each key is the last element responsible for generating the key. The
- * iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
- * @returns {Object} Returns the composed aggregate object.
- * @example
- *
- * var array = [
- * { 'dir': 'left', 'code': 97 },
- * { 'dir': 'right', 'code': 100 }
- * ];
- *
- * _.keyBy(array, function(o) {
- * return String.fromCharCode(o.code);
- * });
- * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
- *
- * _.keyBy(array, 'dir');
- * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
- */var keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value);});/**
- * Creates an array of values by running each element in `collection` thru
- * `iteratee`. The iteratee is invoked with three arguments:
- * (value, index|key, collection).
- *
- * Many lodash methods are guarded to work as iteratees for methods like
- * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
- *
- * The guarded methods are:
- * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
- * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
- * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
- * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * _.map([4, 8], square);
- * // => [16, 64]
- *
- * _.map({ 'a': 4, 'b': 8 }, square);
- * // => [16, 64] (iteration order is not guaranteed)
- *
- * var users = [
- * { 'user': 'barney' },
- * { 'user': 'fred' }
- * ];
- *
- * // The `_.property` iteratee shorthand.
- * _.map(users, 'user');
- * // => ['barney', 'fred']
- */function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3));}/**
- * This method is like `_.sortBy` except that it allows specifying the sort
- * orders of the iteratees to sort by. If `orders` is unspecified, all values
- * are sorted in ascending order. Otherwise, specify an order of "desc" for
- * descending or "asc" for ascending sort order of corresponding values.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
- * The iteratees to sort by.
- * @param {string[]} [orders] The sort orders of `iteratees`.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
- * @returns {Array} Returns the new sorted array.
- * @example
- *
- * var users = [
- * { 'user': 'fred', 'age': 48 },
- * { 'user': 'barney', 'age': 34 },
- * { 'user': 'fred', 'age': 40 },
- * { 'user': 'barney', 'age': 36 }
- * ];
- *
- * // Sort by `user` in ascending order and by `age` in descending order.
- * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
- */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);}/**
- * Creates an array of elements split into two groups, the first of which
- * contains elements `predicate` returns truthy for, the second of which
- * contains elements `predicate` returns falsey for. The predicate is
- * invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the array of grouped elements.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': false },
- * { 'user': 'fred', 'age': 40, 'active': true },
- * { 'user': 'pebbles', 'age': 1, 'active': false }
- * ];
- *
- * _.partition(users, function(o) { return o.active; });
- * // => objects for [['fred'], ['barney', 'pebbles']]
- *
- * // The `_.matches` iteratee shorthand.
- * _.partition(users, { 'age': 1, 'active': false });
- * // => objects for [['pebbles'], ['barney', 'fred']]
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.partition(users, ['active', false]);
- * // => objects for [['barney', 'pebbles'], ['fred']]
- *
- * // The `_.property` iteratee shorthand.
- * _.partition(users, 'active');
- * // => objects for [['fred'], ['barney', 'pebbles']]
- */var partition=createAggregator(function(result,value,key){result[key?0:1].push(value);},function(){return [[],[]];});/**
- * Reduces `collection` to a value which is the accumulated result of running
- * each element in `collection` thru `iteratee`, where each successive
- * invocation is supplied the return value of the previous. If `accumulator`
- * is not given, the first element of `collection` is used as the initial
- * value. The iteratee is invoked with four arguments:
- * (accumulator, value, index|key, collection).
- *
- * Many lodash methods are guarded to work as iteratees for methods like
- * `_.reduce`, `_.reduceRight`, and `_.transform`.
- *
- * The guarded methods are:
- * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
- * and `sortBy`
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @returns {*} Returns the accumulated value.
- * @see _.reduceRight
- * @example
- *
- * _.reduce([1, 2], function(sum, n) {
- * return sum + n;
- * }, 0);
- * // => 3
- *
- * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
- * (result[value] || (result[value] = [])).push(key);
- * return result;
- * }, {});
- * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
- */function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach);}/**
- * This method is like `_.reduce` except that it iterates over elements of
- * `collection` from right to left.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @returns {*} Returns the accumulated value.
- * @see _.reduce
- * @example
- *
- * var array = [[0, 1], [2, 3], [4, 5]];
- *
- * _.reduceRight(array, function(flattened, other) {
- * return flattened.concat(other);
- * }, []);
- * // => [4, 5, 2, 3, 0, 1]
- */function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight);}/**
- * The opposite of `_.filter`; this method returns the elements of `collection`
- * that `predicate` does **not** return truthy for.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- * @see _.filter
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': false },
- * { 'user': 'fred', 'age': 40, 'active': true }
- * ];
- *
- * _.reject(users, function(o) { return !o.active; });
- * // => objects for ['fred']
- *
- * // The `_.matches` iteratee shorthand.
- * _.reject(users, { 'age': 40, 'active': true });
- * // => objects for ['barney']
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.reject(users, ['active', false]);
- * // => objects for ['fred']
- *
- * // The `_.property` iteratee shorthand.
- * _.reject(users, 'active');
- * // => objects for ['barney']
- */function reject(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)));}/**
- * Gets a random element from `collection`.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to sample.
- * @returns {*} Returns the random element.
- * @example
- *
- * _.sample([1, 2, 3, 4]);
- * // => 2
- */function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection);}/**
- * Gets `n` random elements at unique keys from `collection` up to the
- * size of `collection`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Collection
- * @param {Array|Object} collection The collection to sample.
- * @param {number} [n=1] The number of elements to sample.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the random elements.
- * @example
- *
- * _.sampleSize([1, 2, 3], 2);
- * // => [3, 1]
- *
- * _.sampleSize([1, 2, 3], 4);
- * // => [2, 3, 1]
- */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);}/**
- * Creates an array of shuffled values, using a version of the
- * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to shuffle.
- * @returns {Array} Returns the new shuffled array.
- * @example
- *
- * _.shuffle([1, 2, 3, 4]);
- * // => [4, 1, 3, 2]
- */function shuffle(collection){var func=isArray(collection)?arrayShuffle:baseShuffle;return func(collection);}/**
- * Gets the size of `collection` by returning its length for array-like
- * values or the number of own enumerable string keyed properties for objects.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object|string} collection The collection to inspect.
- * @returns {number} Returns the collection size.
- * @example
- *
- * _.size([1, 2, 3]);
- * // => 3
- *
- * _.size({ 'a': 1, 'b': 2 });
- * // => 2
- *
- * _.size('pebbles');
- * // => 7
- */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;}/**
- * Checks if `predicate` returns truthy for **any** element of `collection`.
- * Iteration is stopped once `predicate` returns truthy. The predicate is
- * invoked with three arguments: (value, index|key, collection).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- * @example
- *
- * _.some([null, 0, 'yes', false], Boolean);
- * // => true
- *
- * var users = [
- * { 'user': 'barney', 'active': true },
- * { 'user': 'fred', 'active': false }
- * ];
- *
- * // The `_.matches` iteratee shorthand.
- * _.some(users, { 'user': 'barney', 'active': false });
- * // => false
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.some(users, ['active', false]);
- * // => true
- *
- * // The `_.property` iteratee shorthand.
- * _.some(users, 'active');
- * // => true
- */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));}/**
- * Creates an array of elements, sorted in ascending order by the results of
- * running each element in a collection thru each iteratee. This method
- * performs a stable sort, that is, it preserves the original sort order of
- * equal elements. The iteratees are invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {...(Function|Function[])} [iteratees=[_.identity]]
- * The iteratees to sort by.
- * @returns {Array} Returns the new sorted array.
- * @example
- *
- * var users = [
- * { 'user': 'fred', 'age': 48 },
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 30 },
- * { 'user': 'barney', 'age': 34 }
- * ];
- *
- * _.sortBy(users, [function(o) { return o.user; }]);
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
- *
- * _.sortBy(users, ['user', 'age']);
- * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
- */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),[]);});/*------------------------------------------------------------------------*/ /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */var now=ctxNow||function(){return root.Date.now();};/*------------------------------------------------------------------------*/ /**
- * The opposite of `_.before`; this method creates a function that invokes
- * `func` once it's called `n` or more times.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {number} n The number of calls before `func` is invoked.
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * var saves = ['profile', 'settings'];
- *
- * var done = _.after(saves.length, function() {
- * console.log('done saving!');
- * });
- *
- * _.forEach(saves, function(type) {
- * asyncSave({ 'type': type, 'complete': done });
- * });
- * // => Logs 'done saving!' after the two async saves have completed.
- */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);}};}/**
- * Creates a function that invokes `func`, with up to `n` arguments,
- * ignoring any additional arguments.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {Function} func The function to cap arguments for.
- * @param {number} [n=func.length] The arity cap.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Function} Returns the new capped function.
- * @example
- *
- * _.map(['6', '8', '10'], _.ary(parseInt, 1));
- * // => [6, 8, 10]
- */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);}/**
- * Creates a function that invokes `func`, with the `this` binding and arguments
- * of the created function, while it's called less than `n` times. Subsequent
- * calls to the created function return the result of the last `func` invocation.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {number} n The number of calls at which `func` is no longer invoked.
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * jQuery(element).on('click', _.before(5, addContactToList));
- * // => Allows adding up to 4 contacts to the list.
- */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;};}/**
- * Creates a function that invokes `func` with the `this` binding of `thisArg`
- * and `partials` prepended to the arguments it receives.
- *
- * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
- * may be used as a placeholder for partially applied arguments.
- *
- * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
- * property of bound functions.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to bind.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {...*} [partials] The arguments to be partially applied.
- * @returns {Function} Returns the new bound function.
- * @example
- *
- * function greet(greeting, punctuation) {
- * return greeting + ' ' + this.user + punctuation;
- * }
- *
- * var object = { 'user': 'fred' };
- *
- * var bound = _.bind(greet, object, 'hi');
- * bound('!');
- * // => 'hi fred!'
- *
- * // Bound with placeholders.
- * var bound = _.bind(greet, object, _, '!');
- * bound('hi');
- * // => 'hi fred!'
- */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);});/**
- * Creates a function that invokes the method at `object[key]` with `partials`
- * prepended to the arguments it receives.
- *
- * This method differs from `_.bind` by allowing bound functions to reference
- * methods that may be redefined or don't yet exist. See
- * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
- * for more details.
- *
- * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
- * builds, may be used as a placeholder for partially applied arguments.
- *
- * @static
- * @memberOf _
- * @since 0.10.0
- * @category Function
- * @param {Object} object The object to invoke the method on.
- * @param {string} key The key of the method.
- * @param {...*} [partials] The arguments to be partially applied.
- * @returns {Function} Returns the new bound function.
- * @example
- *
- * var object = {
- * 'user': 'fred',
- * 'greet': function(greeting, punctuation) {
- * return greeting + ' ' + this.user + punctuation;
- * }
- * };
- *
- * var bound = _.bindKey(object, 'greet', 'hi');
- * bound('!');
- * // => 'hi fred!'
- *
- * object.greet = function(greeting, punctuation) {
- * return greeting + 'ya ' + this.user + punctuation;
- * };
- *
- * bound('!');
- * // => 'hiya fred!'
- *
- * // Bound with placeholders.
- * var bound = _.bindKey(object, 'greet', _, '!');
- * bound('hi');
- * // => 'hiya fred!'
- */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);});/**
- * Creates a function that accepts arguments of `func` and either invokes
- * `func` returning its result, if at least `arity` number of arguments have
- * been provided, or returns a function that accepts the remaining `func`
- * arguments, and so on. The arity of `func` may be specified if `func.length`
- * is not sufficient.
- *
- * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
- * may be used as a placeholder for provided arguments.
- *
- * **Note:** This method doesn't set the "length" property of curried functions.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Function
- * @param {Function} func The function to curry.
- * @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Function} Returns the new curried function.
- * @example
- *
- * var abc = function(a, b, c) {
- * return [a, b, c];
- * };
- *
- * var curried = _.curry(abc);
- *
- * curried(1)(2)(3);
- * // => [1, 2, 3]
- *
- * curried(1, 2)(3);
- * // => [1, 2, 3]
- *
- * curried(1, 2, 3);
- * // => [1, 2, 3]
- *
- * // Curried with placeholders.
- * curried(1)(_, 3)(2);
- * // => [1, 2, 3]
- */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;}/**
- * This method is like `_.curry` except that arguments are applied to `func`
- * in the manner of `_.partialRight` instead of `_.partial`.
- *
- * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
- * builds, may be used as a placeholder for provided arguments.
- *
- * **Note:** This method doesn't set the "length" property of curried functions.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {Function} func The function to curry.
- * @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Function} Returns the new curried function.
- * @example
- *
- * var abc = function(a, b, c) {
- * return [a, b, c];
- * };
- *
- * var curried = _.curryRight(abc);
- *
- * curried(3)(2)(1);
- * // => [1, 2, 3]
- *
- * curried(2, 3)(1);
- * // => [1, 2, 3]
- *
- * curried(1, 2, 3);
- * // => [1, 2, 3]
- *
- * // Curried with placeholders.
- * curried(3)(1, _)(2);
- * // => [1, 2, 3]
- */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;}/**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */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.
- lastInvokeTime=time;// Start the timer for the trailing edge.
- timerId=setTimeout(timerExpired,wait);// Invoke the leading edge.
- 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
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- 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.
- timerId=setTimeout(timerExpired,remainingWait(time));}function trailingEdge(time){timerId=undefined$1;// Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- 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.
- 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;}/**
- * Defers invoking the `func` until the current call stack has cleared. Any
- * additional arguments are provided to `func` when it's invoked.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to defer.
- * @param {...*} [args] The arguments to invoke `func` with.
- * @returns {number} Returns the timer id.
- * @example
- *
- * _.defer(function(text) {
- * console.log(text);
- * }, 'deferred');
- * // => Logs 'deferred' after one millisecond.
- */var defer=baseRest(function(func,args){return baseDelay(func,1,args);});/**
- * Invokes `func` after `wait` milliseconds. Any additional arguments are
- * provided to `func` when it's invoked.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to delay.
- * @param {number} wait The number of milliseconds to delay invocation.
- * @param {...*} [args] The arguments to invoke `func` with.
- * @returns {number} Returns the timer id.
- * @example
- *
- * _.delay(function(text) {
- * console.log(text);
- * }, 1000, 'later');
- * // => Logs 'later' after one second.
- */var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args);});/**
- * Creates a function that invokes `func` with arguments reversed.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Function
- * @param {Function} func The function to flip arguments for.
- * @returns {Function} Returns the new flipped function.
- * @example
- *
- * var flipped = _.flip(function() {
- * return _.toArray(arguments);
- * });
- *
- * flipped('a', 'b', 'c', 'd');
- * // => ['d', 'c', 'b', 'a']
- */function flip(func){return createWrap(func,WRAP_FLIP_FLAG);}/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `clear`, `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */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`.
- memoize.Cache=MapCache;/**
- * Creates a function that negates the result of the predicate `func`. The
- * `func` predicate is invoked with the `this` binding and arguments of the
- * created function.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {Function} predicate The predicate to negate.
- * @returns {Function} Returns the new negated function.
- * @example
- *
- * function isEven(n) {
- * return n % 2 == 0;
- * }
- *
- * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
- * // => [1, 3, 5]
- */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);};}/**
- * Creates a function that is restricted to invoking `func` once. Repeat calls
- * to the function return the value of the first invocation. The `func` is
- * invoked with the `this` binding and arguments of the created function.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * var initialize = _.once(createApplication);
- * initialize();
- * initialize();
- * // => `createApplication` is invoked once
- */function once(func){return before(2,func);}/**
- * Creates a function that invokes `func` with its arguments transformed.
- *
- * @static
- * @since 4.0.0
- * @memberOf _
- * @category Function
- * @param {Function} func The function to wrap.
- * @param {...(Function|Function[])} [transforms=[_.identity]]
- * The argument transforms.
- * @returns {Function} Returns the new function.
- * @example
- *
- * function doubled(n) {
- * return n * 2;
- * }
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * var func = _.overArgs(function(x, y) {
- * return [x, y];
- * }, [square, doubled]);
- *
- * func(9, 3);
- * // => [81, 6]
- *
- * func(10, 5);
- * // => [100, 10]
- */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);});});/**
- * Creates a function that invokes `func` with `partials` prepended to the
- * arguments it receives. This method is like `_.bind` except it does **not**
- * alter the `this` binding.
- *
- * The `_.partial.placeholder` value, which defaults to `_` in monolithic
- * builds, may be used as a placeholder for partially applied arguments.
- *
- * **Note:** This method doesn't set the "length" property of partially
- * applied functions.
- *
- * @static
- * @memberOf _
- * @since 0.2.0
- * @category Function
- * @param {Function} func The function to partially apply arguments to.
- * @param {...*} [partials] The arguments to be partially applied.
- * @returns {Function} Returns the new partially applied function.
- * @example
- *
- * function greet(greeting, name) {
- * return greeting + ' ' + name;
- * }
- *
- * var sayHelloTo = _.partial(greet, 'hello');
- * sayHelloTo('fred');
- * // => 'hello fred'
- *
- * // Partially applied with placeholders.
- * var greetFred = _.partial(greet, _, 'fred');
- * greetFred('hi');
- * // => 'hi fred'
- */var partial=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrap(func,WRAP_PARTIAL_FLAG,undefined$1,partials,holders);});/**
- * This method is like `_.partial` except that partially applied arguments
- * are appended to the arguments it receives.
- *
- * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
- * builds, may be used as a placeholder for partially applied arguments.
- *
- * **Note:** This method doesn't set the "length" property of partially
- * applied functions.
- *
- * @static
- * @memberOf _
- * @since 1.0.0
- * @category Function
- * @param {Function} func The function to partially apply arguments to.
- * @param {...*} [partials] The arguments to be partially applied.
- * @returns {Function} Returns the new partially applied function.
- * @example
- *
- * function greet(greeting, name) {
- * return greeting + ' ' + name;
- * }
- *
- * var greetFred = _.partialRight(greet, 'fred');
- * greetFred('hi');
- * // => 'hi fred'
- *
- * // Partially applied with placeholders.
- * var sayHelloTo = _.partialRight(greet, 'hello', _);
- * sayHelloTo('fred');
- * // => 'hello fred'
- */var partialRight=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrap(func,WRAP_PARTIAL_RIGHT_FLAG,undefined$1,partials,holders);});/**
- * Creates a function that invokes `func` with arguments arranged according
- * to the specified `indexes` where the argument value at the first index is
- * provided as the first argument, the argument value at the second index is
- * provided as the second argument, and so on.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {Function} func The function to rearrange arguments for.
- * @param {...(number|number[])} indexes The arranged argument indexes.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var rearged = _.rearg(function(a, b, c) {
- * return [a, b, c];
- * }, [2, 0, 1]);
- *
- * rearged('b', 'c', 'a')
- * // => ['a', 'b', 'c']
- */var rearg=flatRest(function(func,indexes){return createWrap(func,WRAP_REARG_FLAG,undefined$1,undefined$1,undefined$1,indexes);});/**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as
- * an array.
- *
- * **Note:** This method is based on the
- * [rest parameter](https://mdn.io/rest_parameters).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.rest(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */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);}/**
- * Creates a function that invokes `func` with the `this` binding of the
- * create function and an array of arguments much like
- * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
- *
- * **Note:** This method is based on the
- * [spread operator](https://mdn.io/spread_operator).
- *
- * @static
- * @memberOf _
- * @since 3.2.0
- * @category Function
- * @param {Function} func The function to spread arguments over.
- * @param {number} [start=0] The start position of the spread.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.spread(function(who, what) {
- * return who + ' says ' + what;
- * });
- *
- * say(['fred', 'hello']);
- * // => 'fred says hello'
- *
- * var numbers = Promise.all([
- * Promise.resolve(40),
- * Promise.resolve(36)
- * ]);
- *
- * numbers.then(_.spread(function(x, y) {
- * return x + y;
- * }));
- * // => a Promise of 76
- */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);});}/**
- * Creates a throttled function that only invokes `func` at most once per
- * every `wait` milliseconds. The throttled function comes with a `cancel`
- * method to cancel delayed `func` invocations and a `flush` method to
- * immediately invoke them. Provide `options` to indicate whether `func`
- * should be invoked on the leading and/or trailing edge of the `wait`
- * timeout. The `func` is invoked with the last arguments provided to the
- * throttled function. Subsequent calls to the throttled function return the
- * result of the last `func` invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the throttled function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.throttle` and `_.debounce`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to throttle.
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=true]
- * Specify invoking on the leading edge of the timeout.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new throttled function.
- * @example
- *
- * // Avoid excessively updating the position while scrolling.
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
- *
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
- * jQuery(element).on('click', throttled);
- *
- * // Cancel the trailing throttled invocation.
- * jQuery(window).on('popstate', throttled.cancel);
- */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});}/**
- * Creates a function that accepts up to one argument, ignoring any
- * additional arguments.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Function
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- * @example
- *
- * _.map(['6', '8', '10'], _.unary(parseInt));
- * // => [6, 8, 10]
- */function unary(func){return ary(func,1);}/**
- * Creates a function that provides `value` to `wrapper` as its first
- * argument. Any additional arguments provided to the function are appended
- * to those provided to the `wrapper`. The wrapper is invoked with the `this`
- * binding of the created function.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {*} value The value to wrap.
- * @param {Function} [wrapper=identity] The wrapper function.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var p = _.wrap(_.escape, function(func, text) {
- * return '<p>' + func(text) + '</p>';
- * });
- *
- * p('fred, barney, & pebbles');
- * // => '<p>fred, barney, & pebbles</p>'
- */function wrap(value,wrapper){return partial(castFunction(wrapper),value);}/*------------------------------------------------------------------------*/ /**
- * Casts `value` as an array if it's not one.
- *
- * @static
- * @memberOf _
- * @since 4.4.0
- * @category Lang
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast array.
- * @example
- *
- * _.castArray(1);
- * // => [1]
- *
- * _.castArray({ 'a': 1 });
- * // => [{ 'a': 1 }]
- *
- * _.castArray('abc');
- * // => ['abc']
- *
- * _.castArray(null);
- * // => [null]
- *
- * _.castArray(undefined);
- * // => [undefined]
- *
- * _.castArray();
- * // => []
- *
- * var array = [1, 2, 3];
- * console.log(_.castArray(array) === array);
- * // => true
- */function castArray(){if(!arguments.length){return [];}var value=arguments[0];return isArray(value)?value:[value];}/**
- * Creates a shallow clone of `value`.
- *
- * **Note:** This method is loosely based on the
- * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
- * and supports cloning arrays, array buffers, booleans, date objects, maps,
- * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
- * arrays. The own enumerable properties of `arguments` objects are cloned
- * as plain objects. An empty object is returned for uncloneable values such
- * as error objects, functions, DOM nodes, and WeakMaps.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to clone.
- * @returns {*} Returns the cloned value.
- * @see _.cloneDeep
- * @example
- *
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
- *
- * var shallow = _.clone(objects);
- * console.log(shallow[0] === objects[0]);
- * // => true
- */function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG);}/**
- * This method is like `_.clone` except that it accepts `customizer` which
- * is invoked to produce the cloned value. If `customizer` returns `undefined`,
- * cloning is handled by the method instead. The `customizer` is invoked with
- * up to four arguments; (value [, index|key, object, stack]).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to clone.
- * @param {Function} [customizer] The function to customize cloning.
- * @returns {*} Returns the cloned value.
- * @see _.cloneDeepWith
- * @example
- *
- * function customizer(value) {
- * if (_.isElement(value)) {
- * return value.cloneNode(false);
- * }
- * }
- *
- * var el = _.cloneWith(document.body, customizer);
- *
- * console.log(el === document.body);
- * // => false
- * console.log(el.nodeName);
- * // => 'BODY'
- * console.log(el.childNodes.length);
- * // => 0
- */function cloneWith(value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseClone(value,CLONE_SYMBOLS_FLAG,customizer);}/**
- * This method is like `_.clone` except that it recursively clones `value`.
- *
- * @static
- * @memberOf _
- * @since 1.0.0
- * @category Lang
- * @param {*} value The value to recursively clone.
- * @returns {*} Returns the deep cloned value.
- * @see _.clone
- * @example
- *
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
- *
- * var deep = _.cloneDeep(objects);
- * console.log(deep[0] === objects[0]);
- * // => false
- */function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG);}/**
- * This method is like `_.cloneWith` except that it recursively clones `value`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to recursively clone.
- * @param {Function} [customizer] The function to customize cloning.
- * @returns {*} Returns the deep cloned value.
- * @see _.cloneWith
- * @example
- *
- * function customizer(value) {
- * if (_.isElement(value)) {
- * return value.cloneNode(true);
- * }
- * }
- *
- * var el = _.cloneDeepWith(document.body, customizer);
- *
- * console.log(el === document.body);
- * // => false
- * console.log(el.nodeName);
- * // => 'BODY'
- * console.log(el.childNodes.length);
- * // => 20
- */function cloneDeepWith(value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer);}/**
- * Checks if `object` conforms to `source` by invoking the predicate
- * properties of `source` with the corresponding property values of `object`.
- *
- * **Note:** This method is equivalent to `_.conforms` when `source` is
- * partially applied.
- *
- * @static
- * @memberOf _
- * @since 4.14.0
- * @category Lang
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property predicates to conform to.
- * @returns {boolean} Returns `true` if `object` conforms, else `false`.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- *
- * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
- * // => true
- *
- * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
- * // => false
- */function conformsTo(object,source){return source==null||baseConformsTo(object,source,keys(source));}/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */function eq(value,other){return value===other||value!==value&&other!==other;}/**
- * Checks if `value` is greater than `other`.
- *
- * @static
- * @memberOf _
- * @since 3.9.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than `other`,
- * else `false`.
- * @see _.lt
- * @example
- *
- * _.gt(3, 1);
- * // => true
- *
- * _.gt(3, 3);
- * // => false
- *
- * _.gt(1, 3);
- * // => false
- */var gt=createRelationalOperation(baseGt);/**
- * Checks if `value` is greater than or equal to `other`.
- *
- * @static
- * @memberOf _
- * @since 3.9.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than or equal to
- * `other`, else `false`.
- * @see _.lte
- * @example
- *
- * _.gte(3, 1);
- * // => true
- *
- * _.gte(3, 3);
- * // => true
- *
- * _.gte(1, 3);
- * // => false
- */var gte=createRelationalOperation(function(value,other){return value>=other;});/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */var isArguments=baseIsArguments(function(){return arguments;}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,'callee')&&!propertyIsEnumerable.call(value,'callee');};/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */var isArray=Array.isArray;/**
- * Checks if `value` is classified as an `ArrayBuffer` object.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
- * @example
- *
- * _.isArrayBuffer(new ArrayBuffer(2));
- * // => true
- *
- * _.isArrayBuffer(new Array(2));
- * // => false
- */var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value);}/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value);}/**
- * Checks if `value` is classified as a boolean primitive or object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
- * @example
- *
- * _.isBoolean(false);
- * // => true
- *
- * _.isBoolean(null);
- * // => false
- */function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag;}/**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */var isBuffer=nativeIsBuffer||stubFalse;/**
- * Checks if `value` is classified as a `Date` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
- * @example
- *
- * _.isDate(new Date);
- * // => true
- *
- * _.isDate('Mon April 23 2012');
- * // => false
- */var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;/**
- * Checks if `value` is likely a DOM element.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
- * @example
- *
- * _.isElement(document.body);
- * // => true
- *
- * _.isElement('<body>');
- * // => false
- */function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value);}/**
- * Checks if `value` is an empty object, collection, map, or set.
- *
- * Objects are considered empty if they have no own enumerable string keyed
- * properties.
- *
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
- * jQuery-like collections are considered empty if they have a `length` of `0`.
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
- * @example
- *
- * _.isEmpty(null);
- * // => true
- *
- * _.isEmpty(true);
- * // => true
- *
- * _.isEmpty(1);
- * // => true
- *
- * _.isEmpty([1, 2, 3]);
- * // => false
- *
- * _.isEmpty({ 'a': 1 });
- * // => false
- */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;}/**
- * Performs a deep comparison between two values to determine if they are
- * equivalent.
- *
- * **Note:** This method supports comparing arrays, array buffers, booleans,
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
- * by their own, not inherited, enumerable properties. Functions and DOM
- * nodes are compared by strict equality, i.e. `===`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.isEqual(object, other);
- * // => true
- *
- * object === other;
- * // => false
- */function isEqual(value,other){return baseIsEqual(value,other);}/**
- * This method is like `_.isEqual` except that it accepts `customizer` which
- * is invoked to compare values. If `customizer` returns `undefined`, comparisons
- * are handled by the method instead. The `customizer` is invoked with up to
- * six arguments: (objValue, othValue [, index|key, object, other, stack]).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * function isGreeting(value) {
- * return /^h(?:i|ello)$/.test(value);
- * }
- *
- * function customizer(objValue, othValue) {
- * if (isGreeting(objValue) && isGreeting(othValue)) {
- * return true;
- * }
- * }
- *
- * var array = ['hello', 'goodbye'];
- * var other = ['hi', 'goodbye'];
- *
- * _.isEqualWith(array, other, customizer);
- * // => true
- */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;}/**
- * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
- * `SyntaxError`, `TypeError`, or `URIError` object.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
- * @example
- *
- * _.isError(new Error);
- * // => true
- *
- * _.isError(Error);
- * // => false
- */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);}/**
- * Checks if `value` is a finite primitive number.
- *
- * **Note:** This method is based on
- * [`Number.isFinite`](https://mdn.io/Number/isFinite).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
- * @example
- *
- * _.isFinite(3);
- * // => true
- *
- * _.isFinite(Number.MIN_VALUE);
- * // => true
- *
- * _.isFinite(Infinity);
- * // => false
- *
- * _.isFinite('3');
- * // => false
- */function isFinite(value){return typeof value=='number'&&nativeIsFinite(value);}/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */function isFunction(value){if(!isObject(value)){return false;}// The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag;}/**
- * Checks if `value` is an integer.
- *
- * **Note:** This method is based on
- * [`Number.isInteger`](https://mdn.io/Number/isInteger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
- * @example
- *
- * _.isInteger(3);
- * // => true
- *
- * _.isInteger(Number.MIN_VALUE);
- * // => false
- *
- * _.isInteger(Infinity);
- * // => false
- *
- * _.isInteger('3');
- * // => false
- */function isInteger(value){return typeof value=='number'&&value==toInteger(value);}/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */function isLength(value){return typeof value=='number'&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER;}/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */function isObject(value){var type=typeof value;return value!=null&&(type=='object'||type=='function');}/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */function isObjectLike(value){return value!=null&&typeof value=='object';}/**
- * Checks if `value` is classified as a `Map` object.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
- * @example
- *
- * _.isMap(new Map);
- * // => true
- *
- * _.isMap(new WeakMap);
- * // => false
- */var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;/**
- * Performs a partial deep comparison between `object` and `source` to
- * determine if `object` contains equivalent property values.
- *
- * **Note:** This method is equivalent to `_.matches` when `source` is
- * partially applied.
- *
- * Partial comparisons will match empty array and empty object `source`
- * values against any array or object value, respectively. See `_.isEqual`
- * for a list of supported value comparisons.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- *
- * _.isMatch(object, { 'b': 2 });
- * // => true
- *
- * _.isMatch(object, { 'b': 1 });
- * // => false
- */function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source));}/**
- * This method is like `_.isMatch` except that it accepts `customizer` which
- * is invoked to compare values. If `customizer` returns `undefined`, comparisons
- * are handled by the method instead. The `customizer` is invoked with five
- * arguments: (objValue, srcValue, index|key, object, source).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- * @example
- *
- * function isGreeting(value) {
- * return /^h(?:i|ello)$/.test(value);
- * }
- *
- * function customizer(objValue, srcValue) {
- * if (isGreeting(objValue) && isGreeting(srcValue)) {
- * return true;
- * }
- * }
- *
- * var object = { 'greeting': 'hello' };
- * var source = { 'greeting': 'hi' };
- *
- * _.isMatchWith(object, source, customizer);
- * // => true
- */function isMatchWith(object,source,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return baseIsMatch(object,source,getMatchData(source),customizer);}/**
- * Checks if `value` is `NaN`.
- *
- * **Note:** This method is based on
- * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
- * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
- * `undefined` and other non-number values.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
- * @example
- *
- * _.isNaN(NaN);
- * // => true
- *
- * _.isNaN(new Number(NaN));
- * // => true
- *
- * isNaN(undefined);
- * // => true
- *
- * _.isNaN(undefined);
- * // => false
- */function isNaN(value){// An `NaN` primitive is the only value that is not equal to itself.
- // Perform the `toStringTag` check first to avoid errors with some
- // ActiveX objects in IE.
- return isNumber(value)&&value!=+value;}/**
- * Checks if `value` is a pristine native function.
- *
- * **Note:** This method can't reliably detect native functions in the presence
- * of the core-js package because core-js circumvents this kind of detection.
- * Despite multiple requests, the core-js maintainer has made it clear: any
- * attempt to fix the detection will be obstructed. As a result, we're left
- * with little choice but to throw an error. Unfortunately, this also affects
- * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
- * which rely on core-js.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */function isNative(value){if(isMaskable(value)){throw new Error(CORE_ERROR_TEXT);}return baseIsNative(value);}/**
- * Checks if `value` is `null`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
- * @example
- *
- * _.isNull(null);
- * // => true
- *
- * _.isNull(void 0);
- * // => false
- */function isNull(value){return value===null;}/**
- * Checks if `value` is `null` or `undefined`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
- * @example
- *
- * _.isNil(null);
- * // => true
- *
- * _.isNil(void 0);
- * // => true
- *
- * _.isNil(NaN);
- * // => false
- */function isNil(value){return value==null;}/**
- * Checks if `value` is classified as a `Number` primitive or object.
- *
- * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
- * classified as numbers, use the `_.isFinite` method.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a number, else `false`.
- * @example
- *
- * _.isNumber(3);
- * // => true
- *
- * _.isNumber(Number.MIN_VALUE);
- * // => true
- *
- * _.isNumber(Infinity);
- * // => true
- *
- * _.isNumber('3');
- * // => false
- */function isNumber(value){return typeof value=='number'||isObjectLike(value)&&baseGetTag(value)==numberTag;}/**
- * Checks if `value` is a plain object, that is, an object created by the
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
- *
- * @static
- * @memberOf _
- * @since 0.8.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * _.isPlainObject(new Foo);
- * // => false
- *
- * _.isPlainObject([1, 2, 3]);
- * // => false
- *
- * _.isPlainObject({ 'x': 0, 'y': 0 });
- * // => true
- *
- * _.isPlainObject(Object.create(null));
- * // => true
- */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;}/**
- * Checks if `value` is classified as a `RegExp` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
- * @example
- *
- * _.isRegExp(/abc/);
- * // => true
- *
- * _.isRegExp('/abc/');
- * // => false
- */var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;/**
- * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
- * double precision number which isn't the result of a rounded unsafe integer.
- *
- * **Note:** This method is based on
- * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
- * @example
- *
- * _.isSafeInteger(3);
- * // => true
- *
- * _.isSafeInteger(Number.MIN_VALUE);
- * // => false
- *
- * _.isSafeInteger(Infinity);
- * // => false
- *
- * _.isSafeInteger('3');
- * // => false
- */function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER;}/**
- * Checks if `value` is classified as a `Set` object.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
- * @example
- *
- * _.isSet(new Set);
- * // => true
- *
- * _.isSet(new WeakSet);
- * // => false
- */var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;/**
- * Checks if `value` is classified as a `String` primitive or object.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
- * @example
- *
- * _.isString('abc');
- * // => true
- *
- * _.isString(1);
- * // => false
- */function isString(value){return typeof value=='string'||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag;}/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */function isSymbol(value){return typeof value=='symbol'||isObjectLike(value)&&baseGetTag(value)==symbolTag;}/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;/**
- * Checks if `value` is `undefined`.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
- * @example
- *
- * _.isUndefined(void 0);
- * // => true
- *
- * _.isUndefined(null);
- * // => false
- */function isUndefined(value){return value===undefined$1;}/**
- * Checks if `value` is classified as a `WeakMap` object.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
- * @example
- *
- * _.isWeakMap(new WeakMap);
- * // => true
- *
- * _.isWeakMap(new Map);
- * // => false
- */function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag;}/**
- * Checks if `value` is classified as a `WeakSet` object.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
- * @example
- *
- * _.isWeakSet(new WeakSet);
- * // => true
- *
- * _.isWeakSet(new Set);
- * // => false
- */function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag;}/**
- * Checks if `value` is less than `other`.
- *
- * @static
- * @memberOf _
- * @since 3.9.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than `other`,
- * else `false`.
- * @see _.gt
- * @example
- *
- * _.lt(1, 3);
- * // => true
- *
- * _.lt(3, 3);
- * // => false
- *
- * _.lt(3, 1);
- * // => false
- */var lt=createRelationalOperation(baseLt);/**
- * Checks if `value` is less than or equal to `other`.
- *
- * @static
- * @memberOf _
- * @since 3.9.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than or equal to
- * `other`, else `false`.
- * @see _.gte
- * @example
- *
- * _.lte(1, 3);
- * // => true
- *
- * _.lte(3, 3);
- * // => true
- *
- * _.lte(3, 1);
- * // => false
- */var lte=createRelationalOperation(function(value,other){return value<=other;});/**
- * Converts `value` to an array.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {Array} Returns the converted array.
- * @example
- *
- * _.toArray({ 'a': 1, 'b': 2 });
- * // => [1, 2]
- *
- * _.toArray('abc');
- * // => ['a', 'b', 'c']
- *
- * _.toArray(1);
- * // => []
- *
- * _.toArray(null);
- * // => []
- */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);}/**
- * Converts `value` to a finite number.
- *
- * @static
- * @memberOf _
- * @since 4.12.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted number.
- * @example
- *
- * _.toFinite(3.2);
- * // => 3.2
- *
- * _.toFinite(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toFinite(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toFinite('3.2');
- * // => 3.2
- */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;}/**
- * Converts `value` to an integer.
- *
- * **Note:** This method is loosely based on
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3.2);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3.2');
- * // => 3
- */function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0;}/**
- * Converts `value` to an integer suitable for use as the length of an
- * array-like object.
- *
- * **Note:** This method is based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toLength(3.2);
- * // => 3
- *
- * _.toLength(Number.MIN_VALUE);
- * // => 0
- *
- * _.toLength(Infinity);
- * // => 4294967295
- *
- * _.toLength('3.2');
- * // => 3
- */function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0;}/**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */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;}/**
- * Converts `value` to a plain object flattening inherited enumerable string
- * keyed properties of `value` to own properties of the plain object.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {Object} Returns the converted plain object.
- * @example
- *
- * function Foo() {
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.assign({ 'a': 1 }, new Foo);
- * // => { 'a': 1, 'b': 2 }
- *
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
- * // => { 'a': 1, 'b': 2, 'c': 3 }
- */function toPlainObject(value){return copyObject(value,keysIn(value));}/**
- * Converts `value` to a safe integer. A safe integer can be compared and
- * represented correctly.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toSafeInteger(3.2);
- * // => 3
- *
- * _.toSafeInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toSafeInteger(Infinity);
- * // => 9007199254740991
- *
- * _.toSafeInteger('3.2');
- * // => 3
- */function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0;}/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */function toString(value){return value==null?'':baseToString(value);}/*------------------------------------------------------------------------*/ /**
- * Assigns own enumerable string keyed properties of source objects to the
- * destination object. Source objects are applied from left to right.
- * Subsequent sources overwrite property assignments of previous sources.
- *
- * **Note:** This method mutates `object` and is loosely based on
- * [`Object.assign`](https://mdn.io/Object/assign).
- *
- * @static
- * @memberOf _
- * @since 0.10.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @see _.assignIn
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * function Bar() {
- * this.c = 3;
- * }
- *
- * Foo.prototype.b = 2;
- * Bar.prototype.d = 4;
- *
- * _.assign({ 'a': 0 }, new Foo, new Bar);
- * // => { 'a': 1, 'c': 3 }
- */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]);}}});/**
- * This method is like `_.assign` except that it iterates over own and
- * inherited source properties.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias extend
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @see _.assign
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * function Bar() {
- * this.c = 3;
- * }
- *
- * Foo.prototype.b = 2;
- * Bar.prototype.d = 4;
- *
- * _.assignIn({ 'a': 0 }, new Foo, new Bar);
- * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
- */var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object);});/**
- * This method is like `_.assignIn` except that it accepts `customizer`
- * which is invoked to produce the assigned values. If `customizer` returns
- * `undefined`, assignment is handled by the method instead. The `customizer`
- * is invoked with five arguments: (objValue, srcValue, key, object, source).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias extendWith
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} sources The source objects.
- * @param {Function} [customizer] The function to customize assigned values.
- * @returns {Object} Returns `object`.
- * @see _.assignWith
- * @example
- *
- * function customizer(objValue, srcValue) {
- * return _.isUndefined(objValue) ? srcValue : objValue;
- * }
- *
- * var defaults = _.partialRight(_.assignInWith, customizer);
- *
- * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
- * // => { 'a': 1, 'b': 2 }
- */var assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer);});/**
- * This method is like `_.assign` except that it accepts `customizer`
- * which is invoked to produce the assigned values. If `customizer` returns
- * `undefined`, assignment is handled by the method instead. The `customizer`
- * is invoked with five arguments: (objValue, srcValue, key, object, source).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} sources The source objects.
- * @param {Function} [customizer] The function to customize assigned values.
- * @returns {Object} Returns `object`.
- * @see _.assignInWith
- * @example
- *
- * function customizer(objValue, srcValue) {
- * return _.isUndefined(objValue) ? srcValue : objValue;
- * }
- *
- * var defaults = _.partialRight(_.assignWith, customizer);
- *
- * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
- * // => { 'a': 1, 'b': 2 }
- */var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer);});/**
- * Creates an array of values corresponding to `paths` of `object`.
- *
- * @static
- * @memberOf _
- * @since 1.0.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {...(string|string[])} [paths] The property paths to pick.
- * @returns {Array} Returns the picked values.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
- *
- * _.at(object, ['a[0].b.c', 'a[1]']);
- * // => [3, 4]
- */var at=flatRest(baseAt);/**
- * Creates an object that inherits from the `prototype` object. If a
- * `properties` object is given, its own enumerable string keyed properties
- * are assigned to the created object.
- *
- * @static
- * @memberOf _
- * @since 2.3.0
- * @category Object
- * @param {Object} prototype The object to inherit from.
- * @param {Object} [properties] The properties to assign to the object.
- * @returns {Object} Returns the new object.
- * @example
- *
- * function Shape() {
- * this.x = 0;
- * this.y = 0;
- * }
- *
- * function Circle() {
- * Shape.call(this);
- * }
- *
- * Circle.prototype = _.create(Shape.prototype, {
- * 'constructor': Circle
- * });
- *
- * var circle = new Circle;
- * circle instanceof Circle;
- * // => true
- *
- * circle instanceof Shape;
- * // => true
- */function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties);}/**
- * Assigns own and inherited enumerable string keyed properties of source
- * objects to the destination object for all destination properties that
- * resolve to `undefined`. Source objects are applied from left to right.
- * Once a property is set, additional values of the same property are ignored.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @see _.defaultsDeep
- * @example
- *
- * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
- * // => { 'a': 1, 'b': 2 }
- */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;});/**
- * This method is like `_.defaults` except that it recursively assigns
- * default properties.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 3.10.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @see _.defaults
- * @example
- *
- * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
- * // => { 'a': { 'b': 2, 'c': 3 } }
- */var defaultsDeep=baseRest(function(args){args.push(undefined$1,customDefaultsMerge);return apply(mergeWith,undefined$1,args);});/**
- * This method is like `_.find` except that it returns the key of the first
- * element `predicate` returns truthy for instead of the element itself.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Object
- * @param {Object} object The object to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element,
- * else `undefined`.
- * @example
- *
- * var users = {
- * 'barney': { 'age': 36, 'active': true },
- * 'fred': { 'age': 40, 'active': false },
- * 'pebbles': { 'age': 1, 'active': true }
- * };
- *
- * _.findKey(users, function(o) { return o.age < 40; });
- * // => 'barney' (iteration order is not guaranteed)
- *
- * // The `_.matches` iteratee shorthand.
- * _.findKey(users, { 'age': 1, 'active': true });
- * // => 'pebbles'
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findKey(users, ['active', false]);
- * // => 'fred'
- *
- * // The `_.property` iteratee shorthand.
- * _.findKey(users, 'active');
- * // => 'barney'
- */function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn);}/**
- * This method is like `_.findKey` except that it iterates over elements of
- * a collection in the opposite order.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Object
- * @param {Object} object The object to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element,
- * else `undefined`.
- * @example
- *
- * var users = {
- * 'barney': { 'age': 36, 'active': true },
- * 'fred': { 'age': 40, 'active': false },
- * 'pebbles': { 'age': 1, 'active': true }
- * };
- *
- * _.findLastKey(users, function(o) { return o.age < 40; });
- * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
- *
- * // The `_.matches` iteratee shorthand.
- * _.findLastKey(users, { 'age': 36, 'active': true });
- * // => 'barney'
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findLastKey(users, ['active', false]);
- * // => 'fred'
- *
- * // The `_.property` iteratee shorthand.
- * _.findLastKey(users, 'active');
- * // => 'pebbles'
- */function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight);}/**
- * Iterates over own and inherited enumerable string keyed properties of an
- * object and invokes `iteratee` for each property. The iteratee is invoked
- * with three arguments: (value, key, object). Iteratee functions may exit
- * iteration early by explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @since 0.3.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @see _.forInRight
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forIn(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
- */function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn);}/**
- * This method is like `_.forIn` except that it iterates over properties of
- * `object` in the opposite order.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @see _.forIn
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forInRight(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
- */function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn);}/**
- * Iterates over own enumerable string keyed properties of an object and
- * invokes `iteratee` for each property. The iteratee is invoked with three
- * arguments: (value, key, object). Iteratee functions may exit iteration
- * early by explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @since 0.3.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @see _.forOwnRight
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forOwn(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'a' then 'b' (iteration order is not guaranteed).
- */function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3));}/**
- * This method is like `_.forOwn` except that it iterates over properties of
- * `object` in the opposite order.
- *
- * @static
- * @memberOf _
- * @since 2.0.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @see _.forOwn
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forOwnRight(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
- */function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3));}/**
- * Creates an array of function property names from own enumerable properties
- * of `object`.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to inspect.
- * @returns {Array} Returns the function names.
- * @see _.functionsIn
- * @example
- *
- * function Foo() {
- * this.a = _.constant('a');
- * this.b = _.constant('b');
- * }
- *
- * Foo.prototype.c = _.constant('c');
- *
- * _.functions(new Foo);
- * // => ['a', 'b']
- */function functions(object){return object==null?[]:baseFunctions(object,keys(object));}/**
- * Creates an array of function property names from own and inherited
- * enumerable properties of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to inspect.
- * @returns {Array} Returns the function names.
- * @see _.functions
- * @example
- *
- * function Foo() {
- * this.a = _.constant('a');
- * this.b = _.constant('b');
- * }
- *
- * Foo.prototype.c = _.constant('c');
- *
- * _.functionsIn(new Foo);
- * // => ['a', 'b', 'c']
- */function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object));}/**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is returned in its place.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */function get(object,path,defaultValue){var result=object==null?undefined$1:baseGet(object,path);return result===undefined$1?defaultValue:result;}/**
- * Checks if `path` is a direct property of `object`.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = { 'a': { 'b': 2 } };
- * var other = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.has(object, 'a');
- * // => true
- *
- * _.has(object, 'a.b');
- * // => true
- *
- * _.has(object, ['a', 'b']);
- * // => true
- *
- * _.has(other, 'a');
- * // => false
- */function has(object,path){return object!=null&&hasPath(object,path,baseHas);}/**
- * Checks if `path` is a direct or inherited property of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.hasIn(object, 'a');
- * // => true
- *
- * _.hasIn(object, 'a.b');
- * // => true
- *
- * _.hasIn(object, ['a', 'b']);
- * // => true
- *
- * _.hasIn(object, 'b');
- * // => false
- */function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn);}/**
- * Creates an object composed of the inverted keys and values of `object`.
- * If `object` contains duplicate values, subsequent values overwrite
- * property assignments of previous values.
- *
- * @static
- * @memberOf _
- * @since 0.7.0
- * @category Object
- * @param {Object} object The object to invert.
- * @returns {Object} Returns the new inverted object.
- * @example
- *
- * var object = { 'a': 1, 'b': 2, 'c': 1 };
- *
- * _.invert(object);
- * // => { '1': 'c', '2': 'b' }
- */var invert=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!='function'){value=nativeObjectToString.call(value);}result[value]=key;},constant(identity));/**
- * This method is like `_.invert` except that the inverted object is generated
- * from the results of running each element of `object` thru `iteratee`. The
- * corresponding inverted value of each inverted key is an array of keys
- * responsible for generating the inverted value. The iteratee is invoked
- * with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.1.0
- * @category Object
- * @param {Object} object The object to invert.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {Object} Returns the new inverted object.
- * @example
- *
- * var object = { 'a': 1, 'b': 2, 'c': 1 };
- *
- * _.invertBy(object);
- * // => { '1': ['a', 'c'], '2': ['b'] }
- *
- * _.invertBy(object, function(value) {
- * return 'group' + value;
- * });
- * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
- */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);/**
- * Invokes the method at `path` of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the method to invoke.
- * @param {...*} [args] The arguments to invoke the method with.
- * @returns {*} Returns the result of the invoked method.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
- *
- * _.invoke(object, 'a[0].b.c.slice', 1, 3);
- * // => [2, 3]
- */var invoke=baseRest(baseInvoke);/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object);}/**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object);}/**
- * The opposite of `_.mapValues`; this method creates an object with the
- * same values as `object` and keys generated by running each own enumerable
- * string keyed property of `object` thru `iteratee`. The iteratee is invoked
- * with three arguments: (value, key, object).
- *
- * @static
- * @memberOf _
- * @since 3.8.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns the new mapped object.
- * @see _.mapValues
- * @example
- *
- * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
- * return key + value;
- * });
- * // => { 'a1': 1, 'b2': 2 }
- */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;}/**
- * Creates an object with the same keys as `object` and values generated
- * by running each own enumerable string keyed property of `object` thru
- * `iteratee`. The iteratee is invoked with three arguments:
- * (value, key, object).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns the new mapped object.
- * @see _.mapKeys
- * @example
- *
- * var users = {
- * 'fred': { 'user': 'fred', 'age': 40 },
- * 'pebbles': { 'user': 'pebbles', 'age': 1 }
- * };
- *
- * _.mapValues(users, function(o) { return o.age; });
- * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
- *
- * // The `_.property` iteratee shorthand.
- * _.mapValues(users, 'age');
- * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
- */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;}/**
- * This method is like `_.assign` except that it recursively merges own and
- * inherited enumerable string keyed properties of source objects into the
- * destination object. Source properties that resolve to `undefined` are
- * skipped if a destination value exists. Array and plain object properties
- * are merged recursively. Other objects and value types are overridden by
- * assignment. Source objects are applied from left to right. Subsequent
- * sources overwrite property assignments of previous sources.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 0.5.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = {
- * 'a': [{ 'b': 2 }, { 'd': 4 }]
- * };
- *
- * var other = {
- * 'a': [{ 'c': 3 }, { 'e': 5 }]
- * };
- *
- * _.merge(object, other);
- * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
- */var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex);});/**
- * This method is like `_.merge` except that it accepts `customizer` which
- * is invoked to produce the merged values of the destination and source
- * properties. If `customizer` returns `undefined`, merging is handled by the
- * method instead. The `customizer` is invoked with six arguments:
- * (objValue, srcValue, key, object, source, stack).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} sources The source objects.
- * @param {Function} customizer The function to customize assigned values.
- * @returns {Object} Returns `object`.
- * @example
- *
- * function customizer(objValue, srcValue) {
- * if (_.isArray(objValue)) {
- * return objValue.concat(srcValue);
- * }
- * }
- *
- * var object = { 'a': [1], 'b': [2] };
- * var other = { 'a': [3], 'b': [4] };
- *
- * _.mergeWith(object, other, customizer);
- * // => { 'a': [1, 3], 'b': [2, 4] }
- */var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer);});/**
- * The opposite of `_.pick`; this method creates an object composed of the
- * own and inherited enumerable property paths of `object` that are not omitted.
- *
- * **Note:** This method is considerably slower than `_.pick`.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The source object.
- * @param {...(string|string[])} [paths] The property paths to omit.
- * @returns {Object} Returns the new object.
- * @example
- *
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
- *
- * _.omit(object, ['a', 'c']);
- * // => { 'b': '2' }
- */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;});/**
- * The opposite of `_.pickBy`; this method creates an object composed of
- * the own and inherited enumerable string keyed properties of `object` that
- * `predicate` doesn't return truthy for. The predicate is invoked with two
- * arguments: (value, key).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The source object.
- * @param {Function} [predicate=_.identity] The function invoked per property.
- * @returns {Object} Returns the new object.
- * @example
- *
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
- *
- * _.omitBy(object, _.isNumber);
- * // => { 'b': '2' }
- */function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)));}/**
- * Creates an object composed of the picked `object` properties.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The source object.
- * @param {...(string|string[])} [paths] The property paths to pick.
- * @returns {Object} Returns the new object.
- * @example
- *
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
- *
- * _.pick(object, ['a', 'c']);
- * // => { 'a': 1, 'c': 3 }
- */var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths);});/**
- * Creates an object composed of the `object` properties `predicate` returns
- * truthy for. The predicate is invoked with two arguments: (value, key).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The source object.
- * @param {Function} [predicate=_.identity] The function invoked per property.
- * @returns {Object} Returns the new object.
- * @example
- *
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
- *
- * _.pickBy(object, _.isNumber);
- * // => { 'a': 1, 'c': 3 }
- */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]);});}/**
- * This method is like `_.get` except that if the resolved value is a
- * function it's invoked with the `this` binding of its parent object and
- * its result is returned.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to resolve.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
- *
- * _.result(object, 'a[0].b.c1');
- * // => 3
- *
- * _.result(object, 'a[0].b.c2');
- * // => 4
- *
- * _.result(object, 'a[0].b.c3', 'default');
- * // => 'default'
- *
- * _.result(object, 'a[0].b.c3', _.constant('default'));
- * // => 'default'
- */function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;// Ensure the loop is entered when path is empty.
- 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;}/**
- * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
- * it's created. Arrays are created for missing index properties while objects
- * are created for all other missing properties. Use `_.setWith` to customize
- * `path` creation.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.set(object, 'a[0].b.c', 4);
- * console.log(object.a[0].b.c);
- * // => 4
- *
- * _.set(object, ['x', '0', 'y', 'z'], 5);
- * console.log(object.x[0].y.z);
- * // => 5
- */function set(object,path,value){return object==null?object:baseSet(object,path,value);}/**
- * This method is like `_.set` except that it accepts `customizer` which is
- * invoked to produce the objects of `path`. If `customizer` returns `undefined`
- * path creation is handled by the method instead. The `customizer` is invoked
- * with three arguments: (nsValue, key, nsObject).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {*} value The value to set.
- * @param {Function} [customizer] The function to customize assigned values.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = {};
- *
- * _.setWith(object, '[0][1]', 'a', Object);
- * // => { '0': { '1': 'a' } }
- */function setWith(object,path,value,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return object==null?object:baseSet(object,path,value,customizer);}/**
- * Creates an array of own enumerable string keyed-value pairs for `object`
- * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
- * entries are returned.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias entries
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the key-value pairs.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.toPairs(new Foo);
- * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
- */var toPairs=createToPairs(keys);/**
- * Creates an array of own and inherited enumerable string keyed-value pairs
- * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
- * or set, its entries are returned.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias entriesIn
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the key-value pairs.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.toPairsIn(new Foo);
- * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
- */var toPairsIn=createToPairs(keysIn);/**
- * An alternative to `_.reduce`; this method transforms `object` to a new
- * `accumulator` object which is the result of running each of its own
- * enumerable string keyed properties thru `iteratee`, with each invocation
- * potentially mutating the `accumulator` object. If `accumulator` is not
- * provided, a new object with the same `[[Prototype]]` will be used. The
- * iteratee is invoked with four arguments: (accumulator, value, key, object).
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @since 1.3.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {*} [accumulator] The custom accumulator value.
- * @returns {*} Returns the accumulated value.
- * @example
- *
- * _.transform([2, 3, 4], function(result, n) {
- * result.push(n *= n);
- * return n % 2 == 0;
- * }, []);
- * // => [4, 9]
- *
- * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
- * (result[value] || (result[value] = [])).push(key);
- * }, {});
- * // => { '1': ['a', 'c'], '2': ['b'] }
- */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;}/**
- * Removes the property at `path` of `object`.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to unset.
- * @returns {boolean} Returns `true` if the property is deleted, else `false`.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 7 } }] };
- * _.unset(object, 'a[0].b.c');
- * // => true
- *
- * console.log(object);
- * // => { 'a': [{ 'b': {} }] };
- *
- * _.unset(object, ['a', '0', 'b', 'c']);
- * // => true
- *
- * console.log(object);
- * // => { 'a': [{ 'b': {} }] };
- */function unset(object,path){return object==null?true:baseUnset(object,path);}/**
- * This method is like `_.set` except that accepts `updater` to produce the
- * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
- * is invoked with one argument: (value).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.6.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {Function} updater The function to produce the updated value.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.update(object, 'a[0].b.c', function(n) { return n * n; });
- * console.log(object.a[0].b.c);
- * // => 9
- *
- * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
- * console.log(object.x[0].y.z);
- * // => 0
- */function update(object,path,updater){return object==null?object:baseUpdate(object,path,castFunction(updater));}/**
- * This method is like `_.update` except that it accepts `customizer` which is
- * invoked to produce the objects of `path`. If `customizer` returns `undefined`
- * path creation is handled by the method instead. The `customizer` is invoked
- * with three arguments: (nsValue, key, nsObject).
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 4.6.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {Function} updater The function to produce the updated value.
- * @param {Function} [customizer] The function to customize assigned values.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = {};
- *
- * _.updateWith(object, '[0][1]', _.constant('a'), Object);
- * // => { '0': { '1': 'a' } }
- */function updateWith(object,path,updater,customizer){customizer=typeof customizer=='function'?customizer:undefined$1;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer);}/**
- * Creates an array of the own enumerable string keyed property values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
- *
- * _.values('hi');
- * // => ['h', 'i']
- */function values(object){return object==null?[]:baseValues(object,keys(object));}/**
- * Creates an array of the own and inherited enumerable string keyed property
- * values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.valuesIn(new Foo);
- * // => [1, 2, 3] (iteration order is not guaranteed)
- */function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object));}/*------------------------------------------------------------------------*/ /**
- * Clamps `number` within the inclusive `lower` and `upper` bounds.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Number
- * @param {number} number The number to clamp.
- * @param {number} [lower] The lower bound.
- * @param {number} upper The upper bound.
- * @returns {number} Returns the clamped number.
- * @example
- *
- * _.clamp(-10, -5, 5);
- * // => -5
- *
- * _.clamp(10, -5, 5);
- * // => 5
- */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);}/**
- * Checks if `n` is between `start` and up to, but not including, `end`. If
- * `end` is not specified, it's set to `start` with `start` then set to `0`.
- * If `start` is greater than `end` the params are swapped to support
- * negative ranges.
- *
- * @static
- * @memberOf _
- * @since 3.3.0
- * @category Number
- * @param {number} number The number to check.
- * @param {number} [start=0] The start of the range.
- * @param {number} end The end of the range.
- * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
- * @see _.range, _.rangeRight
- * @example
- *
- * _.inRange(3, 2, 4);
- * // => true
- *
- * _.inRange(4, 8);
- * // => true
- *
- * _.inRange(4, 2);
- * // => false
- *
- * _.inRange(2, 2);
- * // => false
- *
- * _.inRange(1.2, 2);
- * // => true
- *
- * _.inRange(5.2, 4);
- * // => false
- *
- * _.inRange(-3, -2, -6);
- * // => true
- */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);}/**
- * Produces a random number between the inclusive `lower` and `upper` bounds.
- * If only one argument is provided a number between `0` and the given number
- * is returned. If `floating` is `true`, or either `lower` or `upper` are
- * floats, a floating-point number is returned instead of an integer.
- *
- * **Note:** JavaScript follows the IEEE-754 standard for resolving
- * floating-point values which can produce unexpected results.
- *
- * @static
- * @memberOf _
- * @since 0.7.0
- * @category Number
- * @param {number} [lower=0] The lower bound.
- * @param {number} [upper=1] The upper bound.
- * @param {boolean} [floating] Specify returning a floating-point number.
- * @returns {number} Returns the random number.
- * @example
- *
- * _.random(0, 5);
- * // => an integer between 0 and 5
- *
- * _.random(5);
- * // => also an integer between 0 and 5
- *
- * _.random(5, true);
- * // => a floating-point number between 0 and 5
- *
- * _.random(1.2, 5.2);
- * // => a floating-point number between 1.2 and 5.2
- */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);}/*------------------------------------------------------------------------*/ /**
- * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the camel cased string.
- * @example
- *
- * _.camelCase('Foo Bar');
- * // => 'fooBar'
- *
- * _.camelCase('--foo-bar--');
- * // => 'fooBar'
- *
- * _.camelCase('__FOO_BAR__');
- * // => 'fooBar'
- */var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word);});/**
- * Converts the first character of `string` to upper case and the remaining
- * to lower case.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to capitalize.
- * @returns {string} Returns the capitalized string.
- * @example
- *
- * _.capitalize('FRED');
- * // => 'Fred'
- */function capitalize(string){return upperFirst(toString(string).toLowerCase());}/**
- * Deburrs `string` by converting
- * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
- * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
- * letters to basic Latin letters and removing
- * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to deburr.
- * @returns {string} Returns the deburred string.
- * @example
- *
- * _.deburr('déjà vu');
- * // => 'deja vu'
- */function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,'');}/**
- * Checks if `string` ends with the given target string.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to inspect.
- * @param {string} [target] The string to search for.
- * @param {number} [position=string.length] The position to search up to.
- * @returns {boolean} Returns `true` if `string` ends with `target`,
- * else `false`.
- * @example
- *
- * _.endsWith('abc', 'c');
- * // => true
- *
- * _.endsWith('abc', 'b');
- * // => false
- *
- * _.endsWith('abc', 'b', 2);
- * // => true
- */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;}/**
- * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
- * corresponding HTML entities.
- *
- * **Note:** No other characters are escaped. To escape additional
- * characters use a third-party library like [_he_](https://mths.be/he).
- *
- * Though the ">" character is escaped for symmetry, characters like
- * ">" and "/" don't need escaping in HTML and have no special meaning
- * unless they're part of a tag or unquoted attribute value. See
- * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
- * (under "semi-related fun fact") for more details.
- *
- * When working with HTML you should always
- * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
- * XSS vectors.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category String
- * @param {string} [string=''] The string to escape.
- * @returns {string} Returns the escaped string.
- * @example
- *
- * _.escape('fred, barney, & pebbles');
- * // => 'fred, barney, & pebbles'
- */function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string;}/**
- * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
- * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to escape.
- * @returns {string} Returns the escaped string.
- * @example
- *
- * _.escapeRegExp('[lodash](https://lodash.com/)');
- * // => '\[lodash\]\(https://lodash\.com/\)'
- */function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,'\\$&'):string;}/**
- * Converts `string` to
- * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the kebab cased string.
- * @example
- *
- * _.kebabCase('Foo Bar');
- * // => 'foo-bar'
- *
- * _.kebabCase('fooBar');
- * // => 'foo-bar'
- *
- * _.kebabCase('__FOO_BAR__');
- * // => 'foo-bar'
- */var kebabCase=createCompounder(function(result,word,index){return result+(index?'-':'')+word.toLowerCase();});/**
- * Converts `string`, as space separated words, to lower case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the lower cased string.
- * @example
- *
- * _.lowerCase('--Foo-Bar--');
- * // => 'foo bar'
- *
- * _.lowerCase('fooBar');
- * // => 'foo bar'
- *
- * _.lowerCase('__FOO_BAR__');
- * // => 'foo bar'
- */var lowerCase=createCompounder(function(result,word,index){return result+(index?' ':'')+word.toLowerCase();});/**
- * Converts the first character of `string` to lower case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.lowerFirst('Fred');
- * // => 'fred'
- *
- * _.lowerFirst('FRED');
- * // => 'fRED'
- */var lowerFirst=createCaseFirst('toLowerCase');/**
- * Pads `string` on the left and right sides if it's shorter than `length`.
- * Padding characters are truncated if they can't be evenly divided by `length`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to pad.
- * @param {number} [length=0] The padding length.
- * @param {string} [chars=' '] The string used as padding.
- * @returns {string} Returns the padded string.
- * @example
- *
- * _.pad('abc', 8);
- * // => ' abc '
- *
- * _.pad('abc', 8, '_-');
- * // => '_-abc_-_'
- *
- * _.pad('abc', 3);
- * // => 'abc'
- */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);}/**
- * Pads `string` on the right side if it's shorter than `length`. Padding
- * characters are truncated if they exceed `length`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to pad.
- * @param {number} [length=0] The padding length.
- * @param {string} [chars=' '] The string used as padding.
- * @returns {string} Returns the padded string.
- * @example
- *
- * _.padEnd('abc', 6);
- * // => 'abc '
- *
- * _.padEnd('abc', 6, '_-');
- * // => 'abc_-_'
- *
- * _.padEnd('abc', 3);
- * // => 'abc'
- */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;}/**
- * Pads `string` on the left side if it's shorter than `length`. Padding
- * characters are truncated if they exceed `length`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to pad.
- * @param {number} [length=0] The padding length.
- * @param {string} [chars=' '] The string used as padding.
- * @returns {string} Returns the padded string.
- * @example
- *
- * _.padStart('abc', 6);
- * // => ' abc'
- *
- * _.padStart('abc', 6, '_-');
- * // => '_-_abc'
- *
- * _.padStart('abc', 3);
- * // => 'abc'
- */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;}/**
- * Converts `string` to an integer of the specified radix. If `radix` is
- * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
- * hexadecimal, in which case a `radix` of `16` is used.
- *
- * **Note:** This method aligns with the
- * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category String
- * @param {string} string The string to convert.
- * @param {number} [radix=10] The radix to interpret `value` by.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.parseInt('08');
- * // => 8
- *
- * _.map(['6', '08', '10'], _.parseInt);
- * // => [6, 8, 10]
- */function parseInt(string,radix,guard){if(guard||radix==null){radix=0;}else if(radix){radix=+radix;}return nativeParseInt(toString(string).replace(reTrimStart,''),radix||0);}/**
- * Repeats the given string `n` times.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to repeat.
- * @param {number} [n=1] The number of times to repeat the string.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {string} Returns the repeated string.
- * @example
- *
- * _.repeat('*', 3);
- * // => '***'
- *
- * _.repeat('abc', 2);
- * // => 'abcabc'
- *
- * _.repeat('abc', 0);
- * // => ''
- */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);}/**
- * Replaces matches for `pattern` in `string` with `replacement`.
- *
- * **Note:** This method is based on
- * [`String#replace`](https://mdn.io/String/replace).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to modify.
- * @param {RegExp|string} pattern The pattern to replace.
- * @param {Function|string} replacement The match replacement.
- * @returns {string} Returns the modified string.
- * @example
- *
- * _.replace('Hi Fred', 'Fred', 'Barney');
- * // => 'Hi Barney'
- */function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:string.replace(args[1],args[2]);}/**
- * Converts `string` to
- * [snake case](https://en.wikipedia.org/wiki/Snake_case).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the snake cased string.
- * @example
- *
- * _.snakeCase('Foo Bar');
- * // => 'foo_bar'
- *
- * _.snakeCase('fooBar');
- * // => 'foo_bar'
- *
- * _.snakeCase('--FOO-BAR--');
- * // => 'foo_bar'
- */var snakeCase=createCompounder(function(result,word,index){return result+(index?'_':'')+word.toLowerCase();});/**
- * Splits `string` by `separator`.
- *
- * **Note:** This method is based on
- * [`String#split`](https://mdn.io/String/split).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to split.
- * @param {RegExp|string} separator The separator pattern to split by.
- * @param {number} [limit] The length to truncate results to.
- * @returns {Array} Returns the string segments.
- * @example
- *
- * _.split('a-b-c', '-', 2);
- * // => ['a', 'b']
- */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);}/**
- * Converts `string` to
- * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
- *
- * @static
- * @memberOf _
- * @since 3.1.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the start cased string.
- * @example
- *
- * _.startCase('--foo-bar--');
- * // => 'Foo Bar'
- *
- * _.startCase('fooBar');
- * // => 'Foo Bar'
- *
- * _.startCase('__FOO_BAR__');
- * // => 'FOO BAR'
- */var startCase=createCompounder(function(result,word,index){return result+(index?' ':'')+upperFirst(word);});/**
- * Checks if `string` starts with the given target string.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to inspect.
- * @param {string} [target] The string to search for.
- * @param {number} [position=0] The position to search from.
- * @returns {boolean} Returns `true` if `string` starts with `target`,
- * else `false`.
- * @example
- *
- * _.startsWith('abc', 'a');
- * // => true
- *
- * _.startsWith('abc', 'b');
- * // => false
- *
- * _.startsWith('abc', 'b', 1);
- * // => true
- */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;}/**
- * Creates a compiled template function that can interpolate data properties
- * in "interpolate" delimiters, HTML-escape interpolated data properties in
- * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
- * properties may be accessed as free variables in the template. If a setting
- * object is given, it takes precedence over `_.templateSettings` values.
- *
- * **Note:** In the development build `_.template` utilizes
- * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
- * for easier debugging.
- *
- * For more information on precompiling templates see
- * [lodash's custom builds documentation](https://lodash.com/custom-builds).
- *
- * For more information on Chrome extension sandboxes see
- * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category String
- * @param {string} [string=''] The template string.
- * @param {Object} [options={}] The options object.
- * @param {RegExp} [options.escape=_.templateSettings.escape]
- * The HTML "escape" delimiter.
- * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
- * The "evaluate" delimiter.
- * @param {Object} [options.imports=_.templateSettings.imports]
- * An object to import into the template as free variables.
- * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
- * The "interpolate" delimiter.
- * @param {string} [options.sourceURL='lodash.templateSources[n]']
- * The sourceURL of the compiled template.
- * @param {string} [options.variable='obj']
- * The data object variable name.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Function} Returns the compiled template function.
- * @example
- *
- * // Use the "interpolate" delimiter to create a compiled template.
- * var compiled = _.template('hello <%= user %>!');
- * compiled({ 'user': 'fred' });
- * // => 'hello fred!'
- *
- * // Use the HTML "escape" delimiter to escape data property values.
- * var compiled = _.template('<b><%- value %></b>');
- * compiled({ 'value': '<script>' });
- * // => '<b><script></b>'
- *
- * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
- * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
- * compiled({ 'users': ['fred', 'barney'] });
- * // => '<li>fred</li><li>barney</li>'
- *
- * // Use the internal `print` function in "evaluate" delimiters.
- * var compiled = _.template('<% print("hello " + user); %>!');
- * compiled({ 'user': 'barney' });
- * // => 'hello barney!'
- *
- * // Use the ES template literal delimiter as an "interpolate" delimiter.
- * // Disable support by replacing the "interpolate" delimiter.
- * var compiled = _.template('hello ${ user }!');
- * compiled({ 'user': 'pebbles' });
- * // => 'hello pebbles!'
- *
- * // Use backslashes to treat delimiters as plain text.
- * var compiled = _.template('<%= "\\<%- value %\\>" %>');
- * compiled({ 'value': 'ignored' });
- * // => '<%- value %>'
- *
- * // Use the `imports` option to import `jQuery` as `jq`.
- * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
- * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
- * compiled({ 'users': ['fred', 'barney'] });
- * // => '<li>fred</li><li>barney</li>'
- *
- * // Use the `sourceURL` option to specify a custom sourceURL for the template.
- * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
- * compiled(data);
- * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
- *
- * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
- * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
- * compiled.source;
- * // => function(data) {
- * // var __t, __p = '';
- * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
- * // return __p;
- * // }
- *
- * // Use custom template delimiters.
- * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
- * var compiled = _.template('hello {{ user }}!');
- * compiled({ 'user': 'mustache' });
- * // => 'hello mustache!'
- *
- * // Use the `source` property to inline compiled templates for meaningful
- * // line numbers in error messages and stack traces.
- * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
- * var JST = {\
- * "main": ' + _.template(mainText).source + '\
- * };\
- * ');
- */function template(string,options,guard){// Based on John Resig's `tmpl` implementation
- // (http://ejohn.org/blog/javascript-micro-templating/)
- // and Laura Doktorova's doT.js (https://github.com/olado/doT).
- 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.
- 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.
- // The sourceURL gets injected into the source that's eval-ed, so be careful
- // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
- // and escape the comment, thus injecting code that gets evaled.
- 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.
- source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);// Replace delimiters with snippets.
- 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
- // order to produce the correct `offset` value.
- return match;});source+="';\n";// If `variable` is not specified wrap a with-statement around the generated
- // code to add the data object to the top of the scope chain.
- 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
- // potential command injection attacks.
- else if(reForbiddenIdentifierChars.test(variable)){throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);}// Cleanup code by stripping empty strings.
- source=(isEvaluating?source.replace(reEmptyStringLeading,''):source).replace(reEmptyStringMiddle,'$1').replace(reEmptyStringTrailing,'$1;');// Frame code as the function body.
- 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
- // the `source` property as a convenience for inlining compiled templates.
- result.source=source;if(isError(result)){throw result;}return result;}/**
- * Converts `string`, as a whole, to lower case just like
- * [String#toLowerCase](https://mdn.io/toLowerCase).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the lower cased string.
- * @example
- *
- * _.toLower('--Foo-Bar--');
- * // => '--foo-bar--'
- *
- * _.toLower('fooBar');
- * // => 'foobar'
- *
- * _.toLower('__FOO_BAR__');
- * // => '__foo_bar__'
- */function toLower(value){return toString(value).toLowerCase();}/**
- * Converts `string`, as a whole, to upper case just like
- * [String#toUpperCase](https://mdn.io/toUpperCase).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the upper cased string.
- * @example
- *
- * _.toUpper('--foo-bar--');
- * // => '--FOO-BAR--'
- *
- * _.toUpper('fooBar');
- * // => 'FOOBAR'
- *
- * _.toUpper('__foo_bar__');
- * // => '__FOO_BAR__'
- */function toUpper(value){return toString(value).toUpperCase();}/**
- * Removes leading and trailing whitespace or specified characters from `string`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to trim.
- * @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {string} Returns the trimmed string.
- * @example
- *
- * _.trim(' abc ');
- * // => 'abc'
- *
- * _.trim('-_-abc-_-', '_-');
- * // => 'abc'
- *
- * _.map([' foo ', ' bar '], _.trim);
- * // => ['foo', 'bar']
- */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('');}/**
- * Removes trailing whitespace or specified characters from `string`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to trim.
- * @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {string} Returns the trimmed string.
- * @example
- *
- * _.trimEnd(' abc ');
- * // => ' abc'
- *
- * _.trimEnd('-_-abc-_-', '_-');
- * // => '-_-abc'
- */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('');}/**
- * Removes leading whitespace or specified characters from `string`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to trim.
- * @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {string} Returns the trimmed string.
- * @example
- *
- * _.trimStart(' abc ');
- * // => 'abc '
- *
- * _.trimStart('-_-abc-_-', '_-');
- * // => 'abc-_-'
- */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('');}/**
- * Truncates `string` if it's longer than the given maximum string length.
- * The last characters of the truncated string are replaced with the omission
- * string which defaults to "...".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to truncate.
- * @param {Object} [options={}] The options object.
- * @param {number} [options.length=30] The maximum string length.
- * @param {string} [options.omission='...'] The string to indicate text is omitted.
- * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
- * @returns {string} Returns the truncated string.
- * @example
- *
- * _.truncate('hi-diddly-ho there, neighborino');
- * // => 'hi-diddly-ho there, neighbo...'
- *
- * _.truncate('hi-diddly-ho there, neighborino', {
- * 'length': 24,
- * 'separator': ' '
- * });
- * // => 'hi-diddly-ho there,...'
- *
- * _.truncate('hi-diddly-ho there, neighborino', {
- * 'length': 24,
- * 'separator': /,? +/
- * });
- * // => 'hi-diddly-ho there...'
- *
- * _.truncate('hi-diddly-ho there, neighborino', {
- * 'omission': ' [...]'
- * });
- * // => 'hi-diddly-ho there, neig [...]'
- */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;}/**
- * The inverse of `_.escape`; this method converts the HTML entities
- * `&`, `<`, `>`, `"`, and `'` in `string` to
- * their corresponding characters.
- *
- * **Note:** No other HTML entities are unescaped. To unescape additional
- * HTML entities use a third-party library like [_he_](https://mths.be/he).
- *
- * @static
- * @memberOf _
- * @since 0.6.0
- * @category String
- * @param {string} [string=''] The string to unescape.
- * @returns {string} Returns the unescaped string.
- * @example
- *
- * _.unescape('fred, barney, & pebbles');
- * // => 'fred, barney, & pebbles'
- */function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string;}/**
- * Converts `string`, as space separated words, to upper case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the upper cased string.
- * @example
- *
- * _.upperCase('--foo-bar');
- * // => 'FOO BAR'
- *
- * _.upperCase('fooBar');
- * // => 'FOO BAR'
- *
- * _.upperCase('__foo_bar__');
- * // => 'FOO BAR'
- */var upperCase=createCompounder(function(result,word,index){return result+(index?' ':'')+word.toUpperCase();});/**
- * Converts the first character of `string` to upper case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.upperFirst('fred');
- * // => 'Fred'
- *
- * _.upperFirst('FRED');
- * // => 'FRED'
- */var upperFirst=createCaseFirst('toUpperCase');/**
- * Splits `string` into an array of its words.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to inspect.
- * @param {RegExp|string} [pattern] The pattern to match words.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the words of `string`.
- * @example
- *
- * _.words('fred, barney, & pebbles');
- * // => ['fred', 'barney', 'pebbles']
- *
- * _.words('fred, barney, & pebbles', /[^, ]+/g);
- * // => ['fred', 'barney', '&', 'pebbles']
- */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)||[];}/*------------------------------------------------------------------------*/ /**
- * Attempts to invoke `func`, returning either the result or the caught error
- * object. Any additional arguments are provided to `func` when it's invoked.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Util
- * @param {Function} func The function to attempt.
- * @param {...*} [args] The arguments to invoke `func` with.
- * @returns {*} Returns the `func` result or error object.
- * @example
- *
- * // Avoid throwing errors for invalid selectors.
- * var elements = _.attempt(function(selector) {
- * return document.querySelectorAll(selector);
- * }, '>_>');
- *
- * if (_.isError(elements)) {
- * elements = [];
- * }
- */var attempt=baseRest(function(func,args){try{return apply(func,undefined$1,args);}catch(e){return isError(e)?e:new Error(e);}});/**
- * Binds methods of an object to the object itself, overwriting the existing
- * method.
- *
- * **Note:** This method doesn't set the "length" property of bound functions.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {Object} object The object to bind and assign the bound methods to.
- * @param {...(string|string[])} methodNames The object method names to bind.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var view = {
- * 'label': 'docs',
- * 'click': function() {
- * console.log('clicked ' + this.label);
- * }
- * };
- *
- * _.bindAll(view, ['click']);
- * jQuery(element).on('click', view.click);
- * // => Logs 'clicked docs' when clicked.
- */var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object));});return object;});/**
- * Creates a function that iterates over `pairs` and invokes the corresponding
- * function of the first predicate to return truthy. The predicate-function
- * pairs are invoked with the `this` binding and arguments of the created
- * function.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {Array} pairs The predicate-function pairs.
- * @returns {Function} Returns the new composite function.
- * @example
- *
- * var func = _.cond([
- * [_.matches({ 'a': 1 }), _.constant('matches A')],
- * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
- * [_.stubTrue, _.constant('no match')]
- * ]);
- *
- * func({ 'a': 1, 'b': 2 });
- * // => 'matches A'
- *
- * func({ 'a': 0, 'b': 1 });
- * // => 'matches B'
- *
- * func({ 'a': '1', 'b': '2' });
- * // => 'no match'
- */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);}}});}/**
- * Creates a function that invokes the predicate properties of `source` with
- * the corresponding property values of a given object, returning `true` if
- * all predicates return truthy, else `false`.
- *
- * **Note:** The created function is equivalent to `_.conformsTo` with
- * `source` partially applied.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {Object} source The object of property predicates to conform to.
- * @returns {Function} Returns the new spec function.
- * @example
- *
- * var objects = [
- * { 'a': 2, 'b': 1 },
- * { 'a': 1, 'b': 2 }
- * ];
- *
- * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
- * // => [{ 'a': 1, 'b': 2 }]
- */function conforms(source){return baseConforms(baseClone(source,CLONE_DEEP_FLAG));}/**
- * Creates a function that returns `value`.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new constant function.
- * @example
- *
- * var objects = _.times(2, _.constant({ 'a': 1 }));
- *
- * console.log(objects);
- * // => [{ 'a': 1 }, { 'a': 1 }]
- *
- * console.log(objects[0] === objects[1]);
- * // => true
- */function constant(value){return function(){return value;};}/**
- * Checks `value` to determine whether a default value should be returned in
- * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
- * or `undefined`.
- *
- * @static
- * @memberOf _
- * @since 4.14.0
- * @category Util
- * @param {*} value The value to check.
- * @param {*} defaultValue The default value.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * _.defaultTo(1, 10);
- * // => 1
- *
- * _.defaultTo(undefined, 10);
- * // => 10
- */function defaultTo(value,defaultValue){return value==null||value!==value?defaultValue:value;}/**
- * Creates a function that returns the result of invoking the given functions
- * with the `this` binding of the created function, where each successive
- * invocation is supplied the return value of the previous.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Util
- * @param {...(Function|Function[])} [funcs] The functions to invoke.
- * @returns {Function} Returns the new composite function.
- * @see _.flowRight
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * var addSquare = _.flow([_.add, square]);
- * addSquare(1, 2);
- * // => 9
- */var flow=createFlow();/**
- * This method is like `_.flow` except that it creates a function that
- * invokes the given functions from right to left.
- *
- * @static
- * @since 3.0.0
- * @memberOf _
- * @category Util
- * @param {...(Function|Function[])} [funcs] The functions to invoke.
- * @returns {Function} Returns the new composite function.
- * @see _.flow
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * var addSquare = _.flowRight([square, _.add]);
- * addSquare(1, 2);
- * // => 9
- */var flowRight=createFlow(true);/**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */function identity(value){return value;}/**
- * Creates a function that invokes `func` with the arguments of the created
- * function. If `func` is a property name, the created function returns the
- * property value for a given element. If `func` is an array or object, the
- * created function returns `true` for elements that contain the equivalent
- * source properties, otherwise it returns `false`.
- *
- * @static
- * @since 4.0.0
- * @memberOf _
- * @category Util
- * @param {*} [func=_.identity] The value to convert to a callback.
- * @returns {Function} Returns the callback.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
- * ];
- *
- * // The `_.matches` iteratee shorthand.
- * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
- * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.filter(users, _.iteratee(['user', 'fred']));
- * // => [{ 'user': 'fred', 'age': 40 }]
- *
- * // The `_.property` iteratee shorthand.
- * _.map(users, _.iteratee('user'));
- * // => ['barney', 'fred']
- *
- * // Create custom iteratee shorthands.
- * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
- * return !_.isRegExp(func) ? iteratee(func) : function(string) {
- * return func.test(string);
- * };
- * });
- *
- * _.filter(['abc', 'def'], /ef/);
- * // => ['def']
- */function iteratee(func){return baseIteratee(typeof func=='function'?func:baseClone(func,CLONE_DEEP_FLAG));}/**
- * Creates a function that performs a partial deep comparison between a given
- * object and `source`, returning `true` if the given object has equivalent
- * property values, else `false`.
- *
- * **Note:** The created function is equivalent to `_.isMatch` with `source`
- * partially applied.
- *
- * Partial comparisons will match empty array and empty object `source`
- * values against any array or object value, respectively. See `_.isEqual`
- * for a list of supported value comparisons.
- *
- * **Note:** Multiple values can be checked by combining several matchers
- * using `_.overSome`
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Util
- * @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new spec function.
- * @example
- *
- * var objects = [
- * { 'a': 1, 'b': 2, 'c': 3 },
- * { 'a': 4, 'b': 5, 'c': 6 }
- * ];
- *
- * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
- * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
- *
- * // Checking for several possible values
- * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
- * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
- */function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG));}/**
- * Creates a function that performs a partial deep comparison between the
- * value at `path` of a given object to `srcValue`, returning `true` if the
- * object value is equivalent, else `false`.
- *
- * **Note:** Partial comparisons will match empty array and empty object
- * `srcValue` values against any array or object value, respectively. See
- * `_.isEqual` for a list of supported value comparisons.
- *
- * **Note:** Multiple values can be checked by combining several matchers
- * using `_.overSome`
- *
- * @static
- * @memberOf _
- * @since 3.2.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- * @example
- *
- * var objects = [
- * { 'a': 1, 'b': 2, 'c': 3 },
- * { 'a': 4, 'b': 5, 'c': 6 }
- * ];
- *
- * _.find(objects, _.matchesProperty('a', 4));
- * // => { 'a': 4, 'b': 5, 'c': 6 }
- *
- * // Checking for several possible values
- * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
- * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
- */function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG));}/**
- * Creates a function that invokes the method at `path` of a given object.
- * Any additional arguments are provided to the invoked method.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Util
- * @param {Array|string} path The path of the method to invoke.
- * @param {...*} [args] The arguments to invoke the method with.
- * @returns {Function} Returns the new invoker function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': _.constant(2) } },
- * { 'a': { 'b': _.constant(1) } }
- * ];
- *
- * _.map(objects, _.method('a.b'));
- * // => [2, 1]
- *
- * _.map(objects, _.method(['a', 'b']));
- * // => [2, 1]
- */var method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args);};});/**
- * The opposite of `_.method`; this method creates a function that invokes
- * the method at a given path of `object`. Any additional arguments are
- * provided to the invoked method.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Util
- * @param {Object} object The object to query.
- * @param {...*} [args] The arguments to invoke the method with.
- * @returns {Function} Returns the new invoker function.
- * @example
- *
- * var array = _.times(3, _.constant),
- * object = { 'a': array, 'b': array, 'c': array };
- *
- * _.map(['a[2]', 'c[0]'], _.methodOf(object));
- * // => [2, 0]
- *
- * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
- * // => [2, 0]
- */var methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args);};});/**
- * Adds all own enumerable string keyed function properties of a source
- * object to the destination object. If `object` is a function, then methods
- * are added to its prototype as well.
- *
- * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
- * avoid conflicts caused by modifying the original.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {Function|Object} [object=lodash] The destination object.
- * @param {Object} source The object of functions to add.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
- * @returns {Function|Object} Returns `object`.
- * @example
- *
- * function vowels(string) {
- * return _.filter(string, function(v) {
- * return /[aeiou]/i.test(v);
- * });
- * }
- *
- * _.mixin({ 'vowels': vowels });
- * _.vowels('fred');
- * // => ['e']
- *
- * _('fred').vowels().value();
- * // => ['e']
- *
- * _.mixin({ 'vowels': vowels }, { 'chain': false });
- * _('fred').vowels();
- * // => ['e']
- */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;}/**
- * Reverts the `_` variable to its previous value and returns a reference to
- * the `lodash` function.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @returns {Function} Returns the `lodash` function.
- * @example
- *
- * var lodash = _.noConflict();
- */function noConflict(){if(root._===this){root._=oldDash;}return this;}/**
- * This method returns `undefined`.
- *
- * @static
- * @memberOf _
- * @since 2.3.0
- * @category Util
- * @example
- *
- * _.times(2, _.noop);
- * // => [undefined, undefined]
- */function noop(){// No operation performed.
- }/**
- * Creates a function that gets the argument at index `n`. If `n` is negative,
- * the nth argument from the end is returned.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {number} [n=0] The index of the argument to return.
- * @returns {Function} Returns the new pass-thru function.
- * @example
- *
- * var func = _.nthArg(1);
- * func('a', 'b', 'c', 'd');
- * // => 'b'
- *
- * var func = _.nthArg(-2);
- * func('a', 'b', 'c', 'd');
- * // => 'c'
- */function nthArg(n){n=toInteger(n);return baseRest(function(args){return baseNth(args,n);});}/**
- * Creates a function that invokes `iteratees` with the arguments it receives
- * and returns their results.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {...(Function|Function[])} [iteratees=[_.identity]]
- * The iteratees to invoke.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var func = _.over([Math.max, Math.min]);
- *
- * func(1, 2, 3, 4);
- * // => [4, 1]
- */var over=createOver(arrayMap);/**
- * Creates a function that checks if **all** of the `predicates` return
- * truthy when invoked with the arguments it receives.
- *
- * Following shorthands are possible for providing predicates.
- * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
- * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {...(Function|Function[])} [predicates=[_.identity]]
- * The predicates to check.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var func = _.overEvery([Boolean, isFinite]);
- *
- * func('1');
- * // => true
- *
- * func(null);
- * // => false
- *
- * func(NaN);
- * // => false
- */var overEvery=createOver(arrayEvery);/**
- * Creates a function that checks if **any** of the `predicates` return
- * truthy when invoked with the arguments it receives.
- *
- * Following shorthands are possible for providing predicates.
- * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
- * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {...(Function|Function[])} [predicates=[_.identity]]
- * The predicates to check.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var func = _.overSome([Boolean, isFinite]);
- *
- * func('1');
- * // => true
- *
- * func(null);
- * // => true
- *
- * func(NaN);
- * // => false
- *
- * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
- * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
- */var overSome=createOver(arraySome);/**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': 2 } },
- * { 'a': { 'b': 1 } }
- * ];
- *
- * _.map(objects, _.property('a.b'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
- * // => [1, 2]
- */function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path);}/**
- * The opposite of `_.property`; this method creates a function that returns
- * the value at a given path of `object`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Util
- * @param {Object} object The object to query.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var array = [0, 1, 2],
- * object = { 'a': array, 'b': array, 'c': array };
- *
- * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
- * // => [2, 0]
- *
- * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
- * // => [2, 0]
- */function propertyOf(object){return function(path){return object==null?undefined$1:baseGet(object,path);};}/**
- * Creates an array of numbers (positive and/or negative) progressing from
- * `start` up to, but not including, `end`. A step of `-1` is used if a negative
- * `start` is specified without an `end` or `step`. If `end` is not specified,
- * it's set to `start` with `start` then set to `0`.
- *
- * **Note:** JavaScript follows the IEEE-754 standard for resolving
- * floating-point values which can produce unexpected results.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {number} [start=0] The start of the range.
- * @param {number} end The end of the range.
- * @param {number} [step=1] The value to increment or decrement by.
- * @returns {Array} Returns the range of numbers.
- * @see _.inRange, _.rangeRight
- * @example
- *
- * _.range(4);
- * // => [0, 1, 2, 3]
- *
- * _.range(-4);
- * // => [0, -1, -2, -3]
- *
- * _.range(1, 5);
- * // => [1, 2, 3, 4]
- *
- * _.range(0, 20, 5);
- * // => [0, 5, 10, 15]
- *
- * _.range(0, -4, -1);
- * // => [0, -1, -2, -3]
- *
- * _.range(1, 4, 0);
- * // => [1, 1, 1]
- *
- * _.range(0);
- * // => []
- */var range=createRange();/**
- * This method is like `_.range` except that it populates values in
- * descending order.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {number} [start=0] The start of the range.
- * @param {number} end The end of the range.
- * @param {number} [step=1] The value to increment or decrement by.
- * @returns {Array} Returns the range of numbers.
- * @see _.inRange, _.range
- * @example
- *
- * _.rangeRight(4);
- * // => [3, 2, 1, 0]
- *
- * _.rangeRight(-4);
- * // => [-3, -2, -1, 0]
- *
- * _.rangeRight(1, 5);
- * // => [4, 3, 2, 1]
- *
- * _.rangeRight(0, 20, 5);
- * // => [15, 10, 5, 0]
- *
- * _.rangeRight(0, -4, -1);
- * // => [-3, -2, -1, 0]
- *
- * _.rangeRight(1, 4, 0);
- * // => [1, 1, 1]
- *
- * _.rangeRight(0);
- * // => []
- */var rangeRight=createRange(true);/**
- * This method returns a new empty array.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Array} Returns the new empty array.
- * @example
- *
- * var arrays = _.times(2, _.stubArray);
- *
- * console.log(arrays);
- * // => [[], []]
- *
- * console.log(arrays[0] === arrays[1]);
- * // => false
- */function stubArray(){return [];}/**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */function stubFalse(){return false;}/**
- * This method returns a new empty object.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Object} Returns the new empty object.
- * @example
- *
- * var objects = _.times(2, _.stubObject);
- *
- * console.log(objects);
- * // => [{}, {}]
- *
- * console.log(objects[0] === objects[1]);
- * // => false
- */function stubObject(){return {};}/**
- * This method returns an empty string.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {string} Returns the empty string.
- * @example
- *
- * _.times(2, _.stubString);
- * // => ['', '']
- */function stubString(){return '';}/**
- * This method returns `true`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `true`.
- * @example
- *
- * _.times(2, _.stubTrue);
- * // => [true, true]
- */function stubTrue(){return true;}/**
- * Invokes the iteratee `n` times, returning an array of the results of
- * each invocation. The iteratee is invoked with one argument; (index).
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- * @example
- *
- * _.times(3, String);
- * // => ['0', '1', '2']
- *
- * _.times(4, _.constant(0));
- * // => [0, 0, 0, 0]
- */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;}/**
- * Converts `value` to a property path array.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Util
- * @param {*} value The value to convert.
- * @returns {Array} Returns the new property path array.
- * @example
- *
- * _.toPath('a.b.c');
- * // => ['a', 'b', 'c']
- *
- * _.toPath('a[0].b.c');
- * // => ['a', '0', 'b', 'c']
- */function toPath(value){if(isArray(value)){return arrayMap(value,toKey);}return isSymbol(value)?[value]:copyArray(stringToPath(toString(value)));}/**
- * Generates a unique ID. If `prefix` is given, the ID is appended to it.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {string} [prefix=''] The value to prefix the ID with.
- * @returns {string} Returns the unique ID.
- * @example
- *
- * _.uniqueId('contact_');
- * // => 'contact_104'
- *
- * _.uniqueId();
- * // => '105'
- */function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id;}/*------------------------------------------------------------------------*/ /**
- * Adds two numbers.
- *
- * @static
- * @memberOf _
- * @since 3.4.0
- * @category Math
- * @param {number} augend The first number in an addition.
- * @param {number} addend The second number in an addition.
- * @returns {number} Returns the total.
- * @example
- *
- * _.add(6, 4);
- * // => 10
- */var add=createMathOperation(function(augend,addend){return augend+addend;},0);/**
- * Computes `number` rounded up to `precision`.
- *
- * @static
- * @memberOf _
- * @since 3.10.0
- * @category Math
- * @param {number} number The number to round up.
- * @param {number} [precision=0] The precision to round up to.
- * @returns {number} Returns the rounded up number.
- * @example
- *
- * _.ceil(4.006);
- * // => 5
- *
- * _.ceil(6.004, 2);
- * // => 6.01
- *
- * _.ceil(6040, -2);
- * // => 6100
- */var ceil=createRound('ceil');/**
- * Divide two numbers.
- *
- * @static
- * @memberOf _
- * @since 4.7.0
- * @category Math
- * @param {number} dividend The first number in a division.
- * @param {number} divisor The second number in a division.
- * @returns {number} Returns the quotient.
- * @example
- *
- * _.divide(6, 4);
- * // => 1.5
- */var divide=createMathOperation(function(dividend,divisor){return dividend/divisor;},1);/**
- * Computes `number` rounded down to `precision`.
- *
- * @static
- * @memberOf _
- * @since 3.10.0
- * @category Math
- * @param {number} number The number to round down.
- * @param {number} [precision=0] The precision to round down to.
- * @returns {number} Returns the rounded down number.
- * @example
- *
- * _.floor(4.006);
- * // => 4
- *
- * _.floor(0.046, 2);
- * // => 0.04
- *
- * _.floor(4060, -2);
- * // => 4000
- */var floor=createRound('floor');/**
- * Computes the maximum value of `array`. If `array` is empty or falsey,
- * `undefined` is returned.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Math
- * @param {Array} array The array to iterate over.
- * @returns {*} Returns the maximum value.
- * @example
- *
- * _.max([4, 2, 8, 6]);
- * // => 8
- *
- * _.max([]);
- * // => undefined
- */function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined$1;}/**
- * This method is like `_.max` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the criterion by which
- * the value is ranked. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {*} Returns the maximum value.
- * @example
- *
- * var objects = [{ 'n': 1 }, { 'n': 2 }];
- *
- * _.maxBy(objects, function(o) { return o.n; });
- * // => { 'n': 2 }
- *
- * // The `_.property` iteratee shorthand.
- * _.maxBy(objects, 'n');
- * // => { 'n': 2 }
- */function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseGt):undefined$1;}/**
- * Computes the mean of the values in `array`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @returns {number} Returns the mean.
- * @example
- *
- * _.mean([4, 2, 8, 6]);
- * // => 5
- */function mean(array){return baseMean(array,identity);}/**
- * This method is like `_.mean` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the value to be averaged.
- * The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.7.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the mean.
- * @example
- *
- * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
- *
- * _.meanBy(objects, function(o) { return o.n; });
- * // => 5
- *
- * // The `_.property` iteratee shorthand.
- * _.meanBy(objects, 'n');
- * // => 5
- */function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee,2));}/**
- * Computes the minimum value of `array`. If `array` is empty or falsey,
- * `undefined` is returned.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Math
- * @param {Array} array The array to iterate over.
- * @returns {*} Returns the minimum value.
- * @example
- *
- * _.min([4, 2, 8, 6]);
- * // => 2
- *
- * _.min([]);
- * // => undefined
- */function min(array){return array&&array.length?baseExtremum(array,identity,baseLt):undefined$1;}/**
- * This method is like `_.min` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the criterion by which
- * the value is ranked. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {*} Returns the minimum value.
- * @example
- *
- * var objects = [{ 'n': 1 }, { 'n': 2 }];
- *
- * _.minBy(objects, function(o) { return o.n; });
- * // => { 'n': 1 }
- *
- * // The `_.property` iteratee shorthand.
- * _.minBy(objects, 'n');
- * // => { 'n': 1 }
- */function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseLt):undefined$1;}/**
- * Multiply two numbers.
- *
- * @static
- * @memberOf _
- * @since 4.7.0
- * @category Math
- * @param {number} multiplier The first number in a multiplication.
- * @param {number} multiplicand The second number in a multiplication.
- * @returns {number} Returns the product.
- * @example
- *
- * _.multiply(6, 4);
- * // => 24
- */var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand;},1);/**
- * Computes `number` rounded to `precision`.
- *
- * @static
- * @memberOf _
- * @since 3.10.0
- * @category Math
- * @param {number} number The number to round.
- * @param {number} [precision=0] The precision to round to.
- * @returns {number} Returns the rounded number.
- * @example
- *
- * _.round(4.006);
- * // => 4
- *
- * _.round(4.006, 2);
- * // => 4.01
- *
- * _.round(4060, -2);
- * // => 4100
- */var round=createRound('round');/**
- * Subtract two numbers.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Math
- * @param {number} minuend The first number in a subtraction.
- * @param {number} subtrahend The second number in a subtraction.
- * @returns {number} Returns the difference.
- * @example
- *
- * _.subtract(6, 4);
- * // => 2
- */var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend;},0);/**
- * Computes the sum of the values in `array`.
- *
- * @static
- * @memberOf _
- * @since 3.4.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @returns {number} Returns the sum.
- * @example
- *
- * _.sum([4, 2, 8, 6]);
- * // => 20
- */function sum(array){return array&&array.length?baseSum(array,identity):0;}/**
- * This method is like `_.sum` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the value to be summed.
- * The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Math
- * @param {Array} array The array to iterate over.
- * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the sum.
- * @example
- *
- * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
- *
- * _.sumBy(objects, function(o) { return o.n; });
- * // => 20
- *
- * // The `_.property` iteratee shorthand.
- * _.sumBy(objects, 'n');
- * // => 20
- */function sumBy(array,iteratee){return array&&array.length?baseSum(array,getIteratee(iteratee,2)):0;}/*------------------------------------------------------------------------*/ // Add methods that return wrapped values in chain sequences.
- 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.
- lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;// Add methods to `lodash.prototype`.
- mixin(lodash,lodash);/*------------------------------------------------------------------------*/ // Add methods that return unwrapped values in chain sequences.
- 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.
- 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});/*------------------------------------------------------------------------*/ /**
- * The semantic version number.
- *
- * @static
- * @memberOf _
- * @type {string}
- */lodash.VERSION=VERSION;// Assign default placeholders.
- arrayEach(['bind','bindKey','curry','curryRight','partial','partialRight'],function(methodName){lodash[methodName].placeholder=lodash;});// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
- 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.
- 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`.
- 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`.
- 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`.
- 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`.
- 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`.
- 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.
- 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`.
- LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;// Add chain sequence methods to the `lodash` wrapper.
- 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.
- lodash.prototype.first=lodash.prototype.head;if(symIterator){lodash.prototype[symIterator]=wrapperToIterator;}return lodash;};/*--------------------------------------------------------------------------*/ // Export lodash.
- var _=runInContext();// Some AMD build optimizers, like r.js, check for condition patterns like:
- if(freeModule){// Export for Node.js.
- (freeModule.exports=_)._=_;// Export for CommonJS support.
- freeExports._=_;}else {// Export to the global object.
- root._=_;}}).call(commonjsGlobal);
- });
- /* eslint-disable valid-jsdoc */
- /** insertAfter */
- function insertAfter(newElement, targetElement) {
- var parent = targetElement.parentNode;
- if (parent.lastChild == targetElement) {
- parent.appendChild(newElement);
- } else {
- parent.insertBefore(newElement, targetElement.nextSibling);
- }
- }
- var Status = /*#__PURE__*/function () {
- function Status(jSPlugin, id) {
- _classCallCheck$1(this, Status);
- this.id = id;
- this.jSPlugin = jSPlugin;
- this.state = {
- play: false,
- loading: false,
- text: ''
- };
- this.loadingSetText = this.loadingSetText;
- }
- _createClass$1(Status, [{
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "setPlayStatus",
- value: function setPlayStatus(options) {
- this.state = Object.assign(this.state, options);
- }
- }, {
- key: "loadingStart",
- value: function loadingStart(id) {
- var oS = document.createElement('style');
- document.getElementsByTagName("head")[0].appendChild(oS);
- 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;}';
- var domId = id;
- var domElement = document.getElementById(domId);
- var windowWidth = domElement.offsetWidth;
- var windowHeight = domElement.offsetHeight;
- var offsetTop = 0; //`calc(50% - ${(domElement.offsetTop / 2)}px)`;//domElement.offsetTop; // `calc(50% - ${domElement.offsetTop / 2}px)`
- var offsetLeft = domElement.offsetLeft;
- // 先执行清空loading
- if (document.getElementById("".concat(id, "-loading-id-0"))) {
- document.getElementById("".concat(id, "-loading-id-0")).parentNode.removeChild(document.getElementById("".concat(id, "-loading-id-0")));
- }
- var loadingContainerDOM = document.createElement('div');
- loadingContainerDOM.setAttribute('id', "".concat(id, "-loading-id-0"));
- var style = 'position:absolute;outline:none;pointer-events:none;';
- console.log("this.jSPlugin", this.jSPlugin);
- style += 'width: 100%;background-size: cover; background-repeat:no-repeat;';
- style += 'height: 100%;';
- style += 'top:' + offsetTop + ';';
- style += 'left:' + offsetLeft + 'px;';
- loadingContainerDOM.setAttribute('style', style);
- loadingContainerDOM.style.height = windowHeight;
- loadingContainerDOM.setAttribute('class', 'loading-container');
- // loadingContainerDOM.innerHTML= loading;
- insertAfter(loadingContainerDOM, domElement);
- var splitBasis = 1;
- var loadingItemContainer = document.createElement('div');
- var loadingStatusDOM = document.createElement('div');
- loadingItemContainer.setAttribute('class', 'loading-item');
- loadingItemContainer.setAttribute('id', "".concat(id, "-loading-item-0"));
- //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');
- 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;';
- style += 'left:' + calLoadingPostion(windowHeight, windowWidth, splitBasis, 0).left + 'px;';
- style += 'top:' + calLoadingPostion(windowHeight, windowWidth, splitBasis, 0).top + 'px;';
- loadingItemContainer.setAttribute('style', style);
- function calLoadingPostion(windowHeight, windowWidth, splitBasis, i) {
- var top = parseInt(i / splitBasis, 10) * (windowHeight / splitBasis);
- var left = i % splitBasis * (windowWidth / splitBasis);
- return {
- top: top,
- left: left
- };
- }
- var loadingDOM = document.createElement('div');
- loadingStatusDOM.innerHTML = "";
- loadingStatusDOM.style.color = "#fff";
- loadingDOM.setAttribute('class', 'loading');
- loadingDOM.setAttribute('id', 'loading-icon');
- 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>';
- loadingDOM.innerHTML = loading;
- loadingItemContainer.appendChild(loadingDOM);
- // loadingContainer.appendChild(loading);
- loadingItemContainer.appendChild(loadingStatusDOM);
- loadingContainerDOM.appendChild(loadingItemContainer);
- }
- }, {
- key: "loadingStop",
- value: function loadingStop(id) {
- var loadingItemContainerDOM = document.getElementById("".concat(id, "-loading-item-0"));
- if (loadingItemContainerDOM) {
- loadingItemContainerDOM.removeChild(document.getElementById('loading-icon'));
- }
- }
- }, {
- key: "loadingSetText",
- value: function loadingSetText(opt) {
- var _this = this;
- this.loadingClearText();
- if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
- var textElement = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes[1];
- if (!textElement) {
- var loadingItemContainer = document.getElementById("".concat(this.id, "-loading-item-0"));
- loadingItemContainer.style.height = '100%';
- textElement = document.createElement('div');
- textElement.innerHTML = opt.text;
- loadingItemContainer.appendChild(textElement);
- }
- textElement.innerHTML = opt.text;
- textElement.style.fontSize = "14px";
- textElement.style.color = opt.color || "#FFFFFF";
- this.state.text = opt.text;
- if (opt.delayClear) {
- //传入delayClear后在指定时间后清除提示语
- setTimeout(function () {
- _this.loadingClearText();
- }, parseInt(opt.delayClear));
- }
- }
- }
- }, {
- key: "loadingClearText",
- value: function loadingClearText() {
- if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
- var elements = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes;
- if (elements.length > 1) {
- elements[1].parentNode.removeChild(elements[1]);
- } else {
- elements[0] && elements[0].parentNode.removeChild(elements[0]);
- }
- }
- }
- }, {
- key: "loadingClear",
- value: function loadingClear() {
- if (document.getElementById("".concat(this.id, "-loading-item-0"))) {
- var elements = document.getElementById("".concat(this.id, "-loading-item-0")).childNodes;
- for (var i = elements.length - 1; i >= 0; i--) {
- elements[i].parentNode.removeChild(elements[i]);
- }
- if (document.getElementById("".concat(this.id, "-loading-id-0"))) {
- document.getElementById("".concat(this.id, "-loading-id-0")).style.background = 'none';
- }
- if (document.getElementById('loading-icon')) {
- document.getElementById('loading-icon').parentNode.removeChild(document.getElementById('loading-icon'));
- }
- }
- }
- }, {
- key: "loadingEnd",
- value: function loadingEnd() {
- var loadingItemContainerDOM = document.getElementById("".concat(this.id, "-loading-item-0"));
- if (loadingItemContainerDOM) {
- loadingItemContainerDOM.parentNode.removeChild(loadingItemContainerDOM);
- var loadingContainerDOM = document.getElementById("".concat(this.id, "-loading-id-0"));
- if (loadingContainerDOM && loadingContainerDOM.children.length === 0) {
- loadingContainerDOM.parentNode.removeChild(loadingContainerDOM);
- }
- }
- document.getElementById("".concat(this.id, "-loading-item-0")).style.background = 'none';
- }
- }]);
- return Status;
- }();
- var Message = /*#__PURE__*/function () {
- function Message(jSPlugin, id) {
- _classCallCheck$1(this, Message);
- this.id = id;
- this.jSPlugin = jSPlugin;
- this.timer = null;
- this.state = {
- play: false,
- loading: false
- };
- }
- _createClass$1(Message, [{
- key: "default",
- value: function _default(msg) {
- var _this = this;
- var msgId = "msgId";
- if (document.getElementById("".concat(this.id, "-").concat(msgId))) {
- document.getElementById("".concat(this.id, "-wrap")).removeChild(document.getElementById("".concat(this.id, "-").concat(msgId)));
- }
- var messageDOM = document.createElement('div');
- messageDOM.id = "".concat(this.id, "-").concat(msgId);
- 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");
- messageDOM.innerHTML = msg;
- document.getElementById("".concat(this.id, "-wrap")).appendChild(messageDOM);
- if (this.timer) {
- clearTimeout(this.timer);
- }
- this.timer = setTimeout(function () {
- document.getElementById("".concat(_this.id, "-wrap")).removeChild(document.getElementById("".concat(_this.id, "-").concat(msgId)));
- }, 2000);
- }
- }]);
- return Message;
- }();
- var data$8 = [
- {
- moduleCode: "",
- detailCode: "405984",
- description: "",
- solution: "",
- updateTime: 1559564188000
- },
- {
- moduleCode: "",
- detailCode: "10035",
- description: "获取子账户AccessToken异常,子账户不存在或子账户不属于该开发者",
- solution: "",
- updateTime: 1559551958000
- },
- {
- moduleCode: "",
- detailCode: "1052674",
- description: "获取本地录像失败",
- solution: "",
- updateTime: 1558579653000
- },
- {
- moduleCode: "",
- detailCode: "395547",
- description: "",
- solution: "",
- updateTime: 1557367296000
- },
- {
- moduleCode: "",
- detailCode: "12",
- description: "",
- solution: "",
- updateTime: 1557229476000
- },
- {
- moduleCode: "",
- detailCode: "10052",
- description: "余额不足",
- solution: "",
- updateTime: 1557121463000
- },
- {
- moduleCode: "",
- detailCode: "20108",
- description: "当前用户和所添加用户不是好友关系",
- solution: "",
- updateTime: 1556541725000
- },
- {
- moduleCode: "",
- detailCode: "10009",
- description: "",
- solution: "",
- updateTime: 1556422452000
- },
- {
- moduleCode: "",
- detailCode: "320001",
- description: "通道不存在",
- solution: "请检查录像机的关联状态是否正常,没有摄像头的通道无法播放",
- updateTime: 1556419044000
- },
- {
- moduleCode: "",
- detailCode: "120001",
- description: "通道不存在",
- solution: "请检查录像机的关联状态是否正常,没有摄像头的通道无法播放",
- updateTime: 1556419030000
- },
- {
- moduleCode: "",
- detailCode: "320049",
- description: "",
- solution: "",
- updateTime: 1556272984000
- },
- {
- moduleCode: "",
- detailCode: "380227",
- description: "",
- solution: "",
- updateTime: 1556264379000
- },
- {
- moduleCode: "",
- detailCode: "10033",
- description: "policy参数信息异常",
- solution: "",
- updateTime: 1555922124000
- },
- {
- moduleCode: "",
- detailCode: "10065",
- description: "weakAppKey 不属于accessToken对应的用户",
- solution: "",
- updateTime: 1555497522000
- },
- {
- moduleCode: "",
- detailCode: "100001",
- description: "",
- solution: "",
- updateTime: 1555141776000
- },
- {
- moduleCode: "",
- detailCode: "395558",
- description: "",
- solution: "",
- updateTime: 1554987121000
- },
- {
- moduleCode: "",
- detailCode: "70001",
- description: "智能家居买断用户设备受到限制,建议合理选择pagestart和pageSize",
- solution: "",
- updateTime: 1554691023000
- },
- {
- moduleCode: "",
- detailCode: "170001",
- description: "",
- solution: "",
- updateTime: 1554691023000
- },
- {
- moduleCode: "",
- detailCode: "1012",
- description: "重置失败",
- solution: "",
- updateTime: 1554645841000
- },
- {
- moduleCode: "",
- detailCode: "1043",
- description: "重置失败",
- solution: "",
- updateTime: 1554645834000
- },
- {
- moduleCode: "",
- detailCode: "60060",
- description: "直播功能未开通",
- solution: "通道未开通直播功能,请先开通直播",
- updateTime: 1554346018000
- },
- {
- moduleCode: "",
- detailCode: "380203",
- description: "",
- solution: "",
- updateTime: 1554093666000
- },
- {
- moduleCode: "",
- detailCode: "399048",
- description: "免费版并发数达到上限,请升级企业版使用多并发能力",
- solution: "升级成为企业版套餐即可取消并发数限制",
- updateTime: 1553839878000
- },
- {
- moduleCode: "",
- detailCode: "60007",
- description: "预置点个数超过最大值",
- solution: "",
- updateTime: 1553671316000
- },
- {
- moduleCode: "",
- detailCode: "1005",
- description: "",
- solution: "",
- updateTime: 1553513701000
- },
- {
- moduleCode: "",
- detailCode: "20605",
- description: "其他用户正在认证中",
- solution: "",
- updateTime: 1552976317000
- },
- {
- moduleCode: "",
- detailCode: "90004",
- description: "当前型号设备暂时不支持AI任务:CS-C3W-3B1WFR-YGL",
- solution: "",
- updateTime: 1552898525000
- },
- {
- moduleCode: "",
- detailCode: "60046",
- description: "添加的设备的IP和本设备的IP冲突",
- solution: "",
- updateTime: 1552872372000
- },
- {
- moduleCode: "",
- detailCode: "3",
- description: "修改视频清晰度失败!",
- solution: "",
- updateTime: 1552440229000
- },
- {
- moduleCode: "",
- detailCode: "1013",
- description: "",
- solution: "",
- updateTime: 1552035069000
- },
- {
- moduleCode: "",
- detailCode: "370007",
- description: "",
- solution: "",
- updateTime: 1551852327000
- },
- {
- moduleCode: "",
- detailCode: "-1",
- description: "",
- solution: "",
- updateTime: 1551752889000
- },
- {
- moduleCode: "",
- detailCode: "30005",
- description: "弱账户不存在",
- solution: "",
- updateTime: 1551422358000
- },
- {
- moduleCode: "",
- detailCode: "90006",
- description: "用户操作AI任务受限",
- solution: "",
- updateTime: 1551073320000
- },
- {
- moduleCode: "",
- detailCode: "60203",
- description: "未开通相关服务",
- solution: "",
- updateTime: 1550623070000
- },
- {
- moduleCode: "",
- detailCode: "10002",
- description: "accessToken过期或异常",
- solution: "",
- updateTime: 1550300346000
- },
- {
- moduleCode: "",
- detailCode: "380339",
- description: "",
- solution: "",
- updateTime: 1549889458000
- },
- {
- moduleCode: "",
- detailCode: "90002",
- description: "AI任务设备配置数达到上限:3",
- solution: "",
- updateTime: 1549071664000
- },
- {
- moduleCode: "",
- detailCode: "380008",
- description: "",
- solution: "",
- updateTime: 1549005979000
- },
- {
- moduleCode: "",
- detailCode: "320227",
- description: "",
- solution: "",
- updateTime: 1548739731000
- },
- {
- moduleCode: "",
- detailCode: "60059",
- description: "ezopen地址均不可用",
- solution: "",
- updateTime: 1548395350000
- },
- {
- moduleCode: "",
- detailCode: "10005",
- description: "appKey异常",
- solution: "",
- updateTime: 1548317858000
- },
- {
- moduleCode: "",
- detailCode: "60045",
- description: "添加的设备的IP和其他通道的IP冲突",
- solution: "",
- updateTime: 1548155085000
- },
- {
- moduleCode: "",
- detailCode: "60047",
- description: "码流类型不支持",
- solution: "",
- updateTime: 1547962108000
- },
- {
- moduleCode: "",
- detailCode: "60041",
- description: "添加的设备被其他设备关联或响应超时",
- solution: "",
- updateTime: 1547960980000
- },
- {
- moduleCode: "",
- detailCode: "110029",
- description: "个人用户接口调用频率超限",
- solution: "请升级企业版:https://open.ys7.com/price.html",
- updateTime: 1547606859000
- },
- {
- moduleCode: "",
- detailCode: "380355",
- description: "设备直连推流异常结束",
- solution: "",
- updateTime: 1547106294000
- },
- {
- moduleCode: "",
- detailCode: "320081",
- description: "",
- solution: "",
- updateTime: 1547106279000
- },
- {
- moduleCode: "",
- detailCode: "60035",
- description: "购买云存储服务失败",
- solution: "",
- updateTime: 1547026959000
- },
- {
- moduleCode: "",
- detailCode: "90005",
- description: "设备已存在:C75714141",
- solution: "",
- updateTime: 1546940622000
- },
- {
- moduleCode: "",
- detailCode: "1053445",
- description: "该时间段没有录像片段",
- solution: "",
- updateTime: 1546935727000
- },
- {
- moduleCode: "",
- detailCode: "90007",
- description: "设备未加入到AI任务",
- solution: "",
- updateTime: 1546932948000
- },
- {
- moduleCode: "",
- detailCode: "326000",
- description: "",
- solution: "",
- updateTime: 1546823143000
- },
- {
- moduleCode: "",
- detailCode: "1021",
- description: "重置失败",
- solution: "",
- updateTime: 1546781152000
- },
- {
- moduleCode: "",
- detailCode: "2001",
- description: "删除设备失败!",
- solution: "",
- updateTime: 1546422886000
- },
- {
- moduleCode: "",
- detailCode: "380425",
- description: "",
- solution: "",
- updateTime: 1546407694000
- },
- {
- moduleCode: "",
- detailCode: "120097",
- description: "",
- solution: "",
- updateTime: 1546085995000
- },
- {
- moduleCode: "",
- detailCode: "10059",
- description: "requestId已存在",
- solution: "",
- updateTime: 1545824509000
- },
- {
- moduleCode: "",
- detailCode: "1154723",
- description: "",
- solution: "",
- updateTime: 1545795209000
- },
- {
- moduleCode: "",
- detailCode: "60043",
- description: "添加的设备超出最大数量",
- solution: "",
- updateTime: 1545493607000
- },
- {
- moduleCode: "",
- detailCode: "1152677",
- description: "",
- solution: "",
- updateTime: 1545313404000
- },
- {
- moduleCode: "",
- detailCode: "20097",
- description: "设备添加异常,设备验证码为ABCDEF或设备被N1,R1关联",
- solution: "",
- updateTime: 1545310795000
- },
- {
- moduleCode: "",
- detailCode: "10060",
- description: "设备不支持该云存储类型",
- solution: "",
- updateTime: 1545309064000
- },
- {
- moduleCode: "",
- detailCode: "20102",
- description: "无相应邀请信息,无法接受邀请",
- solution: "",
- updateTime: 1545204966000
- },
- {
- moduleCode: "",
- detailCode: "10053",
- description: "云存储开通中",
- solution: "",
- updateTime: 1545100293000
- },
- {
- moduleCode: "",
- detailCode: "20401",
- description: "用户云空间信息不存在",
- solution: "",
- updateTime: 1545017880000
- },
- {
- moduleCode: "",
- detailCode: "20600",
- description: "临时密码数已达上限",
- solution: "",
- updateTime: 1544873457000
- },
- {
- moduleCode: "",
- detailCode: "901",
- description: "",
- solution: "",
- updateTime: 1544693519000
- },
- {
- moduleCode: "",
- detailCode: "60210",
- description: "图片数据错误",
- solution: "",
- updateTime: 1544604457000
- },
- {
- moduleCode: "",
- detailCode: "10013",
- description: "您的应用没有权限调用",
- solution: "",
- updateTime: 1544416237000
- },
- {
- moduleCode: "",
- detailCode: "70007",
- description: "授权码不存在",
- solution: "",
- updateTime: 1544179533000
- },
- {
- moduleCode: "",
- detailCode: "10015",
- description: "授权地址不存在",
- solution: "",
- updateTime: 1544163240000
- },
- {
- moduleCode: "",
- detailCode: "320423",
- description: "",
- solution: "",
- updateTime: 1544100685000
- },
- {
- moduleCode: "",
- detailCode: "370009",
- description: "",
- solution: "",
- updateTime: 1544077151000
- },
- {
- moduleCode: "",
- detailCode: "10031",
- description: "子账户或萤石用户没有权限",
- solution: "",
- updateTime: 1543990462000
- },
- {
- moduleCode: "",
- detailCode: "10055",
- description: "设备不支持试用云存储服务",
- solution: "",
- updateTime: 1543986292000
- },
- {
- moduleCode: "",
- detailCode: "60042",
- description: "添加的设备密码错误",
- solution: "",
- updateTime: 1543710913000
- },
- {
- moduleCode: "",
- detailCode: "60082",
- description: "设备正在响应本次声源定位",
- solution: "",
- updateTime: 1543647426000
- },
- {
- moduleCode: "",
- detailCode: "10056",
- description: "设备不支持云存储服务转出",
- solution: "",
- updateTime: 1543558342000
- },
- {
- moduleCode: "",
- detailCode: "20104",
- description: "好友不存在",
- solution: "",
- updateTime: 1543492403000
- },
- {
- moduleCode: "",
- detailCode: "20111",
- description: "好友不是等待验证状态,无法接受邀请",
- solution: "",
- updateTime: 1543492365000
- },
- {
- moduleCode: "",
- detailCode: "20107",
- description: "不能添加自己为好友",
- solution: "",
- updateTime: 1543480986000
- },
- {
- moduleCode: "",
- detailCode: "1",
- description: "设备返回其他错误",
- solution: "",
- updateTime: 1543459921000
- },
- {
- moduleCode: "",
- detailCode: "60084",
- description: "当前正在关闭隐私遮蔽",
- solution: "",
- updateTime: 1543456515000
- },
- {
- moduleCode: "",
- detailCode: "380255",
- description: "",
- solution: "",
- updateTime: 1543411652000
- },
- {
- moduleCode: "",
- detailCode: "20015",
- description: "设备不支持",
- solution: "",
- updateTime: 1543390936000
- },
- {
- moduleCode: "",
- detailCode: "30003",
- description: "手机验证码错误",
- solution: "",
- updateTime: 1543389137000
- },
- {
- moduleCode: "",
- detailCode: "20615",
- description: "锁用户已存在",
- solution: "",
- updateTime: 1543388325000
- },
- {
- moduleCode: "",
- detailCode: "60061",
- description: "账户流量已超出或未购买,限制开通",
- solution: "",
- updateTime: 1543372581000
- },
- {
- moduleCode: "",
- detailCode: "60020",
- description: "设备不支持该信令",
- solution: "",
- updateTime: 1543321636000
- },
- {
- moduleCode: "",
- detailCode: "320146",
- description: "",
- solution: "",
- updateTime: 1543318472000
- },
- {
- moduleCode: "",
- detailCode: "60018",
- description: "设备升级失败",
- solution: "",
- updateTime: 1543304928000
- },
- {
- moduleCode: "",
- detailCode: "60044",
- description: "添加的设备网络不可达超时",
- solution: "",
- updateTime: 1543304102000
- },
- {
- moduleCode: "",
- detailCode: "20619",
- description: "主用户无法删除",
- solution: "",
- updateTime: 1543290219000
- },
- {
- moduleCode: "",
- detailCode: "20608",
- description: "锁用户不存在",
- solution: "",
- updateTime: 1543281950000
- },
- {
- moduleCode: "",
- detailCode: "20609",
- description: "设备响应超时,门锁通信故障或者电量不足,请重试.",
- solution: "",
- updateTime: 1543281601000
- },
- {
- moduleCode: "",
- detailCode: "1049954",
- description: "升级设备失败",
- solution: "",
- updateTime: 1543279264000
- },
- {
- moduleCode: "",
- detailCode: "60009",
- description: "正在调用预置点",
- solution: "",
- updateTime: 1543238114000
- },
- {
- moduleCode: "",
- detailCode: "1052677",
- description: "获取本地录像失败",
- solution: "",
- updateTime: 1543207604000
- },
- {
- moduleCode: "",
- detailCode: "327000",
- description: "",
- solution: "",
- updateTime: 1543196609000
- },
- {
- moduleCode: "",
- detailCode: "20021",
- description: "设备在线,未被用户添加",
- solution: "",
- updateTime: 1543193436000
- },
- {
- moduleCode: "",
- detailCode: "20202",
- description: "操作留言信息失败",
- solution: "",
- updateTime: 1543191562000
- },
- {
- moduleCode: "",
- detailCode: "1052678",
- description: "获取本地录像失败",
- solution: "",
- updateTime: 1543132218000
- },
- {
- moduleCode: "",
- detailCode: "1054723",
- description: "格式化设备失败",
- solution: "",
- updateTime: 1543129833000
- },
- {
- moduleCode: "",
- detailCode: "20109",
- description: "对应分享不存在",
- solution: "",
- updateTime: 1543129111000
- },
- {
- moduleCode: "",
- detailCode: "60026",
- description: "设备处于隐私遮蔽状态",
- solution: "",
- updateTime: 1543110403000
- },
- {
- moduleCode: "",
- detailCode: "60083",
- description: "当前正在开启隐私遮蔽",
- solution: "",
- updateTime: 1543071148000
- },
- {
- moduleCode: "",
- detailCode: "60001",
- description: "用户无云台控制权限",
- solution: "",
- updateTime: 1543059167000
- },
- {
- moduleCode: "",
- detailCode: "2003",
- description: "设备不在线",
- solution: "",
- updateTime: 1543051046000
- },
- {
- moduleCode: "",
- detailCode: "-24",
- description: "设置设备enable错误",
- solution: "",
- updateTime: 1543042701000
- },
- {
- moduleCode: "",
- detailCode: "10018",
- description: "",
- solution: "",
- updateTime: 1543041564000
- },
- {
- moduleCode: "",
- detailCode: "20103",
- description: "好友已存在",
- solution: "",
- updateTime: 1543038430000
- },
- {
- moduleCode: "",
- detailCode: "70010",
- description: "授权异常请重试",
- solution: "",
- updateTime: 1543035590000
- },
- {
- moduleCode: "",
- detailCode: "60056",
- description: "删除设备失败",
- solution: "",
- updateTime: 1543031275000
- },
- {
- moduleCode: "",
- detailCode: "60040",
- description: "添加的设备不在同一局域网",
- solution: "",
- updateTime: 1543031210000
- },
- {
- moduleCode: "",
- detailCode: "60019",
- description: "加密已开启",
- solution: "",
- updateTime: 1543029931000
- },
- {
- moduleCode: "",
- detailCode: "1054722",
- description: "格式化设备失败",
- solution: "",
- updateTime: 1543028537000
- },
- {
- moduleCode: "",
- detailCode: "20016",
- description: "当前设备正在格式化",
- solution: "",
- updateTime: 1543028537000
- },
- {
- moduleCode: "",
- detailCode: "10024",
- description: "透明通道权限校验不通过",
- solution: "",
- updateTime: 1543025540000
- },
- {
- moduleCode: "",
- detailCode: "6002",
- description: "删除设备失败!",
- solution: "",
- updateTime: 1543025026000
- },
- {
- moduleCode: "",
- detailCode: "1011",
- description: "验证码错误!",
- solution: "",
- updateTime: 1543016865000
- },
- {
- moduleCode: "",
- detailCode: "60032",
- description: "卡密已使用",
- solution: "",
- updateTime: 1543006668000
- },
- {
- moduleCode: "",
- detailCode: "10034",
- description: "子账号已存在",
- solution: "",
- updateTime: 1542989194000
- },
- {
- moduleCode: "",
- detailCode: "20301",
- description: "根据uuid查询联动信息不存在",
- solution: "",
- updateTime: 1542988651000
- },
- {
- moduleCode: "",
- detailCode: "1041",
- description: "获取验证码过于频繁",
- solution: "",
- updateTime: 1542980953000
- },
- {
- moduleCode: "",
- detailCode: "10012",
- description: "该appkey下已绑定重复的phone!",
- solution: "",
- updateTime: 1542980800000
- },
- {
- moduleCode: "",
- detailCode: "1008",
- description: "phone不合法!",
- solution: "",
- updateTime: 1542979812000
- },
- {
- moduleCode: "",
- detailCode: "60023",
- description: "订阅操作失败",
- solution: "",
- updateTime: 1542979006000
- },
- {
- moduleCode: "",
- detailCode: "5",
- description: "设备返回其他错误",
- solution: "",
- updateTime: 1542977828000
- },
- {
- moduleCode: "",
- detailCode: "60006",
- description: "云台当前操作失败",
- solution: "",
- updateTime: 1542977598000
- },
- {
- moduleCode: "",
- detailCode: "131",
- description: "修改视频清晰度失败!",
- solution: "",
- updateTime: 1542977246000
- },
- {
- moduleCode: "",
- detailCode: "10019",
- description: "密码错误",
- solution: "",
- updateTime: 1542976628000
- },
- {
- moduleCode: "",
- detailCode: "10004",
- description: "用户不存在",
- solution: "",
- updateTime: 1542976268000
- },
- {
- moduleCode: "",
- detailCode: "20201",
- description: "操作报警信息失败",
- solution: "",
- updateTime: 1542975906000
- },
- {
- moduleCode: "",
- detailCode: "20024",
- description: "设备不在线,已经被别的用户添加",
- solution: "",
- updateTime: 1542975858000
- },
- {
- moduleCode: "",
- detailCode: "60004",
- description: "设备云台旋转达到左限位",
- solution: "",
- updateTime: 1542975207000
- },
- {
- moduleCode: "",
- detailCode: "1052679",
- description: "修改视频清晰度失败!",
- solution: "",
- updateTime: 1542974886000
- },
- {
- moduleCode: "",
- detailCode: "20031",
- description: "请在萤石客户端关闭终端绑定",
- solution: "",
- updateTime: 1542974756000
- },
- {
- moduleCode: "",
- detailCode: "1053825",
- description: "获取本地录像失败",
- solution: "",
- updateTime: 1542974692000
- },
- {
- moduleCode: "",
- detailCode: "60011",
- description: "预置点不存在",
- solution: "",
- updateTime: 1542974414000
- },
- {
- moduleCode: "",
- detailCode: "1052936",
- description: "修改视频清晰度失败!",
- solution: "",
- updateTime: 1542974390000
- },
- {
- moduleCode: "",
- detailCode: "1016",
- description: "",
- solution: "",
- updateTime: 1542974273000
- },
- {
- moduleCode: "",
- detailCode: "10032",
- description: "子账号不存在",
- solution: "",
- updateTime: 1542973906000
- },
- {
- moduleCode: "",
- detailCode: "20013",
- description: "设备已被别人添加",
- solution: "",
- updateTime: 1542973817000
- },
- {
- moduleCode: "",
- detailCode: "50000",
- description: "服务器错误!",
- solution: "",
- updateTime: 1542973801000
- },
- {
- moduleCode: "",
- detailCode: "60010",
- description: "该预置点已经是当前位置",
- solution: "",
- updateTime: 1542973800000
- },
- {
- moduleCode: "",
- detailCode: "60003",
- description: "设备云台旋转达到下限位",
- solution: "",
- updateTime: 1542973770000
- },
- {
- moduleCode: "",
- detailCode: "4",
- description: "设备返回其他错误",
- solution: "",
- updateTime: 1542973755000
- },
- {
- moduleCode: "",
- detailCode: "60016",
- description: "加密未开启,无需关闭",
- solution: "",
- updateTime: 1542973753000
- },
- {
- moduleCode: "",
- detailCode: "60002",
- description: "设备云台旋转达到上限位",
- solution: "",
- updateTime: 1542973742000
- },
- {
- moduleCode: "",
- detailCode: "20023",
- description: "设备不在线,未被用户添加",
- solution: "",
- updateTime: 1542973685000
- },
- {
- moduleCode: "",
- detailCode: "10008",
- description: "",
- solution: "",
- updateTime: 1542973676000
- },
- {
- moduleCode: "",
- detailCode: "20010",
- description: "设备验证码错误",
- solution: "",
- updateTime: 1542973658000
- },
- {
- moduleCode: "",
- detailCode: "60005",
- description: "设备云台旋转达到右限位",
- solution: "",
- updateTime: 1542973657000
- },
- {
- moduleCode: "",
- detailCode: "20017",
- description: "设备已经被自己添加",
- solution: "",
- updateTime: 1542973648000
- },
- {
- moduleCode: "",
- detailCode: "20020",
- description: "设备在线,已经被自己添加",
- solution: "",
- updateTime: 1542973533000
- },
- {
- moduleCode: "",
- detailCode: "20029",
- description: "设备不在线,已经被自己添加",
- solution: "",
- updateTime: 1542973530000
- },
- {
- moduleCode: "",
- detailCode: "10014",
- description: "APPKEY下对应的第三方userId和phone未绑定!",
- solution: "",
- updateTime: 1542973499000
- },
- {
- moduleCode: "",
- detailCode: "20002",
- description: "设备不存在",
- solution: "",
- updateTime: 1542973499000
- },
- {
- moduleCode: "",
- detailCode: "10030",
- description: "appkey和appsecret不匹配",
- solution: "",
- updateTime: 1542973490000
- },
- {
- moduleCode: "",
- detailCode: "20022",
- description: "设备在线,已经被别的用户添加",
- solution: "",
- updateTime: 1542973486000
- },
- {
- moduleCode: "",
- detailCode: "20008",
- description: "设备响应超时",
- solution: "",
- updateTime: 1542973484000
- },
- {
- moduleCode: "",
- detailCode: "20032",
- description: "该用户下通道不存在",
- solution: "",
- updateTime: 1542973481000
- },
- {
- moduleCode: "",
- detailCode: "20006",
- description: "网络异常",
- solution: "",
- updateTime: 1542973475000
- },
- {
- moduleCode: "",
- detailCode: "20014",
- description: "deviceSerial不合法!",
- solution: "",
- updateTime: 1542973454000
- },
- {
- moduleCode: "",
- detailCode: "20007",
- description: "设备不在线",
- solution: "",
- updateTime: 1542973454000
- },
- {
- moduleCode: "",
- detailCode: "20018",
- description: "该用户不拥有该设备",
- solution: "",
- updateTime: 1542973453000
- },
- {
- moduleCode: "",
- detailCode: "10010",
- description: "",
- solution: "",
- updateTime: 1542973453000
- },
- {
- moduleCode: "",
- detailCode: "10011",
- description: "未绑定!",
- solution: "",
- updateTime: 1542973453000
- },
- {
- moduleCode: "",
- detailCode: "20001",
- description: "通道不存在!",
- solution: "",
- updateTime: 1542973452000
- },
- {
- moduleCode: "",
- detailCode: "10017",
- description: "appKey不存在",
- solution: "",
- updateTime: 1542973451000
- },
- {
- moduleCode: "",
- detailCode: "400259",
- description: "",
- solution: "",
- updateTime: 1542875643000
- },
- {
- moduleCode: "",
- detailCode: "400004",
- description: "",
- solution: "",
- updateTime: 1542873364000
- },
- {
- moduleCode: "",
- detailCode: "3840",
- description: "",
- solution: "",
- updateTime: 1541860000000
- },
- {
- moduleCode: "",
- detailCode: "-1017",
- description: "",
- solution: "",
- updateTime: 1541733663000
- },
- {
- moduleCode: "",
- detailCode: "320025",
- description: "",
- solution: "",
- updateTime: 1541078281000
- },
- {
- moduleCode: "",
- detailCode: "320024",
- description: "",
- solution: "",
- updateTime: 1540801374000
- },
- {
- moduleCode: "",
- detailCode: "321002",
- description: "",
- solution: "",
- updateTime: 1540631734000
- },
- {
- moduleCode: "",
- detailCode: "321000",
- description: "",
- solution: "",
- updateTime: 1540609178000
- },
- {
- moduleCode: "",
- detailCode: "321022",
- description: "",
- solution: "",
- updateTime: 1540548345000
- },
- {
- moduleCode: "",
- detailCode: "321016",
- description: "",
- solution: "",
- updateTime: 1540287187000
- },
- {
- moduleCode: "",
- detailCode: "320023",
- description: "",
- solution: "",
- updateTime: 1539825993000
- },
- {
- moduleCode: "",
- detailCode: "-1016",
- description: "",
- solution: "",
- updateTime: 1539584931000
- },
- {
- moduleCode: "",
- detailCode: "8",
- description: "",
- solution: "",
- updateTime: 1539391812000
- },
- {
- moduleCode: "",
- detailCode: "1075127593",
- description: "",
- solution: "",
- updateTime: 1538959251000
- },
- {
- moduleCode: "",
- detailCode: "380421",
- description: "",
- solution: "",
- updateTime: 1537288465000
- },
- {
- moduleCode: "",
- detailCode: "322000",
- description: "麦克风权限未开启",
- solution: "",
- updateTime: 1536820136000
- },
- {
- moduleCode: "",
- detailCode: "1152678",
- description: "",
- solution: "",
- updateTime: 1536738348000
- },
- {
- moduleCode: "",
- detailCode: "320047",
- description: "",
- solution: "",
- updateTime: 1536664472000
- },
- {
- moduleCode: "",
- detailCode: "327006",
- description: "",
- solution: "",
- updateTime: 1536136120000
- },
- {
- moduleCode: "",
- detailCode: "1074807593",
- description: "",
- solution: "",
- updateTime: 1536135035000
- },
- {
- moduleCode: "",
- detailCode: "320291",
- description: "",
- solution: "",
- updateTime: 1536110836000
- },
- {
- moduleCode: "",
- detailCode: "320045",
- description: "",
- solution: "",
- updateTime: 1535963775000
- },
- {
- moduleCode: "",
- detailCode: "370004",
- description: "",
- solution: "",
- updateTime: 1535883699000
- },
- {
- moduleCode: "",
- detailCode: "1149954",
- description: "",
- solution: "",
- updateTime: 1535700674000
- },
- {
- moduleCode: "",
- detailCode: "320053",
- description: "",
- solution: "",
- updateTime: 1535681079000
- },
- {
- moduleCode: "",
- detailCode: "400000",
- description: "",
- solution: "",
- updateTime: 1535532332000
- },
- {
- moduleCode: "",
- detailCode: "110028",
- description: "个人版抓图接口日调用次数超出限制",
- solution: "请升级企业版:https://open.ys7.com/price.html",
- updateTime: 1535348756000
- },
- {
- moduleCode: "",
- detailCode: "110027",
- description: "个人版帐号数量超出安全限制,无法调用",
- solution: "请升级企业版:https://open.ys7.com/price.html",
- updateTime: 1535348734000
- },
- {
- moduleCode: "",
- detailCode: "110026",
- description: "设备数量超出个人版限制,当前设备无法操作",
- solution: "请升级企业版:https://open.ys7.com/price.html",
- updateTime: 1535348588000
- },
- {
- moduleCode: "",
- detailCode: "100000",
- description: "",
- solution: "",
- updateTime: 1534980008000
- },
- {
- moduleCode: "",
- detailCode: "324004",
- description: "",
- solution: "",
- updateTime: 1534927762000
- },
- {
- moduleCode: "",
- detailCode: "360104",
- description: "",
- solution: "",
- updateTime: 1534761006000
- },
- {
- moduleCode: "",
- detailCode: "320204",
- description: "",
- solution: "",
- updateTime: 1534584221000
- },
- {
- moduleCode: "",
- detailCode: "380001",
- description: "",
- solution: "",
- updateTime: 1534404715000
- },
- {
- moduleCode: "",
- detailCode: "380204",
- description: "",
- solution: "",
- updateTime: 1534401682000
- },
- {
- moduleCode: "",
- detailCode: "328006",
- description: "",
- solution: "",
- updateTime: 1534144407000
- },
- {
- moduleCode: "",
- detailCode: "321703",
- description: "",
- solution: "",
- updateTime: 1534127274000
- },
- {
- moduleCode: "",
- detailCode: "321510",
- description: "",
- solution: "",
- updateTime: 1533428892000
- },
- {
- moduleCode: "",
- detailCode: "321006",
- description: "",
- solution: "",
- updateTime: 1533036916000
- },
- {
- moduleCode: "",
- detailCode: "50009",
- description: "",
- solution: "",
- updateTime: 1532078548000
- },
- {
- moduleCode: "",
- detailCode: "50007",
- description: "",
- solution: "",
- updateTime: 1531991720000
- },
- {
- moduleCode: "",
- detailCode: "50018",
- description: "",
- solution: "",
- updateTime: 1531912829000
- },
- {
- moduleCode: "",
- detailCode: "380451",
- description: "",
- solution: "",
- updateTime: 1531615700000
- },
- {
- moduleCode: "",
- detailCode: "380336",
- description: "",
- solution: "",
- updateTime: 1531231721000
- },
- {
- moduleCode: "",
- detailCode: "360020",
- description: "",
- solution: "",
- updateTime: 1531117554000
- },
- {
- moduleCode: "",
- detailCode: "380418",
- description: "",
- solution: "",
- updateTime: 1531107070000
- },
- {
- moduleCode: "",
- detailCode: "1153445",
- description: "设备在该时间段内没有录像",
- solution: "",
- updateTime: 1530944007000
- },
- {
- moduleCode: "",
- detailCode: "110007",
- description: "调用接口总次数达到上限",
- solution: "请升级企业版,获取更高能力",
- updateTime: 1530935584000
- },
- {
- moduleCode: "",
- detailCode: "360019",
- description: "",
- solution: "",
- updateTime: 1530869771000
- },
- {
- moduleCode: "",
- detailCode: "360100",
- description: "",
- solution: "",
- updateTime: 1530786188000
- },
- {
- moduleCode: "",
- detailCode: "380042",
- description: "",
- solution: "",
- updateTime: 1530775199000
- },
- {
- moduleCode: "",
- detailCode: "320355",
- description: "",
- solution: "",
- updateTime: 1530716074000
- },
- {
- moduleCode: "",
- detailCode: "100003",
- description: "",
- solution: "",
- updateTime: 1530232541000
- },
- {
- moduleCode: "",
- detailCode: "371026",
- description: "",
- solution: "",
- updateTime: 1530192600000
- },
- {
- moduleCode: "",
- detailCode: "102",
- description: "",
- solution: "",
- updateTime: 1529895641000
- },
- {
- moduleCode: "",
- detailCode: "380201",
- description: "",
- solution: "",
- updateTime: 1529740929000
- },
- {
- moduleCode: "",
- detailCode: "320054",
- description: "",
- solution: "",
- updateTime: 1529544875000
- },
- {
- moduleCode: "",
- detailCode: "500101",
- description: "",
- solution: "",
- updateTime: 1529485953000
- },
- {
- moduleCode: "",
- detailCode: "321001",
- description: "",
- solution: "",
- updateTime: 1529411048000
- },
- {
- moduleCode: "",
- detailCode: "321508",
- description: "",
- solution: "",
- updateTime: 1529393279000
- },
- {
- moduleCode: "",
- detailCode: "405991",
- description: "",
- solution: "",
- updateTime: 1529380238000
- },
- {
- moduleCode: "",
- detailCode: "380461",
- description: "",
- solution: "",
- updateTime: 1529130941000
- },
- {
- moduleCode: "",
- detailCode: "-1019",
- description: "",
- solution: "",
- updateTime: 1529057245000
- },
- {
- moduleCode: "",
- detailCode: "322009",
- description: "",
- solution: "",
- updateTime: 1528965717000
- },
- {
- moduleCode: "",
- detailCode: "324005",
- description: "",
- solution: "",
- updateTime: 1528950153000
- },
- {
- moduleCode: "",
- detailCode: "325000",
- description: "",
- solution: "",
- updateTime: 1528947143000
- },
- {
- moduleCode: "",
- detailCode: "326032",
- description: "",
- solution: "",
- updateTime: 1528872971000
- },
- {
- moduleCode: "",
- detailCode: "325032",
- description: "",
- solution: "",
- updateTime: 1528863189000
- },
- {
- moduleCode: "",
- detailCode: "328000",
- description: "",
- solution: "",
- updateTime: 1528794505000
- },
- {
- moduleCode: "",
- detailCode: "53",
- description: "",
- solution: "",
- updateTime: 1528693249000
- },
- {
- moduleCode: "",
- detailCode: "-1020",
- description: "",
- solution: "",
- updateTime: 1528499440000
- },
- {
- moduleCode: "",
- detailCode: "329032",
- description: "",
- solution: "",
- updateTime: 1528446301000
- },
- {
- moduleCode: "",
- detailCode: "-1202",
- description: "",
- solution: "",
- updateTime: 1528439820000
- },
- {
- moduleCode: "",
- detailCode: "2",
- description: "",
- solution: "",
- updateTime: 1528434175000
- },
- {
- moduleCode: "",
- detailCode: "1152936",
- description: "",
- solution: "",
- updateTime: 1528345986000
- },
- {
- moduleCode: "",
- detailCode: "328011",
- description: "",
- solution: "",
- updateTime: 1528338600000
- },
- {
- moduleCode: "",
- detailCode: "28",
- description: "",
- solution: "",
- updateTime: 1528337530000
- },
- {
- moduleCode: "",
- detailCode: "320356",
- description: "",
- solution: "",
- updateTime: 1528188693000
- },
- {
- moduleCode: "",
- detailCode: "320357",
- description: "",
- solution: "",
- updateTime: 1528188517000
- },
- {
- moduleCode: "",
- detailCode: "405800",
- description: "",
- solution: "",
- updateTime: 1528168732000
- },
- {
- moduleCode: "",
- detailCode: "405996",
- description: "",
- solution: "",
- updateTime: 1528168686000
- },
- {
- moduleCode: "",
- detailCode: "380357",
- description: "",
- solution: "",
- updateTime: 1528011565000
- },
- {
- moduleCode: "",
- detailCode: "328022",
- description: "",
- solution: "",
- updateTime: 1527929065000
- },
- {
- moduleCode: "",
- detailCode: "380003",
- description: "",
- solution: "",
- updateTime: 1527927819000
- },
- {
- moduleCode: "",
- detailCode: "50004",
- description: "",
- solution: "",
- updateTime: 1527770643000
- },
- {
- moduleCode: "",
- detailCode: "50011",
- description: "",
- solution: "",
- updateTime: 1527770635000
- },
- {
- moduleCode: "",
- detailCode: "370017",
- description: "",
- solution: "",
- updateTime: 1527739514000
- },
- {
- moduleCode: "",
- detailCode: "327032",
- description: "",
- solution: "",
- updateTime: 1527726704000
- },
- {
- moduleCode: "",
- detailCode: "324001",
- description: "",
- solution: "",
- updateTime: 1527681892000
- },
- {
- moduleCode: "",
- detailCode: "405997",
- description: "",
- solution: "",
- updateTime: 1527653408000
- },
- {
- moduleCode: "",
- detailCode: "405995",
- description: "",
- solution: "",
- updateTime: 1527647283000
- },
- {
- moduleCode: "",
- detailCode: "1153825",
- description: "",
- solution: "",
- updateTime: 1527601747000
- },
- {
- moduleCode: "",
- detailCode: "328002",
- description: "",
- solution: "",
- updateTime: 1527495292000
- },
- {
- moduleCode: "",
- detailCode: "1152679",
- description: "",
- solution: "",
- updateTime: 1527486665000
- },
- {
- moduleCode: "",
- detailCode: "380356",
- description: "",
- solution: "",
- updateTime: 1527125669000
- },
- {
- moduleCode: "",
- detailCode: "328032",
- description: "",
- solution: "",
- updateTime: 1527069382000
- },
- {
- moduleCode: "",
- detailCode: "22",
- description: "",
- solution: "",
- updateTime: 1527049826000
- },
- {
- moduleCode: "",
- detailCode: "9",
- description: "",
- solution: "",
- updateTime: 1527006778000
- },
- {
- moduleCode: "",
- detailCode: "89",
- description: "",
- solution: "",
- updateTime: 1526622784000
- },
- {
- moduleCode: "",
- detailCode: "328016",
- description: "",
- solution: "",
- updateTime: 1526452365000
- },
- {
- moduleCode: "",
- detailCode: "368005",
- description: "",
- solution: "",
- updateTime: 1525921264000
- },
- {
- moduleCode: "",
- detailCode: "0",
- description: "",
- solution: "",
- updateTime: 1525920242000
- },
- {
- moduleCode: "",
- detailCode: "380006",
- description: "",
- solution: "",
- updateTime: 1525918868000
- },
- {
- moduleCode: "",
- detailCode: "310",
- description: "",
- solution: "",
- updateTime: 1525834436000
- },
- {
- moduleCode: "",
- detailCode: "360011",
- description: "",
- solution: "",
- updateTime: 1525681552000
- },
- {
- moduleCode: "",
- detailCode: "170005",
- description: "",
- solution: "",
- updateTime: 1525433900000
- },
- {
- moduleCode: "",
- detailCode: "50023",
- description: "",
- solution: "",
- updateTime: 1525403338000
- },
- {
- moduleCode: "",
- detailCode: "100131",
- description: "",
- solution: "",
- updateTime: 1525229691000
- },
- {
- moduleCode: "",
- detailCode: "-1018",
- description: "",
- solution: "",
- updateTime: 1525142341000
- },
- {
- moduleCode: "",
- detailCode: "362026",
- description: "",
- solution: "",
- updateTime: 1524882677000
- },
- {
- moduleCode: "",
- detailCode: "368007",
- description: "",
- solution: "",
- updateTime: 1524832269000
- },
- {
- moduleCode: "",
- detailCode: "54",
- description: "",
- solution: "",
- updateTime: 1524793646000
- },
- {
- moduleCode: "",
- detailCode: "1154722",
- description: "",
- solution: "",
- updateTime: 1524620807000
- },
- {
- moduleCode: "",
- detailCode: "320229",
- description: "",
- solution: "",
- updateTime: 1524551682000
- },
- {
- moduleCode: "",
- detailCode: "360012",
- description: "",
- solution: "",
- updateTime: 1524472094000
- },
- {
- moduleCode: "",
- detailCode: "380229",
- description: "",
- solution: "",
- updateTime: 1524110755000
- },
- {
- moduleCode: "",
- detailCode: "360016",
- description: "",
- solution: "",
- updateTime: 1523933518000
- },
- {
- moduleCode: "",
- detailCode: "-1003",
- description: "",
- solution: "",
- updateTime: 1523584804000
- },
- {
- moduleCode: "",
- detailCode: "410026",
- description: "",
- solution: "",
- updateTime: 1523517430000
- },
- {
- moduleCode: "",
- detailCode: "360102",
- description: "TTS初始化失败",
- solution: "",
- updateTime: 1523503528000
- },
- {
- moduleCode: "",
- detailCode: "360013",
- description: "设备开启了隐私保护",
- solution: "",
- updateTime: 1523503507000
- },
- {
- moduleCode: "",
- detailCode: "360010",
- description: "设备正在对讲中",
- solution: "",
- updateTime: 1523503491000
- },
- {
- moduleCode: "",
- detailCode: "360007",
- description: "TTS关闭了与客户端的连接",
- solution: "",
- updateTime: 1523503475000
- },
- {
- moduleCode: "",
- detailCode: "360006",
- description: "客户端接收发生错误",
- solution: "",
- updateTime: 1523503457000
- },
- {
- moduleCode: "",
- detailCode: "360005",
- description: "客户端发送的消息错误",
- solution: "",
- updateTime: 1523503437000
- },
- {
- moduleCode: "",
- detailCode: "360004",
- description: "TTS内部发生错误",
- solution: "",
- updateTime: 1523503421000
- },
- {
- moduleCode: "",
- detailCode: "360003",
- description: "TTS的设备端发生错误",
- solution: "",
- updateTime: 1523503397000
- },
- {
- moduleCode: "",
- detailCode: "360002",
- description: "对讲发起超时",
- solution: "",
- updateTime: 1523503376000
- },
- {
- moduleCode: "",
- detailCode: "360001",
- description: "客户端请求超时",
- solution: "",
- updateTime: 1523503357000
- },
- {
- moduleCode: "",
- detailCode: "320077",
- description: "",
- solution: "",
- updateTime: 1523444274000
- },
- {
- moduleCode: "",
- detailCode: "370047",
- description: "",
- solution: "",
- updateTime: 1523440480000
- },
- {
- moduleCode: "",
- detailCode: "100002",
- description: "",
- solution: "",
- updateTime: 1523413964000
- },
- {
- moduleCode: "",
- detailCode: "-1004",
- description: "",
- solution: "",
- updateTime: 1523336653000
- },
- {
- moduleCode: "",
- detailCode: "380000",
- description: "",
- solution: "",
- updateTime: 1523180856000
- },
- {
- moduleCode: "",
- detailCode: "380213",
- description: "",
- solution: "",
- updateTime: 1523180623000
- },
- {
- moduleCode: "",
- detailCode: "380101",
- description: "",
- solution: "",
- updateTime: 1522834231000
- },
- {
- moduleCode: "",
- detailCode: "50047",
- description: "",
- solution: "",
- updateTime: 1522833243000
- },
- {
- moduleCode: "",
- detailCode: "-999",
- description: "",
- solution: "",
- updateTime: 1522831034000
- },
- {
- moduleCode: "",
- detailCode: "320418",
- description: "",
- solution: "",
- updateTime: 1522829072000
- },
- {
- moduleCode: "",
- detailCode: "-1009",
- description: "",
- solution: "",
- updateTime: 1522746247000
- },
- {
- moduleCode: "",
- detailCode: "320209",
- description: "",
- solution: "",
- updateTime: 1522744395000
- },
- {
- moduleCode: "",
- detailCode: "368006",
- description: "",
- solution: "",
- updateTime: 1522744300000
- },
- {
- moduleCode: "",
- detailCode: "369003",
- description: "",
- solution: "",
- updateTime: 1522736355000
- },
- {
- moduleCode: "",
- detailCode: "405989",
- description: "",
- solution: "",
- updateTime: 1522726571000
- },
- {
- moduleCode: "",
- detailCode: "-1012",
- description: "",
- solution: "",
- updateTime: 1522726203000
- },
- {
- moduleCode: "",
- detailCode: "322016",
- description: "",
- solution: "",
- updateTime: 1522722918000
- },
- {
- moduleCode: "",
- detailCode: "500103",
- description: "",
- solution: "",
- updateTime: 1522655556000
- },
- {
- moduleCode: "",
- detailCode: "405999",
- description: "",
- solution: "",
- updateTime: 1522654716000
- },
- {
- moduleCode: "",
- detailCode: "321032",
- description: "",
- solution: "",
- updateTime: 1522647732000
- },
- {
- moduleCode: "",
- detailCode: "381101",
- description: "",
- solution: "",
- updateTime: 1522392414000
- },
- {
- moduleCode: "",
- detailCode: "399999",
- description: "",
- solution: "",
- updateTime: 1522379834000
- },
- {
- moduleCode: "",
- detailCode: "380103",
- description: "",
- solution: "",
- updateTime: 1522312724000
- },
- {
- moduleCode: "",
- detailCode: "360014",
- description: "",
- solution: "",
- updateTime: 1522304341000
- },
- {
- moduleCode: "",
- detailCode: "-1005",
- description: "",
- solution: "",
- updateTime: 1522288195000
- },
- {
- moduleCode: "",
- detailCode: "100005",
- description: "",
- solution: "",
- updateTime: 1522218849000
- },
- {
- moduleCode: "",
- detailCode: "100004",
- description: "",
- solution: "",
- updateTime: 1522209053000
- },
- {
- moduleCode: "",
- detailCode: "106002",
- description: "",
- solution: "",
- updateTime: 1522206200000
- },
- {
- moduleCode: "",
- detailCode: "410030",
- description: "",
- solution: "",
- updateTime: 1522162252000
- },
- {
- moduleCode: "",
- detailCode: "-1002",
- description: "",
- solution: "",
- updateTime: 1522150690000
- },
- {
- moduleCode: "",
- detailCode: "-1200",
- description: "",
- solution: "",
- updateTime: 1522139025000
- },
- {
- moduleCode: "",
- detailCode: "-1001",
- description: "",
- solution: "",
- updateTime: 1522046436000
- },
- {
- moduleCode: "",
- detailCode: "-1011",
- description: "",
- solution: "",
- updateTime: 1522045931000
- },
- {
- moduleCode: "",
- detailCode: "381102",
- description: "",
- solution: "",
- updateTime: 1522044953000
- },
- {
- moduleCode: "",
- detailCode: "381103",
- description: "",
- solution: "",
- updateTime: 1522044953000
- },
- {
- moduleCode: "",
- detailCode: "391205",
- description: "vtdu解析服务器ip失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "391206",
- description: "vtdu描述符select失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "391207",
- description: "vtdu文件描述符不在可读中",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "391208",
- description: "vtdu网络发生错误getsockopt",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "391209",
- description: "vtdu描述符select超时",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395000",
- description: "cas回复信令,发现内存已经释放(和设备之间异常断开)",
- msg: "播放失败请重试",
- solution: "检查设备网络;刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395400",
- description: "私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395402",
- description: "回放找不到录像文件",
- msg: "回放找不到录像文件,本地存储请检查存储卡是否接触良好",
- solution: "检查是否有存储卡并且接触良好",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395403",
- description: "操作码或信令密钥与设备不匹配",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395404",
- description: "设备不在线",
- solution: "检查设备网络;重启设备接入萤石云",
- msg: "设备不在线,请检查设备网络或重启设备接入萤石云",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395405",
- description: "流媒体向设备发送或接受信令超时/cas响应超时",
- msg: "播放失败,请检查设备网络或重启设备",
- solution: "检查设备网络;重启设备",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395406",
- description: "token失效",
- msg: "播放失败请重试或重启设备",
- solution: "刷新重试或者重启设备",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395407",
- description: "客户端的URL格式错误",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395409",
- description: "预览开启隐私保护",
- msg: "播放失败请关闭隐私遮蔽",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395410",
- description: "设备达到最大连接数",
- solution: "请升级设备固件版本",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395411",
- description: "token无权限",
- msg: "播放失败",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395412",
- description: "session不存在",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395413",
- description: "验证token的他异常(不具体) ",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395415",
- description: "设备通道错",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395416",
- description: "设备资源受限",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395451",
- description: "设备不支持的码流类型",
- msg: "播放失败请重试或切换设备码流",
- solution: "刷新重试或者切换到高清模式",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395452",
- description: "设备链接流媒体服务器失败",
- msg: "播放失败,请检查设备网络或重启设备或重新加载",
- solution: "检查设备网络,重启设备,刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395454",
- description: "流媒体中关于设备取流会话不存在",
- msg: "播放失败请重试",
- solution: "流媒体中关于设备取流会话不存在",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395455",
- description: "设备通道未关联",
- msg: "播放失败,请检查设备通道是否关联",
- solution: "检查设备通道是否关联",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395456",
- description: "设备通道关联设备不在线",
- msg: "播放失败,请检查设备通道是否上线",
- solution: "检查设备通道是否上线",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395457",
- description: "客户端不支持端到端加密",
- msg: "播放失败",
- solution: "客户端不支持端到端加密",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395458",
- description: "设备不支持当前并发ECDH密",
- msg: "客户端不支持端到端加密",
- solution: "设备不支持当前并发ECDH密",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395459",
- description: "VTDU 处理ECDH 加密失败",
- msg: "播放失败",
- solution: "VTDU 处理ECDH 加密失败",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395460",
- description: "流媒体中关于设备取流会话不存在",
- msg: "播放失败请重试",
- solution: "流媒体中关于设备取流会话不存在",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395492",
- description: "设备不支持的命令",
- msg: "操作失败,设备不支持",
- solution: "",
- updateTime: 1522220180000
- },
- {
- moduleCode: "",
- detailCode: "395500",
- description: "服务器处理失败",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395501",
- description: "流媒体vtdu达到最大负载,请扩容",
- msg: "播放失败请重试",
- solution: "服务器负载达到上限,请稍后重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395503",
- description: "vtm返回分配vtdu失败",
- msg: "播放失败请重试",
- solution: "vtdu服务异常,请请稍后重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395504",
- description: "流媒体vtdu达到最大负载",
- msg: "播放失败请重试",
- solution: "服务器负载达到上限,请稍后重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395505",
- description: "vtm ecdh解密失败",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395506",
- description: "vtm 返回IPC不支持取流(需要IPC添加NVR后支持)",
- msg: "播放失败,请绑定NVR使用",
- solution: "IPC绑定NVR使用",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395544",
- description: "设备返回无视频源",
- msg: "播放失败,请检查设备接触情况",
- solution: "设备是否接触良好; 如果一直无法解决,请联系技术支持",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395545",
- description: "视频分享时间已经结束",
- msg: "视频分享时间已结束",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395546",
- description: "vtdu返回达到取流并发路数限制",
- msg: "并发上限,请升级为企业版",
- solution: "请升级为企业版,放开并发限制",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395547",
- description: "vtdu返回开放平台用户并发限制",
- msg: "并发上限,请升级为企业版",
- solution: "请确定开放平台用户预览是否超过用户并发数量限制",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395556",
- description: "ticket校验失败",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395557",
- description: "回放服务器等待流头超时",
- msg: "播放失败请重试",
- solution: "刷新重试,检测设备网络,重启设备",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395558",
- description: "查找录像开始时间错误",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395560",
- description: "群组分享取流二次验证失败",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395561",
- description: "分享群组用户被锁住",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395562",
- description: "群组分享用户权限变更",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395563",
- description: "认证服务连接失败",
- msg: "播放失败请重试",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395564",
- description: "认证超时",
- msg: "播放失败请重试",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395566",
- description: "不在分享时间内预览",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395567",
- description: "分享通道被锁定",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395568",
- description: "未找到认证类型",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395569",
- description: "认证返回的参数异常",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395600",
- description: "分享设备不在分享时间内",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395601",
- description: "群组分享用户没权限",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395602",
- description: "群组分享权限变更",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395610",
- description: "接收流头失败",
- msg: "播放失败请重试并检查设备网络情况以及设备配置",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395620",
- description: "心跳超时",
- msg: "播放失败请重试并检查设备网络情况以及设备配置",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395530",
- description: "机房故障不可用",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395701",
- description: "cas信令返回格式错误",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395702",
- description: "SPGW请求Cas、Status透传超时",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "395703",
- description: "SPGW请求http不通",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396001",
- description: "客户端参数出错",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396099",
- description: "客户端默认错误",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396101",
- description: "不支持的命令",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396102",
- description: "设备流头发送失败",
- msg: "播放失败请重试",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396103",
- description: "cas/设备返回错误1",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396104",
- description: "cas/设备返回错误-1",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396105",
- description: "设备返回错误码3",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396106",
- description: "设备返回错误码4",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396107",
- description: "设备返回错误码5",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396108",
- description: "cas信令回应重复",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396109",
- description: "视频广场取消分享",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396110",
- description: "设备信令默认错误",
- msg: "播放失败请重试",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396501",
- description: "设备数据链路和实际链路不匹配",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396502",
- description: "设备数据链路重复建立连接",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396503",
- description: "设备数据链路端口不匹配",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396504",
- description: "缓存设备数据链路失败(内存块不足)",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396505",
- description: "设备发送确认头消息重复",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396506",
- description: "设备数据先于确定头部到达",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396508",
- description: "设备数据头部长度非法",
- msg: "播放失败请重试或重启设备",
- solution: "刷新重试,或者重启设备",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396509",
- description: "索引找不到设备数据管理块",
- msg: "播放失败请重试",
- solution: "刷新重试",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396510",
- description: "设备数据链路vtdu内存块协议状态不匹配",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396511",
- description: "设备数据头部没有streamkey错误",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396512",
- description: "设备数据头部非法(较笼统)",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396513",
- description: "设备数据长度过小",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396514",
- description: "设备老协议推流头部没有streamkey错误",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396515",
- description: "设备老协议推流数据非法",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396516",
- description: "设备老协议索引找不到内存管理块",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396517",
- description: "设备老协议推流数据非法",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396518",
- description: "设备数据包过大",
- msg: "播放失败请重试或重启设备",
- solution: "刷新重试,或者重启设备",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396519",
- description: "设备推流链路网络不稳定",
- msg: "播放失败,请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396520",
- description: "设备推流链路网络不稳定(默认)",
- msg: "播放失败请重试或重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396700",
- description: "异常数据包",
- msg: "播放失败,设备重启",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "396701",
- description: "回放结束数据包",
- msg: "回放结束",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397001",
- description: "与相应服务连接失败",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397002",
- description: "与相应服务连接失败",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397003",
- description: "与相应服务连接失败",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397004",
- description: "与相应服务连接失败",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397005",
- description: "VTDU连接失败,或VTDU侧断开连接",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397006",
- description: "vtm断开连接(无需 关注)",
- msg: "播放失败请重试,请检查设备网络情况以及连接情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "397007",
- description: "客户端发送缓冲区满(上行带宽太小)",
- msg: "播放失败,上行带宽过小请检查设备网络情况",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "399000",
- description: "无效包,包过大",
- msg: " 检查设备重启设备",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "399001",
- description: "地址不合法",
- msg: "播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "399002",
- description: "缺少端口",
- msg: " 播放失败",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "170003",
- description: "refreshToken不存在",
- solution: "建议用户重新调用logout接口,然后调用openLoginPage接口重新启动登录页面登录",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "170004",
- description: "refreshToken已过期",
- solution: "建议用户重新调用logout接口,然后调用openLoginPage接口重新启动登录页面登录",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380011",
- description: "设备隐私保护中",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380045",
- description: "设备直连取流连接数量过大",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380047",
- description: "设备不支持该命令",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380077",
- description: "设备正在对讲中",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380102",
- description: "数据接收异常",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380205",
- description: "设备检测入参异常",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380209",
- description: "网络连接超时",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "380212",
- description: "设备端网络连接超时",
- solution: "",
- updateTime: 1522034841000
- },
- {
- moduleCode: "",
- detailCode: "101007",
- description: "手机号未注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120503",
- description: "正在响铃",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390016",
- description: "vtdu成功响应未携带流头",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101008",
- description: "手机号码不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120504",
- description: "室内机正在通话",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390017",
- description: "无数据流,尚未使用",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101009",
- description: "用户名与手机不匹配",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120505",
- description: "设备操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390018",
- description: "信令消息体PB解析失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101010",
- description: "获取验证码失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120506",
- description: "非法命令",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390019",
- description: "信令消息体PB封装失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101011",
- description: "验证码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120507",
- description: "智能锁密码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390020",
- description: "申请系统内存资源失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101012",
- description: "验证码失效",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120508",
- description: "开关锁失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390021",
- description: "vtdu地址尚未获取到",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101013",
- description: "用户不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120509",
- description: "开关锁超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390022",
- description: "客户端尚未支持",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101014",
- description: "密码不正确或者appKey不正确",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120510",
- description: "智能锁设备繁忙",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390023",
- description: "获取系统socket资源失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101015",
- description: "用户被锁住",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120511",
- description: "远程开锁功能未打开",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390024",
- description: "上层填充的StreamSsnId不匹配",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101021",
- description: "验证参数异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120600",
- description: "临时密码数已达上限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390025",
- description: "链接服务器失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101026",
- description: "邮箱已经被注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120601",
- description: "添加临时密码失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390026",
- description: "客户端请求未收到服务端应答",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101031",
- description: "邮箱未注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120602",
- description: "删除临时密码失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390027",
- description: "链路断开",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101032",
- description: "邮箱不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120603",
- description: "该临时密码不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390028",
- description: "没有取流链接",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101041",
- description: "获取验证码过于频繁",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120604",
- description: "指纹锁射频通信失败,请稍后再试",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390029",
- description: "流成功停止",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101043",
- description: "手机验证码输入错误超过规定次数",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120605",
- description: "其他用户正在认证中",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390030",
- description: "客户端防串流校验失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102000",
- description: "设备不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120606",
- description: "验证已启动,请在120s内进行本地验证和调用添加设备接口",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390031",
- description: "应用层tcp粘包处理缓冲区满",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102001",
- description: "摄像机不存在",
- solution: "摄像机未注册到萤石云平台,请仔细检查摄像机的网络配置,确保连接到网络",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120607",
- description: "删除用户失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390032",
- description: "无效状态迁移",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102003",
- description: "设备不在线",
- solution: "参考服务中心排查方法",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120608",
- description: "用户不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390033",
- description: "无效客户端状态",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102004",
- description: "设备异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120609",
- description: "设备响应超时,门锁通信故障或者电量不足,请重试.",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390034",
- description: "向vtm取流流媒体信息请求超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102007",
- description: "设备序列号不正确",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120610",
- description: "获取临时密码列表失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390035",
- description: "向代理取流请求超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "102009",
- description: "设备请求响应超时异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "130001",
- description: "用户不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390036",
- description: "向代理保活取流请求超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "105000",
- description: "设备已被自己添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "130002",
- description: "手机号码已经注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390037",
- description: "向vtdu取流请求超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "105001",
- description: "设备已被别人添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "130003",
- description: "手机验证码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390038",
- description: "向vtdu保活取流请求超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "105002",
- description: "设备验证码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "130004",
- description: "终端绑定操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391001",
- description: "vtm地址或端口非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107001",
- description: "邀请不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "149999",
- description: "数据异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391002",
- description: "vtm生成文件描述符失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107002",
- description: "邀请验证失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "150000",
- description: "服务器异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391003",
- description: "vtm设置文件描述符非阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107003",
- description: "邀请用户不匹配",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160000",
- description: "设备不支持云台控制",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391004",
- description: "vtm设置文件描述符阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107004",
- description: "云存储连接失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160001",
- description: "用户无云台控制权限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391005",
- description: "vtm解析服务器ip失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "7005",
- description: "VTDU主动断开连接",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107005",
- description: "VTDU主动断开连接",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160002",
- description: "设备云台旋转达到上限位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391006",
- description: "vtm描述符select失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107006",
- description: "不能邀请自己",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160003",
- description: "设备云台旋转达到下限位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391007",
- description: "vtm文件描述符不在可读中",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "107007",
- description: "重复邀请",
- solution: "分享和删除分享必须全部由接口形式操作,如果与萤石客户端混用会造成这个问题,解决办法:在萤石客户端清空所有相关分享数据并重新添加设备,再通过接口操作即可",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160004",
- description: "设备云台旋转达到左限位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391008",
- description: "vtm网络发生错误getsockopt",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110001",
- description: "参数错误",
- solution: "参数为空或者格式不对",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160005",
- description: "设备云台旋转达到右限位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391009",
- description: "vtm描述符select超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110002",
- description: "accessToken异常或过期",
- solution: "accessToken有效期为七天,建议在accessToken即将过期或者出现10002错误码的时候重新获取accessToken",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160006",
- description: "云台当前操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391101",
- description: "proxy地址或端口非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110004",
- description: "用户不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160007",
- description: "预置点个数超过最大值",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391102",
- description: "proxy生成文件描述符失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110005",
- description: "appKey异常",
- solution: "确认appKey状态,不通过或者冻结状态会返回该错误码",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160009",
- description: "正在调用预置点",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391103",
- description: "proxy设置文件描述符非阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110006",
- description: "ip受限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160010",
- description: "该预置点已经是当前位置",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391104",
- description: "proxy设置文件描述符阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160011",
- description: "预置点不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391105",
- description: "proxy解析服务器ip失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110008",
- description: "签名错误",
- solution: "①获取签名方式详见apidemo及[旧]API文档 ②注意编码格式为UTF-8",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160013",
- description: "设备版本已是最新",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391106",
- description: "proxy描述符select失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110009",
- description: "签名参数错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160014",
- description: "设备正在升级",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391107",
- description: "proxy文件描述符不在可读中",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110010",
- description: "签名超时",
- solution: "请调用同步服务器时间接口进行校时",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160015",
- description: "设备正在重启",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391108",
- description: "proxy网络发生错误getsockopt",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110011",
- description: "未开通萤石云服务",
- solution: "参照绑定流程",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160016",
- description: "加密未开启,无须关闭",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391109",
- description: "proxy描述符select超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110012",
- description: "第三方账户与萤石账号已经绑定",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160017",
- description: "设备抓图失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391201",
- description: "vtdu地址或端口非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110013",
- description: "应用没有权限调用此接口",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160018",
- description: "设备升级失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391202",
- description: "vtdu生成文件描述符失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110014",
- description: "APPKEY下对应的第三方userId和phone未绑定",
- solution: "获取AccessToken时所用appKey与SDK所用appKey不一致",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160019",
- description: "加密已开启",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391203",
- description: "vtdu设置文件描述符非阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110017",
- description: "appKey不存在",
- solution: "请填写在官网申请的应用秘钥",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160020",
- description: "不支持该命令",
- solution: "请确认设备是否支持该命令",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "391204",
- description: "vtdu设置文件描述符阻塞失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110018",
- description: "AccessToken与Appkey不匹配",
- solution: "请检查获取accessToken对应的appKey和SDK中设置的appKey是否一致",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160023",
- description: "订阅操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110019",
- description: "密码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160024",
- description: "取消订阅操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110020",
- description: "请求方法为空",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160025",
- description: "客流统计配置失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110021",
- description: "ticket校验失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160026",
- description: "设备处于隐私遮蔽状态",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110022",
- description: "透传目的地非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160027",
- description: "设备正在镜像操作",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110024",
- description: "无透传权限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160028",
- description: "设备正在键控动作",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110025",
- description: "appKey被禁止使用通明通道",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160029",
- description: "设备处于语音对讲状态",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160030",
- description: "卡密输入错误次数过多,24小时后再输入",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160031",
- description: "卡密信息不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160032",
- description: "卡密状态不对或已过期",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160033",
- description: "卡密非卖品,只能开通对应的绑定设备",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110030",
- description: "appKey和appSecret不匹配",
- solution: "请检查appKey和appSecret是否对应",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160035",
- description: "购买云存储服务失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110031",
- description: "子账户或萤石用户没有权限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160040",
- description: "添加的设备不在同一局域网",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110032",
- description: "子账户不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160041",
- description: "添加的设备被其他设备关联或响应超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110033",
- description: "子账户未设置授权策略",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160042",
- description: "添加的设备密码错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110034",
- description: "子账户已存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160043",
- description: "添加的设备超出最大数量",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110035",
- description: "获取子账户AccessToken异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160044",
- description: "添加的设备网络不可达超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110036",
- description: "子账户被禁用",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160045",
- description: "添加的设备的IP和其他通道的IP冲突",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "110051",
- description: "无权限进行抓图",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160046",
- description: "添加的设备的IP和本设备的IP冲突",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160047",
- description: "码流类型不支持",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120002",
- description: "设备不存在",
- solution: "①设备没有注册到萤石云平台,请检查下设备网络参数,确保能正常连接网络②设备序列号不存在",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160048",
- description: "带宽超出系统接入带宽",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120003",
- description: "参数异常,SDK版本过低",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160049",
- description: "IP或者端口不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120004",
- description: "参数异常,SDK版本过低",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160050",
- description: "添加的设备版本不支持需要升级才能接入",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120005",
- description: "安全认证失败,需进行SDK安全认证",
- solution: "已去掉安全验证",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160051",
- description: "添加的设备不支持接入",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120006",
- description: "网络异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160052",
- description: "添加的设备通道号出错",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120007",
- description: "设备不在线",
- solution: "参考服务中心排查方法",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160053",
- description: "添加的设备分辨率不支持",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120008",
- description: "设备响应超时",
- solution: "设备响应超时,请检测设备网络或重试",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160054",
- description: "添加的设备账号被锁定",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120009",
- description: "子账号不能添加设备",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160055",
- description: "添加的设备取码流出错",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120010",
- description: "设备验证码错误",
- solution: "验证码在设备标签上,六位大写字母,注意大小写",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160056",
- description: "删除设备失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120012",
- description: "设备添加失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160057",
- description: "删除的设备未关联",
- solution: "检查IPC与NVR是否有关联关系",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120013",
- description: "设备已被别人添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160060",
- description: "地址未绑定",
- solution: "请前往官网设置直播",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120014",
- description: "设备序列号不正确",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160061",
- description: "账户流量已超出或未购买,限制开通",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120015",
- description: "设备不支持该功能",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160062",
- description: "该通道直播已开通",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120016",
- description: "当前设备正在格式化",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160063",
- description: "直播未使用或直播已关闭",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120017",
- description: "设备已被自己添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160070",
- description: "设备不能转移给自己",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120018",
- description: "该用户不拥有该设备",
- solution: "确认设备是否属于用户",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160071",
- description: "设备不能转移,设备与其他设备存在关联关系",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400001",
- description: "参数为空",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120019",
- description: "设备不支持云存储服务",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160072",
- description: "设备不能转移,通道被分享给其他用户或者分享到视频广场",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400002",
- description: "参数错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120020",
- description: "设备在线,被自己添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160073",
- description: "云存储转移失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400025",
- description: "设备不支持对讲",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120021",
- description: "设备在线,但是未被用户添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160080",
- description: "当前正在声源定位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400029",
- description: "没有初始化或资源被释放",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120022",
- description: "设备在线,但是已经被别的用户添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160081",
- description: "当前正在轨迹巡航",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400030",
- description: "json解析异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120023",
- description: "设备不在线,未被用户添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160082",
- description: "设备正在响应本次声源定位",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400031",
- description: "网络异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120024",
- description: "设备不在线,但是已经被别的用户添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160083",
- description: "当前正在开启隐私遮蔽",
- solution: "设备正在操作隐私遮蔽,无法进行当前操作",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400032",
- description: "设备信息异常为空",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120025",
- description: "重复申请分享",
- solution: "确认设备是否由添加过该设备且申请过分享的账户下是否还存在分享记录",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "160084",
- description: "当前正在关闭隐私遮蔽",
- solution: "设备正在操作隐私遮蔽,无法进行当前操作",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400034",
- description: "取流超时",
- solution: "一般是由于网络状况不好导致,可以尝试下让用户重新播放",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120026",
- description: "视频广场不存在该视频",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "380290",
- description: " 连接CAS服务器失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400035",
- description: "设备已加密,需要输入验证码",
- solution: "收到此错误码,需要让用户输入验证码后,调用EZPlayer.setPlayKey传入验证码,并重新调用播放函数",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120027",
- description: "视频转码失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361001",
- description: "对讲服务端排队超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400036",
- description: "播放验证码错误",
- solution: "收到此错误码,需要让用户输入验证码后,调用EZPlayer.setPlayKey传入验证码,并重新调用播放函数",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120028",
- description: "设备固件升级包不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361002",
- description: "对讲服务端处理超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400037",
- description: "surfacehold错误",
- solution: "请检查是否是播放之前销毁了surface,收到此错误也可以重新建立surface后播放",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120029",
- description: "设备不在线,但是已经被自己添加",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361003",
- description: "设备链接对讲服务器超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400100",
- description: "未知错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120030",
- description: "该用户不拥有该视频广场视频",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361004",
- description: "服务器内部错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400200",
- description: "player sdk出错,这种错误一般开发者也是无法解决,不具体分类传出,传一个统一的inner错误码出去",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120031",
- description: "开启终端绑定,硬件特征码验证失败",
- solution: "请在萤石客户端关闭终端绑定,参考此步骤",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361005",
- description: "解析消息失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400300",
- description: "内存溢出",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120032",
- description: "该用户下通道不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361006",
- description: "请求重定向--需要向其他服务申请对讲",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400901",
- description: "设备不在线,可以提示用户",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120033",
- description: "无法收藏自己分享的视频",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361007",
- description: "请求url非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400902",
- description: "accesstoken异常或失效,需要重新获取accesstoken,并传入到sdk",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120034",
- description: "该用户下无设备",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361008",
- description: "token失效",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400903",
- description: "当前账号开启了终端绑定,只允许指定设备登录操作,提示用户登录i.ys7.com解除终端绑定",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120090",
- description: "用户反馈失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361009",
- description: "设备验证码或者通信秘钥不匹配",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400904",
- description: "设备正在对讲中",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120095",
- description: "APP包下载失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361010",
- description: "设备已经在对讲",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "400905",
- description: "设备开启了隐私保护,不允许预览、对讲等",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120096",
- description: "APP包信息删除失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361011",
- description: "设备10s响应超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120101",
- description: "视频不支持分享给本人",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361012",
- description: "设备不在线",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320002",
- description: "参数无效",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120102",
- description: "无相应邀请信息",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361013",
- description: "设备开启隐私保护拒绝对讲",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320003",
- description: "暂不支持此操作",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120103",
- description: "好友已存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361014",
- description: "token无权限",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320004",
- description: "内存溢出",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120104",
- description: "好友不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361015",
- description: "设备返回session不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320005",
- description: "创建CAS session失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120105",
- description: "好友状态错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361016",
- description: "验证token其他异常错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320006",
- description: "创建cloud session失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120106",
- description: "对应群组不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361017",
- description: "服务端监听设备建立端口超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320007",
- description: "token失效",
- solution: "重新设置token后再重试",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120107",
- description: "不能添加自己为好友",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361018",
- description: "设备链路异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320008",
- description: "token池里面没有token,请传入token",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120108",
- description: "当前用户和所添加用户不是好友关系",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361019",
- description: "对讲服务端不支持的信令消息",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320009",
- description: "传入新的INIT_PARAM并reset(保留,目前未用)",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120109",
- description: "对应分享不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361020",
- description: "对讲服务端解析对讲请求未携带会话描述能力集",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320010",
- description: "请重试",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120110",
- description: "好友群组不属于当前用户",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361021",
- description: "对讲服务端优先能力集结果为空",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320011",
- description: "500毫秒后请重试",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120111",
- description: "好友不是等待验证状态",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361022",
- description: "cas链路异常",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320012",
- description: "token池已满",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120112",
- description: "添加应用下的用户为好友失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361023",
- description: "对讲服务端分配对讲会话资源失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320013",
- description: "P2P client超过限制",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120201",
- description: "操作报警信息失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "361024",
- description: "对讲服务端解析信令消息失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320014",
- description: "sdk未初始化",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120202",
- description: "操作留言信息失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390001",
- description: "通用错误返回",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320015",
- description: "超时",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120301",
- description: "根据UUID查询报警消息不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390002",
- description: "入参为空指针",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320016",
- description: "正在打洞中",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120302",
- description: "根据UUID查询图片不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390003",
- description: "入参值无效",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320017",
- description: "没有视频文件头(播放器层面产生和处理此错误)",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120303",
- description: "根据FID查询图片不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390004",
- description: "信令消息解析非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320018",
- description: "解码错误/超时(播放器层面产生和处理此错误)",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120305",
- description: "设备ip解析错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390005",
- description: "内存资源不足",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320019",
- description: "取消(保留,用户不用处理)",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120401",
- description: "用户云空间信息不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390006",
- description: "协议格式不对或者消息体长度超过STREAM_MAX_MSGBODY_LEN",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320020",
- description: "播放过程中预连接被用户清除预操作信息",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120402",
- description: "云空间操作失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390007",
- description: "设备序列号长度不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320021",
- description: "流加密码不对",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120403",
- description: "用户目录不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390008",
- description: "取流url长度不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "320022",
- description: "未传入播放窗口",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120404",
- description: "要操作的目标目录不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390009",
- description: "解析vtm返回vtdu地址不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "100200",
- description: "操作成功",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120405",
- description: "要删除的文件信息不存在",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390010",
- description: "解析vtm返回级联vtdu地址不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101001",
- description: "用户名不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120406",
- description: "已开通云存储",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390011",
- description: "解析vtm返回会话标识长度不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101002",
- description: "用户名已被占用",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120407",
- description: "开通记录失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390012",
- description: "vtdu返回流头长度不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101003",
- description: "密码不合法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120500",
- description: "获取数据错误",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390013",
- description: "vtdu会话长度非法",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101004",
- description: "密码为同一字符",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120501",
- description: "开锁失败",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390014",
- description: "回调函数未注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "101006",
- description: "手机号码已经被注册",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "120502",
- description: "室内机未收到呼叫",
- solution: "",
- updateTime: 1522034840000
- },
- {
- moduleCode: "",
- detailCode: "390015",
- description: "vtdu成功响应未携带会话标识",
- solution: "",
- updateTime: 1522034840000
- }
- ];
- var code = "200";
- var msg$1 = "操作成功!";
- var errorCode = {
- data: data$8,
- code: code,
- msg: msg$1
- };
- var Code = /*#__PURE__*/function () {
- function Code(x, y) {
- _classCallCheck$1(this, Code);
- this.coreX = x;
- this.coreY = y;
- console.log("ErrorCode", errorCode);
- }
- _createClass$1(Code, [{
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "matchErrorInfo",
- value: function matchErrorInfo(code) {
- return errorCode.data.find(function (item) {
- return item.detailCode.substr(-4) == code;
- });
- }
- }]);
- return Code;
- }();
- var header = {
- color: "red",
- backgroundColor: "red",
- activeColor: "red",
- btnList: [
- {
- btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-0",
- iconId: "deviceID",
- part: "left",
- defaultActive: 1,
- isrender: 1,
- themeId: "934f270c08b14e928bf0c2ae8e1a937d"
- },
- {
- btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-1",
- iconId: "deviceName",
- part: "left",
- defaultActive: 1,
- isrender: 1,
- themeId: "934f270c08b14e928bf0c2ae8e1a937d"
- }
- ]
- };
- var footer = {
- color: "blue",
- backgroundColor: "blue",
- activeColor: "blue",
- btnList: [
- {
- btnKey: "ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-footer-0",
- iconId: "play",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "934f270c08b14e928bf0c2ae8e1a937d"
- }
- ]
- };
- var defaultTheme = {
- header: header,
- footer: footer
- };
- // 通用请求方法
- var TimeLine$1 = function TimeLine(jsPlugin) {
- this.jsPlugin = jsPlugin;
- var status = {
- isMouseDown: false,
- // 鼠标是否按下
- isOver: false,
- // 鼠标是否悬浮在进度条上
- mousePosition: null,
- oldTime: null,
- nowTime: null,
- moved: null,
- hoverTime: '2018-12-07 12:00:00',
- hoverLeft: 0,
- timeTipShow: false,
- randomNum: 123,
- timeWidthTbls: [60, 1800, 3600, 86400],
- // 时间宽度单位(秒)
- timeUnits: ['范围: 1分钟; 单位: 秒', '范围: 30分钟; 单位: 分钟', '范围: 1小时; 单位: 分钟', '范围: 1天; 单位: 小时', '范围: 3天; 单位: 小时'],
- // 时间单位
- drawPen: null,
- timeSection: [],
- canvasWidth: null,
- canvasHeight: null,
- timeTips: null
- };
- // Object.keys(status).forEach(element => {
- // this[element] = status[element];
- // });
- var _this = this;
- Object.keys(status).forEach(function (element) {
- _this[element] = status[element];
- });
- this.options = {
- width: this.canvasWidth,
- height: 48,
- time: new Date().getTime(),
- //new Date("2019-10-31 00:00:00"),//
- timeSection: [],
- timeWidth: 0 // 0-3
- };
- TimeLine.prototype.subTime = function (time) {
- if (time < 10) {
- return '0' + time;
- } else {
- return time;
- }
- };
- TimeLine.prototype.tranTime = function (time) {
- var stringTime = time;
- if (time) {
- var newDate = new Date(time);
- stringTime = newDate.getFullYear() + '/' + (newDate.getMonth() + 1) + '/' + newDate.getDate() + ' ' + this.subTime(newDate.getHours()) + ':' + this.subTime(newDate.getMinutes()) + ':' + this.subTime(newDate.getSeconds());
- }
- return stringTime;
- };
- TimeLine.prototype.init = function (params) {
- // document.getElementsByTagName("html")[0].addEventListener("mouseup", this.mouseUpFn(e,params.));
- if (params.width) {
- document.getElementById(params.id).setAttribute("width", parseInt(params.width, 10) + 'px');
- }
- var that = this;
- var opts = this.options;
- that.randomNum = (Math.random() + '').split('.').join('');
- that.timeWidthTblIndex = opts.timeWidth; // 当前使用时间宽度索引
- // 12-10
- //that.drawPanal = this.$refs.drawPanal;
- var canvas = document.querySelector("#".concat(this.jsPlugin.id, "-canvas"));
- that.drawPen = canvas.getContext('2d');
- that.nowTime = opts.time || Date.now(); // 当前时间点
- that.timeSection = opts.timeSection || []; // 时间段记录区间
- that.canvasWidth = canvas.offsetWidth;
- that.canvasHeight = canvas.offsetHeight;
- that.updata(); // 展示进度条
- // 事件监听
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mousemove', function (e) {
- if (that.options.readOnly) {
- return;
- }
- that.mousemove(e);
- });
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseover', function (e) {
- if (that.options.readOnly) {
- return;
- }
- that.mouseover(e);
- });
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseleave', function (e) {
- if (that.options.readOnly) {
- return;
- }
- that.mouseleave(e);
- });
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mousedown', function (e) {
- if (that.options.readOnly) {
- return;
- }
- that.mousedown(e);
- });
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).addEventListener('mouseup', function (e) {
- if (that.options.readOnly) {
- return;
- }
- //debugger
- var callback = params.onChange;
- that.mouseUpFn(e, callback);
- });
- };
- TimeLine.prototype.setWidth = function (params) {
- var _this2 = this;
- var that = this;
- if (params.width) {
- document.getElementById(this.jsPlugin.id).style.width = params.width;
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.width = params.width;
- document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.width = params.width;
- that.canvasWidth = params.width;
- setTimeout(function () {
- _this2.updata({
- time: new Date()
- });
- }, 500);
- }
- };
- TimeLine.prototype.mousemove = function (e) {
- // console.log("鼠标移动",e)
- if (this.isMouseDown && this.isOver) {
- var mouseOffset = this.mousePosition - e.pageX;
- // fix点击引起mousemove的问题
- if (mouseOffset === 0) {
- return;
- }
- var timeOffsetUnit = 0;
- switch (this.timeWidth) {
- case 60:
- timeOffsetUnit = 1 / 10;
- break;
- case 1800:
- timeOffsetUnit = 1 / 20 * 60;
- break;
- case 3600:
- timeOffsetUnit = 1 / 20 * 60;
- break;
- case 86400:
- //timeOffset =
- timeOffsetUnit = 1 / 30 * 60 * 60;
- break;
- }
- var currentTime = new Date(this.oldTime).getTime() + mouseOffset * timeOffsetUnit * 1000;
- //console.log("rurrentTime",this.oldTime,mouseOffset,currentTime,new Date(currentTime))
- //console.log("currentTime", new Date(currentTime))
- // var currentTime =
- // this.oldTime +
- // (mouseOffset / this.canvasWidth) *
- // this.timeWidth *
- // 1000;
- // console.log("currentTime",new Date(this.oldTime), new Date(currentTime))
- this.updata({
- time: currentTime
- });
- this.moved = true;
- } else {
- // 12-10
- //var { left, top } = this.$utils.getOffset(this.$refs.drawPanal);
- var left = parseInt(document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).offsetLeft, 10);
- //12 -10
- this.mousePosition = e.pageX - left;
- this.updata(); // 更新画面
- }
- };
- TimeLine.prototype.mousedown = function (e) {
- this.isMouseDown = true;
- this.mousePosition = e.pageX;
- this.oldTime = this.nowTime;
- // this.$emit('drag', true);
- };
- TimeLine.prototype.mouseover = function (e) {
- this.isOver = true;
- };
- TimeLine.prototype.mouseleave = function (e) {
- this.isOver = false;
- this.isMouseDown = false;
- this.updata();
- };
- TimeLine.prototype.changeSize = function (timeWidth) {
- console.log("changeSize", timeWidth);
- // if (w) {
- // this.options.width = w;
- // this.canvasWidth = w;
- // }
- // if (h) {
- // this.options.height = h;
- // this.canvasHeight = h;
- // }
- // console.log("tehis.optiosn",this.options)
- this.options.timeWidth = timeWidth;
- this.updata({
- timeWidth: timeWidth
- });
- // this.$nextTick(() => {
- // this.updata();
- // });
- };
- TimeLine.prototype.mouseUpFn = function (e, callback) {
- if (this.isMouseDown) {
- this.isMouseDown = false;
- if (this.moved) {
- this.moved = false;
- // 限制拖动只更改时分秒
- var newStringTime =
- // new Date(this.nowTime).getFullYear() +
- // '/' +
- // ( new Date(this.nowTime).getMonth() + 1) +
- // '/' +
- // new Date(this.nowTime).getDate() +
- // ' ' +
- this.subTime(new Date(this.nowTime).getHours()) + ':' + this.subTime(new Date(this.nowTime).getMinutes()) + ':' + this.subTime(new Date(this.nowTime).getSeconds());
- var oldStringTime = new Date(this.oldTime).getFullYear() + '/' + (new Date(this.oldTime).getMonth() + 1) + '/' + new Date(this.oldTime).getDate();
- // ' ' +
- // this.subTime(new Date(this.oldTime).getHours()) +
- // ':' +
- // this.subTime( new Date(this.oldTime).getMinutes()) +
- // ':' +
- // this.subTime( new Date(this.oldTime).getSeconds());
- // this.nowTime = new Date(`${oldStringTime.substring(0,11) + newStringTime.substring(11,19)}`).getTime();
- this.nowTime = new Date("".concat(oldStringTime, " ").concat(newStringTime));
- this.updata({
- time: this.nowTime
- });
- this.oldTime = this.nowTime;
- console.log("nowTime", new Date(this.nowTime), "".concat(oldStringTime, " ").concat(newStringTime));
- // 限制只能拖动当天;
- callback(this.nowTime);
- }
- }
- };
- TimeLine.prototype.readOnly = function (data) {
- console.log("更改为只读");
- this.options.readOnly = true;
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.cursor = "not-allowed";
- };
- TimeLine.prototype.unReadOnly = function (data) {
- console.log("更改为只读");
- this.options.readOnly = false;
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.cursor = "pointer";
- };
- TimeLine.prototype.run = function (data) {
- if (!this.isMouseDown) {
- this.updata(data);
- }
- };
- TimeLine.prototype.getTime = function (data) {
- console.log("this", this);
- console.log("当前时间", new Date(this.nowTime));
- };
- TimeLine.prototype.updata = function (data) {
- var that = this;
- data = data || {};
- that.nowTime = data.time || that.nowTime;
- that.timeSection = data.timeSection || that.timeSection;
- that.timeWidthTblIndex = data.timeWidth || that.timeWidthTblIndex;
- that.timeWidth = that.timeWidthTbls[data.timeWidth || that.timeWidthTblIndex];
- that.timeUnit = that.timeUnits[data.timeWidth || that.timeWidthTblIndex];
- if (data.timeWidth === 0) {
- that.timeWidthTblIndex = 0;
- that.timeWidth = that.timeWidthTbls[0];
- that.timeUnit = that.timeUnits[0];
- }
- that.drawPen.fillStyle = '#000000';
- that.drawPen.fillRect(0, 0, that.canvasWidth, that.canvasHeight);
- that.drawScale(); // 画刻度
- that.drawRecord(); // 画录像区间
- that.drawOtherMsg(); // 画录像的其他信息
- // 12-10
- //that.$emit('update-time', that.nowTime);
- document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.width = that.options.width + 'px';
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.width = that.options.width + 'px';
- document.getElementById("".concat(this.jsPlugin.id, "-canvas-container")).style.height = that.options.height + 'px';
- document.getElementById("".concat(this.jsPlugin.id, "-canvas")).style.height = that.options.height + 'px';
- };
- TimeLine.prototype.drawSolidLine = function (startX, startY, endX, endY, lineWidth, color) {
- this.drawPen.save();
- this.drawPen.strokeStyle = color;
- this.drawPen.lineWidth = lineWidth;
- this.drawPen.beginPath();
- this.drawPen.moveTo(startX, startY);
- this.drawPen.lineTo(endX, endY);
- this.drawPen.stroke();
- this.drawPen.restore();
- };
- TimeLine.prototype.drawString = function (text, x, y, aling, color) {
- this.drawPen.font = '12px serif';
- this.drawPen.fillStyle = '#ffffff';
- this.drawPen.textAlign = aling || 'left';
- this.drawPen.fillText(text, x, y + 10);
- };
- TimeLine.prototype.drawScale = function () {
- // console.log("drawScale",new Date(this.nowTime))
- var that = this;
- var lineColor = 'rgba(255,255,255)';
- //that.nowTime = new Date("2019-12-31 01:50:00")
- var startDate = new Date(that.nowTime); // 开始时间
- var startYears = startDate.getFullYear(); // 起始的秒数
- var starSecond = startDate.getSeconds(); // 起始的秒数
- var starMin = startDate.getMinutes(); // 起始的分钟数
- var startHours = startDate.getHours(); // 起始的小时
- var startDay = startDate.getDate(); // 起始的日期
- // debugger;
- var curScale = 0; // 计算时间点
- switch (that.timeWidth) {
- case 60:
- {
- // debugger
- var dotNum = parseInt(that.canvasWidth / 10); // 每10像素一个点
- startDate.setSeconds(startDate.getSeconds() - parseInt(dotNum / 2, 10)); // 从现在时间的一半开始画起
- startDay = startDate.getDate();
- startHours = startDate.getHours();
- starMin = startDate.getMinutes();
- starSecond = startDate.getSeconds();
- // console.log("domNum",dotNum);
- // console.log("starSecond",starSecond)
- for (var i = 0; i < dotNum; i++) {
- curScale = starSecond + i;
- startDate.setSeconds(curScale);
- // debugger;
- //debugger;
- // console.log("startDate",startDate,curScale)
- // 每一个整10秒画一次线和文字
- if (curScale % 10 === 0) {
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 + 8, 1, lineColor);
- var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes()) + ':' + this.subTime(startDate.getSeconds());
- that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
- // console.log("timeString",timeString)
- } else {
- // console.log("画短线",(i * that.canvasWidth) / 60,0,(i * that.canvasWidth) / 60,(that.canvasHeight / 5) * 0.5,1)
- // 只画一次线
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
- }
- /**
- * 偏移距离超过60,setSeconds会每次累加1到分钟,因此绘图完成后需要复原到当前分钟,再次计算偏移
- */
- startDate.setDate(startDay);
- startDate.setHours(startHours);
- startDate.setMinutes(starMin);
- }
- break;
- }
- case 1800:
- {
- // 30分钟
- var dotNum = parseInt(that.canvasWidth / 20); // 每10像素一个点
- startDate.setMinutes(startDate.getMinutes() - parseInt(dotNum / 2, 10));
- // starSecond = startDate.getSeconds();
- startHours = startDate.getHours();
- starMin = startDate.getMinutes();
- //console.log("dotNum",dotNum,starMin)
- for (var i = 0; i <= dotNum; i++) {
- curScale = starMin + i;
- startDate.setMinutes(curScale);
- if (curScale % 5 === 0) {
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 1.5 + 8, 1, lineColor);
- var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes());
- that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
- } else {
- // console.log("画短线",((i - starMin) * that.canvasWidth) / dotNum)
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
- }
- startDate.setHours(startHours);
- }
- break;
- }
- case 3600:
- {
- // 60分钟
- var dotNum = parseInt(that.canvasWidth / 20); // 每10像素一个点
- startDate.setMinutes(startDate.getMinutes() - parseInt(dotNum / 2, 10));
- startHours = startDate.getHours();
- starMin = startDate.getMinutes();
- for (var i = 0; i <= dotNum; i++) {
- curScale = starMin + i;
- // if (curScale > 60) {
- // curScale = curScale - 60;
- // }
- startDate.setMinutes(curScale);
- if (curScale % 10 === 0) {
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 1.5 + 8, 1, lineColor);
- var timeString = this.subTime(startDate.getHours()) + ':' + this.subTime(startDate.getMinutes());
- that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2.5, 'center', 'rgba(255,255,255,0.3)');
- } else {
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
- }
- startDate.setHours(startHours);
- }
- break;
- }
- case 86400:
- {
- var dotNum = parseInt(that.canvasWidth / 30); // 每10像素一个点
- // 1天,24小时
- //console.log("dotNum",dotNum);
- //startDate.setDate(startDay - parseInt(dotNum / 2,10));
- startDate.setHours(startDate.getHours() - parseInt(dotNum / 2, 10));
- // console.log("startDat111e",startDate);
- // debugger;
- starSecond = startDate.getSeconds();
- starMin = startDate.getMinutes();
- startHours = startDate.getHours();
- startDay = startDate.getDate();
- startYears = startDate.getFullYear();
- for (var i = 0; i <= dotNum; i++) {
- curScale = startHours + i;
- // if (curScale >= 24) {
- // curScale = curScale - 24;
- // }
- startDate.setHours(curScale);
- var timeString;
- // 不等于24的时候,画短线
- //console.log("curScale",curScale)
- //if (curScale % 24 !=0) {
- // console.log("curScale",curScale)
- timeString = this.subTime(startDate.getHours()) + ":00";
- // timeString = startDate.toLocaleDateString();
- // debugger
- that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
- // } else {
- // // debugger;
- // // console.log("画图")
- // // 不等于24的时候,画长线
- // timeString = startDate.toLocaleDateString();
- // // console.log("startDatestartDate",startDate,i)
- // // debugger;
- // that.drawSolidLine(
- // ((i ) * that.canvasWidth) /
- // dotNum,
- // 8,
- // ((i) * that.canvasWidth) /
- // dotNum,
- // (that.canvasHeight / 5) * 1 + 8,
- // 1,
- // lineColor
- // );
- // }
- // 每2个小时一个时间文字
- if (curScale % 2 === 0) {
- that.drawString(timeString, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 2, 'center', 'rgba(255,255,255,0.3)');
- }
- startDate.setFullYear(startYears);
- startDate.setDate(startDay);
- startDate.setHours(startHours);
- }
- break;
- }
- }
- };
- TimeLine.prototype.getRecord = function (timeArr, startTime, endTime) {
- this.timeSection = timeArr;
- this.drawRecord();
- };
- TimeLine.prototype.drawRecord = function () {
- var timeArr = this.timeSection || [];
- var that = this;
- var drawPen = that.drawPen;
- // var startDate = new Date(that.nowTime);
- // var timeScale = that.canvasWidth / that.timeWidth;
- // 根据时间查找当前位置
- for (var i = 0; i < timeArr.length; i++) {
- //console.log("timeArr[i]",timeArr[i],findPosition(timeArr[i].startTime),findPosition(timeArr[i].endTime))
- var startPosition = findPosition(timeArr[i].startTime);
- var endPosition = findPosition(timeArr[i].endTime);
- drawPen.fillStyle = '#1890ff80';
- drawPen.fillRect(startPosition, 0, endPosition - startPosition, 48);
- }
- function findPosition(time) {
- var scale = 10;
- switch (that.timeWidth) {
- case 60:
- scale = 10;
- break;
- case 1800:
- scale = 20 / 60;
- break;
- case 3600:
- scale = 20 / 60;
- break;
- case 86400:
- scale = 20 / 60 / 60;
- break;
- }
- var nowTimePostion = that.canvasWidth / 2; //总宽度一半
- var position = nowTimePostion + (time - that.nowTime) / 1000 * scale;
- if (position > that.canvasWidth) {
- position = that.canvasWidth;
- }
- if (position <= 0) {
- position = 0;
- }
- return position;
- }
- };
- TimeLine.prototype.drawOtherMsg = function () {
- // 画中心线
- this.drawSolidLine(this.canvasWidth / 2, 0, this.canvasWidth / 2, this.canvasHeight, 2, '#1890FF');
- this.drawPen.shadowBlur = 0;
- if (this.isOver && !this.isMouseDown) {
- this.mouseTime = this.mousePosition / this.canvasWidth * this.timeWidth * 1000 + this.nowTime - this.timeWidth / 2 * 1000; // 鼠标的悬浮点对应的时间
- this.mouseString = this.tranTime(this.mouseTime); // 鼠标悬浮点显示的文字
- this.hoverTime = this.mouseString;
- this.hoverLeft = this.mousePosition - 60;
- this.timeTipShow = true;
- } else {
- this.timeTipShow = false;
- }
- };
- };
- var Rec = /*#__PURE__*/function () {
- function Rec(jSPlugin) {
- _classCallCheck$1(this, Rec);
- this.jSPlugin = jSPlugin;
- if (!document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
- return false;
- }
- this.currentTimeWidth = 0; //回放时间轴尺度 0~3
- this.date = new Date();
- this.datepickerVisible = false;
- this.seekTimer = null;
- this.disabled = false;
- this.seekFrequency = 2000;
- if (this.jSPlugin.params && this.jSPlugin.params.seekFrequency) {
- this.seekFrequency = this.jSPlugin.params.seekFrequency;
- }
- this.recInit();
- }
- _createClass$1(Rec, [{
- key: "recInit",
- value: function recInit() {
- var _this = this;
- // 重置时间轴尺度
- this.currentTimeWidth = 0;
- var canvasItemWidth = parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width, 10) - 100;
- var canvasContainer = document.createElement('div');
- canvasContainer.style = "display:inline-block;height:48px;";
- canvasContainer.id = this.jSPlugin.id + "-canvas-container";
- var canvasItem = document.createElement('canvas');
- canvasItem.id = this.jSPlugin.id + "-canvas";
- canvasItem.className = "time-line-body";
- canvasItem.height = "48";
- canvasItem.width = canvasItemWidth;
- canvasItem.style = "display:inline-block;";
- canvasItem.innerHTML = "该浏览器不支持canvas";
- canvasContainer.appendChild(canvasItem);
- insertAfter$1(canvasContainer, document.getElementById("".concat(this.jSPlugin.id, "-audioControls")));
- var timeLineControlsContainer = document.createElement('div');
- timeLineControlsContainer.className = "timeline-controls";
- timeLineControlsContainer.style = "display:flex;width:100px;height:48px;text-align:center;line-height: 48px;vertical-align: top;background: #000000;";
- 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");
- timeLineControlsContainer.innerHTML = timeLineControls;
- insertAfter$1(timeLineControlsContainer, canvasContainer);
- this.timeLine = new TimeLine$1(this.jSPlugin);
- this.timeLine.init({
- id: this.jSPlugin.id + '-canvas',
- width: canvasItemWidth,
- onChange: function onChange(time) {
- console.log("time", time, new Date(time).Format('yyyyMMddhhmmss'));
- var newBegin = new Date(time).Format('yyyyMMddhhmmss');
- console.log('----------------this.jSPlugin.url', _this.jSPlugin.url);
- //云录制、支持seek功能的设备开启seek回放功能
- if (matchEzopenUrl(_this.jSPlugin.url).type === 'cloud.rec' || _this.jSPlugin.capacity && _this.jSPlugin.capacity.support_seek_playback == '1') {
- var cloudSeek = function cloudSeek() {
- _this.jSPlugin.seek(newBegin.substr(8, 6), "235959");
- _this.unSyncTimeLine();
- setTimeout(function () {
- _this.syncTimeLine();
- }, 6000);
- };
- if (_this.seekTimer) {
- clearTimeout(_this.seekTimer);
- } else {
- cloudSeek();
- }
- // 限制每2秒只触发一次拖动
- _this.seekTimer = setTimeout(function () {
- cloudSeek();
- clearTimeout(_this.seekTimer);
- _this.seekTimer = null;
- }, _this.seekFrequency);
- } else {
- var callback = function callback() {
- setTimeout(function () {
- _this.disabled = false;
- }, _this.seekFrequency);
- };
- var localRecSeek = function localRecSeek(callback) {
- _this.disabled = true;
- _this.jSPlugin.pause().then(function () {
- console.log("暂停成功");
- _this.jSPlugin.resume(newBegin).then(function (data) {
- console.log("恢复成功:", data);
- if (_this.jSPlugin.Theme) {
- _this.jSPlugin.Theme.setDecoderState({
- play: true
- });
- }
- // 打开声音
- if (_this.jSPlugin.Theme && _this.jSPlugin.Theme.decoderState.state.sound) {
- _this.jSPlugin.openSound();
- }
- if (callback) {
- callback();
- }
- })["catch"](function (err) {
- console.log("恢复失败", err);
- });
- })["catch"](function () {
- console.log("暂停失败");
- _this.jSPlugin.resume(newBegin).then(function (data) {
- console.log("恢复成功");
- if (_this.jSPlugin.Theme) {
- _this.jSPlugin.Theme.setDecoderState({
- play: true
- });
- }
- if (callback) {
- callback();
- }
- })["catch"](function (err) {
- console.log("恢复失败", err);
- });
- });
- };
- if (_this.disabled) {
- console.log("操作频繁,等待2秒后执行");
- // 限制每2秒只触发一次拖动
- if (_this.seekTimer) {
- clearTimeout(_this.seekTimer);
- }
- _this.seekTimer = setTimeout(function () {
- localRecSeek(callback);
- }, _this.seekFrequency);
- } else {
- localRecSeek(callback);
- }
- }
- }
- });
- this.syncTimeLine();
- // 加载日期选择器
- addCss("".concat(this.jSPlugin.staticPath, "/rec/datepicker.min.css"));
- addJs("".concat(this.jSPlugin.staticPath, "/rec/jquery.min.js"), function () {
- addJs("".concat(_this.jSPlugin.staticPath, "/rec/datepicker.js"), function () {
- addJs("".concat(_this.jSPlugin.staticPath, "/rec/datepicker.zh-CN.js"), function () {
- // 日期选择:
- if (!document.getElementsByClassName("datepicker-container")[0] && $("#".concat(_this.jSPlugin.id, "-datepicker")).datepicker) {
- $("#".concat(_this.jSPlugin.id, "-datepicker")).datepicker({
- autoShow: false,
- autoHide: true,
- autoPick: true,
- language: 'zh-CN',
- date: new Date(getQueryString('begin', _this.jSPlugin.params.url).replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3')) || new Date(),
- format: 'yyyy-mm-dd',
- endDate: new Date(),
- inline: true,
- container: document.getElementById("".concat(_this.jSPlugin.id, "-wrap"))
- });
- }
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "none";
- }
- _this.datepickerVisible = false;
- $("#".concat(_this.jSPlugin.id, "-datepicker")).on('pick.datepicker', function (e) {
- console.log("重新选择日期", e.date, new Date(e.date).Format('yyyyMMdd'), new Date(document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value).Format('yyyyMMdd'));
- if (e.date > new Date() || new Date(e.date).Format('yyyyMMdd') === new Date(document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value).Format('yyyyMMdd')) {
- e.preventDefault(); // Prevent to pick the date
- } else {
- document.getElementById("".concat(_this.jSPlugin.id, "-datepicker")).value = new Date(e.date).Format('yyyy-MM-dd');
- _this.renderRec(e.date);
- if (_this.jSPlugin.decoderState && _this.jSPlugin.decoderState.state) {
- if (_this.jSPlugin.decoderState.state.cloudRec) {
- _this.jSPlugin.changePlayUrl({
- begin: new Date(e.date).Format('yyyyMMdd'),
- type: 'cloud.rec'
- });
- } else if (_this.jSPlugin.decoderState.state.rec) {
- _this.jSPlugin.changePlayUrl({
- begin: new Date(e.date).Format('yyyyMMdd'),
- type: 'rec'
- });
- } else {
- _this.jSPlugin.changePlayUrl({
- begin: new Date(e.date).Format('yyyyMMdd')
- });
- }
- } else {
- _this.jSPlugin.changePlayUrl({
- begin: new Date(e.date).Format('yyyyMMdd')
- });
- }
- }
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "none";
- }
- _this.datepickerVisible = false;
- //xuehb 重置放大倍数
- if (_this.jSPlugin.decoderState && _this.jSPlugin.decoderState && _this.jSPlugin.decoderState.state && _this.jSPlugin.decoderState.state.zoom) {
- _this.jSPlugin.setDecoderState({
- zoom: false
- });
- _this.jSPlugin.Zoom.stopZoom();
- }
- });
- $("#".concat(_this.jSPlugin.id, "-datepicker")).off('click').on("click", function (e) {
- console.log("点击日期");
- if (!_this.datepickerVisible) {
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "inline";
- }
- } else {
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "none";
- }
- }
- _this.datepickerVisible = !_this.datepickerVisible;
- });
- });
- });
- });
- // 尺度变化监听
- document.getElementById("".concat(this.jSPlugin.id, "-timeline-scale-add")).onclick = function () {
- var currentTimeWidth = _this.currentTimeWidth;
- if (currentTimeWidth < 3) {
- _this.timeLine.changeSize(++_this.currentTimeWidth);
- }
- };
- document.getElementById("".concat(this.jSPlugin.id, "-timeline-scale-sub")).onclick = function () {
- var currentTimeWidth = _this.currentTimeWidth;
- if (currentTimeWidth > 0) {
- _this.timeLine.changeSize(--_this.currentTimeWidth);
- }
- };
- // 渲染回放
- var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
- this.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
- this.observer = new MutationObserver(function (mutations, observer) {
- _this.recAutoSize();
- });
- var config = {
- attributes: true,
- attributeOldValue: true,
- attributeFilter: ['style']
- };
- var el = document.getElementById("".concat(this.jSPlugin.id));
- this.observer.observe(el, config);
- }
- }, {
- key: "setDatepickerDate",
- value: function setDatepickerDate(date) {
- if (document.getElementsByClassName("datepicker-container")[0]) {
- var dom = document.getElementsByClassName("datepicker-container")[0];
- var parentNode = dom.parentNode;
- parentNode.removeChild(dom);
- document.getElementById("".concat(this.jSPlugin.id, "-datepicker")).value = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
- $("#".concat(this.jSPlugin.id, "-datepicker")).datepicker({
- autoShow: false,
- autoHide: true,
- autoPick: true,
- language: 'zh-CN',
- defaultDate: date,
- format: 'yyyy-mm-dd',
- endDate: new Date(),
- inline: true,
- container: document.getElementById("".concat(this.jSPlugin.id, "-wrap"))
- });
- }
- }
- }, {
- key: "datepickerHide",
- value: function datepickerHide() {
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "none";
- }
- this.datepickerVisible = false;
- }
- }, {
- key: "datepickerShow",
- value: function datepickerShow() {
- if (document.getElementsByClassName("datepicker-container")[0]) {
- document.getElementsByClassName("datepicker-container")[0].style.display = "inline";
- }
- this.datepickerVisible = true;
- }
- }, {
- key: "recAutoSize",
- value: function recAutoSize() {
- var _this2 = this;
- if (document.getElementById("".concat(this.jSPlugin.id, "-canvas"))) {
- var canvasItemWidth = parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width, 10) - 100;
- if (canvasItemWidth !== parseInt(document.getElementById("".concat(this.jSPlugin.id, "-canvas")).width)) {
- document.getElementById("".concat(this.jSPlugin.id, "-canvas")).width = canvasItemWidth;
- this.timeLine.init({
- id: "".concat(this.jSPlugin.id, "-canvas"),
- width: canvasItemWidth,
- onChange: function onChange(time) {
- console.log("time", time, new Date(time).Format('yyyyMMddhhmmss'));
- console.log("jSPlugin", _this2.jSPlugin);
- var newBegin = new Date(time).Format('yyyyMMddhhmmss');
- _this2.jSPlugin.changePlayUrl({
- begin: newBegin
- });
- }
- });
- // this.timeLine.setWidth({
- // id: `${this.jSPlugin.id}-canvas`,
- // width: canvasItemWidth,
- // })
- this.renderRec(this.date);
- this.syncTimeLine();
- }
- }
- }
- }, {
- key: "syncTimeLine",
- value: function syncTimeLine() {
- var _this3 = this;
- if (this.jSPlugin.recTimer) {
- clearInterval(this.jSPlugin.recTimer);
- }
- // let end = setInterval(function () { }, 10000);
- // for (let i = 1; i <= end && i != this.jSPlugin.recTimer; i++) {
- // clearInterval(i);
- // }
- this.jSPlugin.recTimer = setInterval(function () {
- var getOSDTimePromise = _this3.jSPlugin.getOSDTime();
- getOSDTimePromise.then(function (data) {
- var v = data.data;
- if (v === -1) {
- console.log("获取播放时间错误");
- } else {
- if (v > 0) {
- // console.log("获取播放时间", v, this.timeLine.run);
- _this3.timeLine.run({
- time: new Date(v > 1000000000000 ? v : v * 1000)
- });
- //$(".current-time").text(new Date(new Date(v > 1000000000000 ? v : v * 1000)).Format('yyyy-MM-dd hh:mm:ss'))
- }
- }
- })["catch"](function (err) {});
- }, 1000);
- }
- }, {
- key: "unSyncTimeLine",
- value: function unSyncTimeLine() {
- if (this.jSPlugin.recTimer) {
- clearInterval(this.jSPlugin.recTimer);
- }
- }
- }, {
- key: "renderRec",
- value: function renderRec(date) {
- var _this4 = this;
- this.date = date;
- var that = this;
- var dateStart = new Date(new Date(date).Format('yyyy-MM-dd 00:00:00').replace(/-/g, "/")).getTime();
- var dateEnd = new Date(new Date(date).Format('yyyy-MM-dd 23:59:59').replace(/-/g, "/")).getTime();
- this.timeLine.getRecord([], dateStart, dateEnd);
- console.log('-----------233---------this.jSPlugin.url', this.jSPlugin.url);
- var recSliceParams = {
- accessToken: this.jSPlugin.accessToken,
- recType: matchEzopenUrl(this.jSPlugin.url).type === 'cloud.rec' ? 1 : 2,
- deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial,
- channelNo: matchEzopenUrl(this.jSPlugin.url).channelNo,
- startTime: dateStart,
- endTime: dateEnd,
- version: '2.0'
- };
- var recAPISuccess = function recAPISuccess(data) {
- if (data.data && data.data.files && data.data.files.length > 0) {
- var dataArr = data.data.files;
- var nextFileTime = new Date().getTime();
- var isAll = data.data.isAll;
- if (isAll) {
- _this4.timeLine.getRecord(dataArr, dateStart, dateEnd);
- } else {
- // 云存储回调事务
- var recTransaction = function recTransaction() {
- function recAPIV2Success(data) {
- if (data.data && data.data.files && data.data.files.length > 0) {
- if (data.data.isAll == false) {
- if (data.data.files) {
- dataArr = dataArr.concat(data.data.files);
- }
- nextFileTime = data.data.nextFileTime > 0 ? data.data.nextFileTime : new Date().getTime();
- recTransaction();
- } else {
- console.log("云存储执行渲染片段");
- that.timeLine.getRecord(dataArr, dateStart, dateEnd);
- }
- } else {
- that.timeLine.getRecord(dataArr, dateStart, dateEnd);
- }
- }
- recSliceParams.startTime = nextFileTime;
- request(this.jSPlugin.env.domain + "/api/lapp/video/by/time", 'POST', recSliceParams, '', recAPIV2Success);
- };
- recTransaction();
- }
- _this4.timeLine.run({
- time: new Date(dateStart)
- });
- } else if (data.data && data.data.length > 0) {
- console.log("获取本地录像片段成功", data);
- that.timeLine.getRecord(data.data, dateStart, dateEnd);
- that.timeLine.run({
- time: new Date(dateStart)
- });
- } else ;
- };
- var recAPIUrl = this.jSPlugin.env.domain + "/api/lapp/video/by/time";
- request(recAPIUrl, 'POST', recSliceParams, '', recAPISuccess);
- }
- }]);
- return Rec;
- }();
- var TimeLine = function TimeLine(params) {
- console.log("执行TimeLine - params", params);
- this.state = {
- id: params.id,
- start: '00:00:00',
- // 传入最近片段起始时刻
- end: '24:00:00',
- // 传入最近片段结束时刻 默认结束时间为24:00:00, 1440 24
- current: 0,
- // 当前播放时刻
- // rate: 1, // 1:2小时, 2:1小时, 3:半小时, 4:10分钟, 5:1分钟
- timelag: 30,
- // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
- timeArr: [],
- // 时间轴列表
- availTimeLine: [],
- // 由实际存在视频片段的时间组成,[{st: '', et: ''}, {st: '', et: ''}, ...]
- scrollTop: 0,
- // 页面滚动偏移量 页面偏移量由传入时刻决定
- // currentTimer: '', // 时刻定时器
- // timelineTimer: '', //时间轴定时器,
- index: 0,
- // 初始时刻在availtimeLine中的index
- // playCode: 0, // 当前播放状态值
- date: '',
- noTimeLineTxt: '',
- disabled: false // 禁用拖动轴
- };
- var _this = this;
- this.setState = function (obj) {
- Object.keys(obj).forEach(function (key) {
- _this.state[key] = obj[key];
- if (key === 'scrollTop') {
- document.getElementById('time-line-item').parentNode.scrollTo(0, obj[key]);
- }
- if (key === 'current') {
- document.getElementById('time-line-current').innerHTML = obj[key];
- }
- });
- };
- this.setDisabled = function (value) {
- this.setState({
- disabled: value
- });
- document.getElementById('time-line-item').parentNode.style.overflowY = value ? 'hidden' : 'scroll';
- // console.log(" document.getElementById('time-line-item').parentNode.style", document.getElementById('time-line-item').parentNode)
- };
- this.timeToSecond = function (time) {
- var e = time.split(':');
- var h = Number(e[0]);
- var m = Number(e[1]);
- var s = Number(e[2]);
- return h * 60 * 60 + m * 60 + (s ? s : 0);
- };
- this.minuteToTime = function (minute) {
- var hour = Math.floor(minute / 60);
- var m = minute % 60;
- return (hour > 9 ? hour : '0' + hour) + ':' + (m > 9 ? m : '0' + m);
- };
- this.timeToMinute = function (time) {
- var e = time.split(':');
- var h = Number(e[0]);
- var m = Number(e[1]);
- // const s = Number(e[2]);
- return h * 60 + m;
- };
- this.getPalyParam = params.getPalyParam;
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
- document.getElementById('time-line-item').parentNode.ontouchstart = function () {
- if (_this.state.disabled) {
- return false;
- }
- params.ontouchstart();
- };
- // 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
- document.getElementById('time-line-item').parentNode.ontouchmove = function () {
- if (_this.state.disabled) {
- return false;
- }
- params.ontouchmove();
- };
- // 手动滚动停止,选定时刻自动播放
- document.getElementById('time-line-item').parentNode.ontouchend = function () {
- // var _this = this;
- if (_this.state.disabled) {
- return false;
- }
- //
- var timer;
- var scollPromise = new Promise(function (resolve, reject) {
- var preTop = -1;
- timer = setInterval(function () {
- // debugger
- var reactTop = document.getElementById('time-line-item').parentNode.scrollTop; // 实际偏移高度
- if (reactTop !== preTop) {
- console.log("scolling", reactTop, preTop);
- preTop = reactTop;
- } else {
- console.log("scoll stop", reactTop, preTop);
- clearInterval(timer);
- resolve(reactTop);
- }
- }, 100);
- });
- //
- scollPromise.then(function (reactTop) {
- console.log("scollPromise: then", reactTop, _this);
- _this.rectTopTotime(reactTop);
- console.log('页面滚动实际高度', reactTop, _this.state);
- _this.getPalyParam({
- current: _this.state.current
- });
- });
- params.ontouchend();
- };
- this.matchTimeDot();
- };
- TimeLine.prototype.changeScale = function (value) {
- this.setState({
- timelag: value // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
- });
- this.matchTimeDot();
- };
- TimeLine.prototype.setDateLine = function (news, defaultIndex) {
- // if( news.length > 0 ){
- // if(!defaultIndex){
- // defaultIndex = 0;
- // }
- // this.setState({
- // availTimeLine: news,
- // start: news[defaultIndex].st,
- // end: news[defaultIndex].et,
- // current: news[defaultIndex].st,
- // })
- // console.log("this.state", this.state);
- // this.matchTimeDot();
- // this.primaryOffsetH();
- // // 将当前播放时间片段传给父组件
- // this.getPalyParam(news[defaultIndex]);
- // }
- if (news.length > 0) {
- if (typeof defaultIndex === 'undefined') {
- defaultIndex = news.length - 1;
- }
- this.setState({
- availTimeLine: news,
- start: news[defaultIndex].st,
- end: news[defaultIndex].et,
- current: news[defaultIndex].st
- });
- console.log("this.state", this.state);
- this.matchRecTimeDot();
- this.primaryOffsetH();
- // 将当前播放时间片段传给父组件
- //this.getPalyParam({ current: news[defaultIndex].st });
- } else {
- this.setState({
- availTimeLine: []
- });
- console.log("this.state", this.state);
- this.matchRecTimeDot();
- }
- };
- TimeLine.prototype.matchTimeDot = function () {
- var _this$state = this.state,
- start = _this$state.start,
- end = _this$state.end,
- timelag = _this$state.timelag;
- _this$state.availTimeLine;
- console.log("start", start, 'end', end);
- var timeArr = [];
- // // 播放时间片段时刻转分钟
- // let availArr = [];
- // let len = availTimeLine.length;
- // for (let i = 0; i < len; i++) {
- // const temp = availTimeLine[i];
- // let st = this.timeToSecond(temp.st);
- // let et = this.timeToSecond(temp.et);
- // // console.log('st: ', st, 'et:', et);
- // let stminute;
- // let etminute;
- // let stAvailPercent = 0;
- // let etAvailPercent = 0;
- // stminute = Math.floor(st / (timelag * 60)) * timelag;
- // stAvailPercent = (st - (stminute * 60)) / timelag;
- // etminute = Math.floor(et / (timelag * 60)) * timelag;
- // etAvailPercent = (et - (etminute * 60)) / timelag;
- // availArr[i] = {
- // st: stminute,
- // et: etminute,
- // stAvailPercent: stAvailPercent,
- // etAvailPercent: etAvailPercent
- // }
- // }
- // console.log('availArr: ', availArr);
- // 时间转分钟
- var minute = this.timeToMinute(end);
- // // 检测是否包含秒,则实际分钟加1
- // const e = end.split(':');
- // const s = Number(e[2]);
- // if (s > 0) {
- // minute = minute + 1
- // }
- minute = Math.floor(minute / timelag) * timelag;
- for (var i = minute; i >= 0;) {
- var marginTop = 0;
- var marginBottom = 0;
- // 视频片段
- var recArr = [];
- if (i == minute) {
- marginTop = 70;
- }
- if (i == 0) {
- marginBottom = 230;
- }
- // for (let j = 0; j < len; j++) {
- // if (i >= availArr[j].st && i <= availArr[j].et) {
- // // borderColor = '#f7a670';
- // // console.log("i",i,availArr[j])
- // if (i == availArr[j].st && i == availArr[j].et) {
- // var height = availArr[j].etAvailPercent - availArr[j].stAvailPercent;
- // var top = 60 - availArr[j].etAvailPercent;
- // recArr.push({
- // height: height,
- // top: top
- // })
- // } else {
- // if (i == availArr[j].st) {
- // recArr.push({
- // height: 60 - availArr[j].stAvailPercent,
- // top: 0
- // })
- // } else if (i == availArr[j].et) {
- // recArr.push({
- // height: availArr[j].etAvailPercent,
- // top: 60 - availArr[j].etAvailPercent,
- // })
- // } else if (i > availArr[j].st && i < availArr[j].et) {
- // // 跨越多个区域
- // recArr.push({
- // height: 60,
- // top: 0,
- // })
- // }
- // }
- // }
- // }
- var time = this.minuteToTime(i);
- timeArr.push({
- id: i,
- current: time,
- label: "a" + i,
- marginTop: marginTop,
- marginBottom: marginBottom,
- recArr: recArr
- });
- i = i - timelag;
- }
- this.setState({
- timeArr: timeArr
- });
- this.renderDateLine();
- };
- TimeLine.prototype.matchRecTimeDot = function () {
- var _this$state2 = this.state,
- start = _this$state2.start,
- end = _this$state2.end,
- timelag = _this$state2.timelag,
- availTimeLine = _this$state2.availTimeLine,
- timeArr = _this$state2.timeArr;
- console.log("start", start, 'end', end);
- // 播放时间片段时刻转分钟
- var availArr = [];
- var len = availTimeLine.length;
- if (len === 0) {
- for (var j = 0; j < timeArr.length; j++) {
- timeArr[j].recArr = [];
- }
- } else {
- //xuehb 切换回放时要把上一次的回放时间段重置清空掉
- for (var k = 0; k < timeArr.length; k++) {
- timeArr[k].recArr = [];
- }
- for (var i = 0; i < len; i++) {
- var temp = availTimeLine[i];
- var st = this.timeToSecond(temp.st);
- var et = this.timeToSecond(temp.et);
- // console.log('st: ', st, 'et:', et);
- var stminute = void 0;
- var etminute = void 0;
- var stAvailPercent = 0;
- var etAvailPercent = 0;
- stminute = Math.floor(st / (timelag * 60)) * timelag;
- stAvailPercent = (st - stminute * 60) / timelag;
- etminute = Math.floor(et / (timelag * 60)) * timelag;
- etAvailPercent = (et - etminute * 60) / timelag;
- availArr[i] = {
- st: stminute,
- et: etminute,
- stAvailPercent: stAvailPercent,
- etAvailPercent: etAvailPercent
- };
- for (var j = 0; j < timeArr.length; j++) {
- if (timeArr[j].id == stminute && timeArr[j].id == etminute) {
- var height = etAvailPercent - stAvailPercent;
- var top = 60 - etAvailPercent;
- timeArr[j].recArr.push({
- height: height,
- top: top
- });
- } else {
- if (timeArr[j].id == stminute) {
- timeArr[j].recArr.push({
- height: 60 - stAvailPercent,
- top: 0
- });
- } else if (timeArr[j].id == etminute) {
- timeArr[j].recArr.push({
- height: etAvailPercent,
- top: 60 - etAvailPercent
- });
- } else if (timeArr[j].id > stminute && timeArr[j].id < etminute) {
- timeArr[j].recArr.push({
- height: 60,
- top: 0
- });
- }
- }
- }
- }
- }
- console.log('availArr: ', availArr);
- this.setState({
- timeArr: timeArr
- });
- console.log('timeArr:', this.state);
- this.renderDateLine();
- };
- TimeLine.prototype.renderDateLine = function () {
- var _this$state3 = this.state,
- id = _this$state3.id,
- timeArr = _this$state3.timeArr;
- console.log("id,timeArr", id, timeArr);
- var container = document.getElementById("time-line-item");
- container.innerHTML = "";
- timeArr.forEach(function (item, index) {
- var timeItemDOM = document.createElement('div');
- timeItemDOM.setAttribute("class", "time-item");
- timeItemDOM.style = "margin-top: ".concat(item.marginTop, "px; margin-bottom: ").concat(item.marginBottom, "px; border-right-color: ").concat(item.borderColor, ";");
- var scaleDOM = document.createElement('div');
- scaleDOM.setAttribute("class", "scale");
- 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>';
- item.recArr.forEach(function (i, j) {
- timeItemHtml += "<div class=\"item-unavail\" style=\"height: ".concat(i.height, "px;background-color:#A8B9ED; top: ").concat(i.top, "px\"></div>");
- });
- //timeItemHtml += `<div class="item-unavail" style="height: ${item.availPercent}px; top: ${item.availTop}px"></div>`
- timeItemHtml += "<div id=".concat(item.label, " style=\"position: relative; top: 51px; left: 40%\"> ").concat(item.current, "</div>");
- timeItemDOM.innerHTML = timeItemHtml;
- container.appendChild(timeItemDOM);
- });
- };
- // 计算初始偏移量
- TimeLine.prototype.primaryOffsetH = function () {
- var _this$state4 = this.state,
- start = _this$state4.start,
- timelag = _this$state4.timelag,
- timeArr = _this$state4.timeArr;
- var currentItem = timeArr[0].current;
- var currentTime = this.timeToSecond(currentItem);
- var startSecond = this.timeToSecond(start);
- var offsetS = currentTime - startSecond;
- var offsetH = Math.ceil(offsetS / timelag) + 60; // offsetS / (timelag * 60) * 60
- this.setState({
- scrollTop: offsetH
- });
- console.log('起始偏移量', offsetH);
- };
- // 计算当前偏移量
- TimeLine.prototype.currentOffsetH = function () {
- var _this$state5 = this.state,
- current = _this$state5.current,
- timelag = _this$state5.timelag,
- timeArr = _this$state5.timeArr;
- var startItem = timeArr[0].current;
- var startSecond = this.timeToSecond(startItem);
- var currentSecond = this.timeToSecond(current);
- var offsetS = startSecond - currentSecond;
- var offsetH = Math.ceil(offsetS / timelag) + 60; // offsetS / (timelag * 60) * 60
- this.setState({
- scrollTop: offsetH
- });
- };
- // 通过时间轴位置获取当前时间
- TimeLine.prototype.rectTopTotime = function (reactTop) {
- var timelag = this.state.timelag;
- // let rectTop = rect.top; // 获取当前元素距离父元素顶部的高度
- // let reactTop = 0 - rectTop; // 实际偏移高度
- var index = Math.floor(reactTop / 60); // 以分钟为刻度时,每个元素初始高度为60px, 向下取整并除以时刻倍数得出偏移item;
- var offsetH = reactTop - index * 60; // 偏移高度
- var current;
- var offsetSecond;
- console.log('index:', index, 'offsetH:', offsetH);
- if (offsetH == 0) {
- current = this.state.timeArr[index - 1].current;
- offsetSecond = 0;
- } else {
- // 当timelag==120,timelag==60,timelag==30,timelag==10,timelag==1
- var time = this.state.timeArr[index].current;
- var minute = this.timeToMinute(time);
- // 相对于下一元素偏移
- var offsetY = 60 - offsetH;
- var offsetS = offsetY * timelag; // offsetY / 60 * timelag * 60
- var offsetM = Math.floor(offsetS / 60) + minute;
- var second = Math.floor(offsetS / 60) * 60;
- offsetSecond = Math.ceil(offsetS - second); // 保留两位小数
- current = this.minuteToTime(offsetM);
- }
- this.setState({
- current: current + ':' + (offsetSecond > 9 ? offsetSecond : '0' + offsetSecond),
- scrollTop: reactTop
- });
- // console.log("rectLeft", reactTop);
- // console.log("currentTime", current + ':' + (offsetSecond > 9 ? offsetSecond : '0' + offsetSecond));
- };
- // 时间轴滚动,根据传参变化
- TimeLine.prototype.stepScrollTimeLine = function (time) {
- this.setState({
- current: time
- });
- this.currentOffsetH();
- };
- TimeLine.prototype.secondCountDown = function (time) {
- var current = this.state.current;
- // console.log('currentTime', current);
- var temp = current.split(':');
- var hour = Number(temp[0]);
- var minute = Number(temp[1]);
- var second = Number(temp[2]);
- var t = hour * 60 * 60 + minute * 60 + second + 1;
- var h = Math.floor(t / 3600);
- var m = Math.floor((t - h * 3600) / 60);
- var s = t - h * 3600 - m * 60;
- this.setState({
- current: (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s)
- });
- };
- var MobileTimeLine = TimeLine;
- Date.prototype.Format = function (fmt) {
- //author: meizz
- var o = {
- "M+": this.getMonth() + 1,
- //月份
- "d+": this.getDate(),
- //日
- "h+": this.getHours(),
- //小时
- "m+": this.getMinutes(),
- //分
- "s+": this.getSeconds(),
- //秒
- "q+": Math.floor((this.getMonth() + 3) / 3),
- //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
- }
- return fmt;
- };
- function format(now) {
- var time = new Date(now);
- var h = time.getHours(); //返回日期中的小时数(0到23)
- var m = time.getMinutes(); //返回日期中的分钟数(0到59)
- var s = time.getSeconds(); //返回日期中的秒数(0到59)
- return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
- }
- var MobileRec = /*#__PURE__*/function () {
- function MobileRec(jSPlugin, changeRecSpeed, resetMobileZoomStatus) {
- var _this = this;
- _classCallCheck$1(this, MobileRec);
- //xuehb 修改播放速度方法
- this.changeRecSpeed = changeRecSpeed;
- //xuehb 重置放大状态
- this.resetMobileZoomStatus = resetMobileZoomStatus;
- this.isMobile = true;
- this.jSPlugin = jSPlugin;
- this.timer = null;
- this.date = new Date().Format('yyyy-MM-dd');
- this.begin = (new Date().Format('yyyy-MM-dd') + ' 00:00:00').replace(/-/g, "/");
- this.end = (new Date().Format('yyyy-MM-dd') + ' 23:59:59').replace(/-/g, "/");
- this.initBegin = null;
- this.initEnd = null;
- this.type = matchEzopenUrl(this.jSPlugin.url).type;
- this.operating = false;
- this.seekTimer = null;
- this.disabled = false;
- this.seekFrequency = 2000;
- if (this.jSPlugin.params && this.jSPlugin.params.seekFrequency) {
- this.seekFrequency = this.jSPlugin.params.seekFrequency;
- }
- var oS = document.createElement('style');
- 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 }";
- document.getElementsByTagName("head")[0].appendChild(oS);
- if (getQueryString("begin", this.jSPlugin.url)) {
- var begin = getQueryString("begin", this.jSPlugin.url);
- this.date = begin.slice(0, 4) + '/' + begin.slice(4, 6) + '/' + begin.slice(6, 8);
- this.begin = this.date + " ".concat(begin.slice(8, 10) || "00", ":").concat(begin.slice(10, 12) || "00", ":").concat(begin.slice(12, 14) || "00");
- this.end = this.date + ' 23:59:59';
- this.initBegin = this.begin;
- }
- if (getQueryString("end", this.jSPlugin.url)) {
- var end = getQueryString("end", this.jSPlugin.url);
- this.end = this.date + " ".concat(end.slice(8, 10) || "23", ":").concat(end.slice(10, 12) || "59", ":").concat(end.slice(12, 14) || "59");
- this.initEnd = this.end;
- }
- // 回放时间标题
- var mobileRecTitleWrap = document.createElement('div');
- mobileRecTitleWrap.id = "date-switch-container-wrap";
- mobileRecTitleWrap.className = "date-switch-container-wrap";
- mobileRecTitleWrap.style = "";
- 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 ";
- insertAfter$1(mobileRecTitleWrap, document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
- // 回放时间类型选择
- var mobileRecSwitchWrap = document.createElement('div');
- mobileRecSwitchWrap.id = "rec-type-container-wrap";
- mobileRecSwitchWrap.className = "rec-type-container-wrap";
- mobileRecSwitchWrap.style = "";
- 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 ";
- insertAfter$1(mobileRecSwitchWrap, mobileRecTitleWrap);
- // 回放时间轴
- var mobileRecWrap = document.createElement('div');
- mobileRecWrap.id = "mobile-rec-wrap";
- mobileRecWrap.className = "mobileRec-wrap";
- mobileRecWrap.style = "";
- 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 ";
- insertAfter$1(mobileRecWrap, mobileRecSwitchWrap);
- var getPalyParam = function getPalyParam(data) {
- console.log("子组件传值到父组件", data, data.current);
- var st = data.current;
- var date = new Date(_this.date).Format('yyyyMMdd').substr(0, 8) + (data.current ? st.replace(/:/g, "") : data.current.replace(/:/g, ""));
- if (_this.initBegin && new Date("".concat(_this.date, " ").concat(data.current)).getTime() < new Date(_this.initBegin).getTime()) {
- console.log("超过限制最低值");
- date = new Date(_this.initBegin).Format("yyyyMMddhhmmss");
- }
- if (_this.initEnd && new Date("".concat(_this.date, " ").concat(data.current)).getTime() > new Date(_this.initEnd).getTime()) {
- console.log("超过限制最高值");
- date = new Date(_this.initBegin).Format("yyyyMMddhhmmss");
- }
- if (_this.type === 'cloud.rec') {
- var cloudSeek = function cloudSeek() {
- _this.jSPlugin.seek(date.substr(8, 6), "235959");
- setTimeout(function () {
- _this.syncTimeLine();
- }, 6000);
- };
- if (_this.seekTimer) {
- clearTimeout(_this.seekTimer);
- } else {
- cloudSeek();
- }
- console.log("this.jsPlug", _this.jSPlugin.params);
- // 限制每2秒只触发一次拖动
- _this.seekTimer = setTimeout(function () {
- cloudSeek();
- clearTimeout(_this.seekTimer);
- _this.seekTimer = null;
- }, _this.seekFrequency);
- } else {
- var callback = function callback() {
- setTimeout(function () {
- _this.disabled = false;
- }, _this.seekFrequency);
- };
- var localRecSeek = function localRecSeek(callback) {
- _this.disabled = true;
- _this.jSPlugin.pause().then(function () {
- console.log("暂停成功");
- _this.jSPlugin.resume(date).then(function (data) {
- console.log("恢复成功");
- if (_this.jSPlugin.Theme) {
- _this.jSPlugin.Theme.setDecoderState({
- play: true
- });
- }
- // 打开声音
- if (_this.jSPlugin.Theme && _this.jSPlugin.Theme.decoderState.state.sound) {
- _this.jSPlugin.openSound();
- }
- _this.syncTimeLine();
- if (callback) {
- callback();
- }
- });
- })["catch"](function () {
- console.log("暂停失败");
- _this.jSPlugin.resume(date).then(function (data) {
- console.log("恢复成功");
- if (_this.jSPlugin.Theme) {
- _this.jSPlugin.Theme.setDecoderState({
- play: true
- });
- }
- _this.syncTimeLine();
- if (callback) {
- callback();
- }
- });
- });
- };
- if (_this.disabled) {
- console.log("操作频繁,等待2秒后执行");
- if (_this.seekTimer) {
- clearTimeout(_this.seekTimer);
- }
- _this.seekTimer = setTimeout(function () {
- localRecSeek(callback);
- }, _this.seekFrequency);
- } else {
- // 限制每2秒只触发一次拖动
- localRecSeek(callback);
- }
- }
- };
- var ontouchstart = function ontouchstart() {
- _this.operating = true;
- _this.unSyncTimeLine();
- // if (currentTimer) {
- // clearInterval(currentTimer)
- // }
- // if (decoder) {
- // var stopPromise = decoder.stop();
- // stopPromise.then(() => {
- // console.log("停止成功")
- // });
- // }
- };
- var ontouchmove = function ontouchmove() {
- // if (currentTimer) {
- // clearInterval(currentTimer)
- // }
- };
- var ontouchend = function ontouchend() {
- _this.operating = false;
- console.log("ontouchend");
- // if (currentTimer) {
- // clearInterval(currentTimer)
- // }
- };
- this.TimeLineOBJ = new MobileTimeLine({
- id: "time-line-item",
- getPalyParam: getPalyParam,
- ontouchstart: ontouchstart,
- ontouchmove: ontouchmove,
- ontouchend: ontouchend
- });
- this.fetchDeviceRec();
- // 监听日期变化
- document.getElementById("date").addEventListener('change', function (e) {
- console.log("日期变化", e.target.value);
- // if(this.initBegin && new Date(`${e.target.value}`.replace(/-/g, "/")).getTime() < new Date(this.initBegin.slice(0, 10)).getTime()) {
- // console.log("超过限制最低值")
- // return false;
- // }
- // if(this.initEnd && new Date(`${e.target.value}`.replace(/-/g, "/")).getTime() > new Date(this.initEnd.slice(0, 10)).getTime()) {
- // console.log("超过限制最高值")
- // return false;
- // }
- if (_this.initBegin || _this.initEnd) {
- console.log("您开启了时间限制,无法切换日期");
- return false;
- }
- _this.date = new Date(e.target.value).Format("yyyy/MM/dd");
- _this.begin = _this.date + ' 00:00:00';
- _this.end = _this.date + ' 23:59:59';
- _this.fetchDeviceRec();
- _this.jSPlugin.changePlayUrl({
- type: _this.type,
- begin: "".concat(new Date(_this.date).Format('yyyyMMdd'), "000000")
- });
- //xuehb 将播放倍速重置为1
- _this.changeRecSpeed(1);
- //xuehb 重置放大状态
- _this.resetMobileZoomStatus();
- });
- document.getElementById("cloudType").checked = this.type === 'rec';
- document.getElementById("cloudType").addEventListener('change', function (e) {
- var recType = e.target.checked ? 2 : 1;
- _this.type = e.target.checked ? "rec" : 'cloud.rec';
- console.log("recType", recType);
- _this.fetchDeviceRec();
- _this.jSPlugin.changePlayUrl({
- type: _this.type,
- begin: "".concat(new Date(_this.date).Format('yyyyMMdd'), "000000")
- }).then(function () {
- console.log("切换类型成功");
- _this.syncTimeLine();
- //xuehb 将播放倍速重置为1
- _this.changeRecSpeed(1);
- //xuehb 重置放大状态
- _this.resetMobileZoomStatus();
- }, function (err) {
- console.log("err", err);
- })["catch"](function (err) {
- console.log(err);
- });
- // document.getElementById("cloudType").setAttribute("checked", true);
- // $("#cloudType").attr("checked", recType == '2');
- // $("#cloudType .device svg").attr("checked", recType == '2');
- });
- this.syncTimeLine();
- }
- _createClass$1(MobileRec, [{
- key: "fetchDeviceRec",
- value: function fetchDeviceRec() {
- var _this2 = this;
- var doRender = function doRender(result) {
- var len = result.length;
- document.getElementById("recCount").innerHTML = len;
- var availArr = [];
- for (var i = len - 1; i >= 0; i--) {
- var res = result[i];
- var et = format(res.endTime);
- var st = format(res.startTime);
- availArr.push({
- st: st,
- et: et
- });
- }
- // document.getElementById("time-line-item").style.display = "block";
- {
- _this2.TimeLineOBJ.setDateLine(availArr);
- }
- };
- var data = new FormData();
- data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
- data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
- data.append("accessToken", this.jSPlugin.accessToken);
- data.append("recType", this.type === 'cloud.rec' ? 1 : 2);
- data.append("startTime", new Date(this.begin).getTime());
- data.append("endTime", new Date(this.end).getTime());
- fetch(this.jSPlugin.env.domain + '/api/lapp/video/by/time', {
- method: "POST",
- body: data
- }).then(function (response) {
- return response.json();
- }).then(function (res) {
- // 本地回放
- if (res.code == 200 && res.data) {
- var result = [];
- result = res.data;
- doRender(result);
- } else {
- doRender([]);
- }
- });
- }
- }, {
- key: "syncTimeLine",
- value: function syncTimeLine() {
- var _this3 = this;
- var dateFormat = function dateFormat(now) {
- var time = new Date(now);
- var h = time.getHours(); //返回日期中的小时数(0到23)
- var m = time.getMinutes(); //返回日期中的分钟数(0到59)
- var s = time.getSeconds(); //返回日期中的秒数(0到59)
- return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
- };
- if (this.timer) {
- clearInterval(this.timer);
- }
- this.timer = setInterval(function () {
- // 定时器
- if (_this3.operating) {
- console.log("操作中");
- return false;
- }
- _this3.jSPlugin.getOSDTime().then(function (res) {
- if (res.data > 0) {
- _this3.TimeLineOBJ.stepScrollTimeLine(dateFormat(res.data * 1000));
- } else {
- console.log("未找到当前获取播放时间,等待中...");
- console.log('res:-----------------', res);
- }
- })["catch"](function (err) {
- console.log('err:-----', err);
- console.log("未找到当前获取播放时间,等待中...");
- });
- }, 1000);
- }
- }, {
- key: "unSyncTimeLine",
- value: function unSyncTimeLine() {
- if (this.timer) {
- clearInterval(this.timer);
- }
- }
- }]);
- return MobileRec;
- }();
- var ptzStart = [
- {
- code: 200,
- msg: "",
- desc: "请求成功",
- text: "操作成功",
- type: "ptzStart"
- },
- {
- code: 10001,
- msg: "操作失败",
- desc: "参数为空或格式不正确",
- text: "参数错误",
- type: "ptzStart"
- },
- {
- code: 10002,
- msg: "账号异常,操作失败",
- desc: "重新获取accessToken",
- text: "accessToken异常或过期",
- type: "ptzStart"
- },
- {
- code: 10005,
- msg: "账号异常,操作失败",
- desc: "appKey被冻结",
- text: "appKey异常",
- type: "ptzStart"
- },
- {
- code: 20002,
- msg: "设备不存在,请检查设备连接情况",
- desc: "",
- text: "设备不存在",
- type: "ptzStart"
- },
- {
- code: 20006,
- msg: "操作失败,请检查设备网络情况",
- desc: "检查设备网络状况,稍后再试",
- text: "网络异常",
- type: "ptzStart"
- },
- {
- code: 20007,
- msg: "操作失败,请检查设备在线情况",
- desc: "检查设备是否在线",
- text: "设备不在线",
- type: "ptzStart"
- },
- {
- code: 20008,
- msg: "操作过于频繁,稍后再试",
- desc: "操作过于频繁,稍后再试",
- text: "设备响应超时",
- type: "ptzStart"
- },
- {
- code: 20014,
- msg: "操作失败",
- desc: "",
- text: "deviceSerial不合法",
- type: "ptzStart"
- },
- {
- code: 20032,
- msg: "通道不存在请检查设备连接情况",
- desc: "该用户下通道不存在",
- text: "该用户下通道不存在",
- type: "ptzStart"
- },
- {
- code: 49999,
- msg: "操作失败,请重试",
- desc: "接口调用异常",
- text: "数据异常",
- type: "ptzStart"
- },
- {
- code: 60000,
- msg: "操作失败,设备不支持该操作",
- desc: "",
- text: "设备不支持云台控制",
- type: "ptzStart"
- },
- {
- code: 60001,
- msg: "操作失败,用户无权限",
- desc: "",
- text: "用户无云台控制权限",
- type: "ptzStart"
- },
- {
- code: 60002,
- msg: "设备已旋转到上限位",
- desc: "",
- text: "设备云台旋转达到上限位",
- type: "ptzStart"
- },
- {
- code: 60003,
- msg: "设备已旋转到下限位",
- desc: "",
- text: "设备云台旋转达到下限位",
- type: "ptzStart"
- },
- {
- code: 60004,
- msg: "设备已旋转到左限位",
- desc: "",
- text: "设备云台旋转达到左限位",
- type: "ptzStart"
- },
- {
- code: 60005,
- msg: "设备已旋转到右限位",
- desc: "",
- text: "设备云台旋转达到右限位",
- type: "ptzStart"
- },
- {
- code: 60006,
- msg: "操作失败,请重试",
- desc: "稍候再试",
- text: "云台当前操作失败",
- type: "ptzStart"
- },
- {
- code: 60009,
- msg: "设备正在操作中",
- desc: "",
- text: "正在调用预置点",
- type: "ptzStart"
- },
- {
- code: 60020,
- msg: "操作失败",
- desc: "确认设备是否支持该操作",
- text: "不支持该命令",
- type: "ptzStart"
- }
- ];
- var ptzStop = [
- {
- code: 200,
- msg: "",
- desc: "请求成功",
- text: "操作成功",
- type: "ptzStop"
- },
- {
- code: 10001,
- msg: "操作失败",
- desc: "参数为空或格式不正确",
- text: "参数错误",
- type: "ptzStop"
- },
- {
- code: 10002,
- msg: "账号异常,操作失败",
- desc: "重新获取accessToken",
- text: "accessToken异常或过期",
- type: "ptzStop"
- },
- {
- code: 10005,
- msg: "账号异常,操作失败",
- desc: "appKey被冻结",
- text: "appKey异常",
- type: "ptzStop"
- },
- {
- code: 20002,
- msg: "设备不存在,请检查设备连接情况",
- desc: "",
- text: "设备不存在",
- type: "ptzStop"
- },
- {
- code: 20006,
- msg: "操作失败,请检查设备网络情况",
- desc: "检查设备网络状况,稍后再试",
- text: "网络异常",
- type: "ptzStop"
- },
- {
- code: 20007,
- msg: "操作失败,请检查设备在线情况",
- desc: "检查设备是否在线",
- text: "设备不在线",
- type: "ptzStop"
- },
- {
- code: 20008,
- msg: "操作过于频繁,稍后再试",
- desc: "操作过于频繁,稍后再试",
- text: "设备响应超时",
- type: "ptzStop"
- },
- {
- code: 20014,
- msg: "操作失败",
- desc: "",
- text: "deviceSerial不合法",
- type: "ptzStop"
- },
- {
- code: 20032,
- msg: "通道不存在请检查设备连接情况",
- desc: "该用户下通道不存在",
- text: "该用户下通道不存在",
- type: "ptzStop"
- },
- {
- code: 49999,
- msg: "操作失败,请重试",
- desc: "接口调用异常",
- text: "数据异常",
- type: "ptzStop"
- },
- {
- code: 60000,
- msg: "操作失败,设备不支持该操作",
- desc: "",
- text: "设备不支持云台控制",
- type: "ptzStop"
- },
- {
- code: 60001,
- msg: "操作失败,用户无权限",
- desc: "",
- text: "用户无云台控制权限",
- type: "ptzStop"
- },
- {
- code: 60006,
- msg: "操作失败,请重试",
- desc: "稍候再试",
- text: "云台当前操作失败",
- type: "ptzStop"
- },
- {
- code: 60009,
- msg: "设备正在操作中",
- desc: "",
- text: "正在调用预置点",
- type: "ptzStop"
- },
- {
- code: 60020,
- msg: "操作失败",
- desc: "确认设备是否支持该操作",
- text: "不支持该命令",
- type: "ptzStop"
- }
- ];
- var talk = [
- {
- code: 200,
- msg: "",
- desc: "请求成功",
- text: "操作成功",
- type: "talk"
- },
- {
- code: 10001,
- msg: "播放失败",
- desc: "参数为空或格式不正确",
- text: "参数错误",
- type: "talk"
- },
- {
- code: 10002,
- msg: "账号异常,操作失败",
- desc: "",
- text: "accessToken异常或过期",
- type: "talk"
- },
- {
- code: 10031,
- msg: "账号异常,操作失败",
- desc: "",
- text: "子账户或萤石用户没有权限",
- type: "talk"
- },
- {
- code: 20002,
- msg: "设备不存在请检查设备连接情况",
- desc: "设备序列号输入有误或者设备未被添加或者通道异常",
- text: "设备不存在",
- type: "talk"
- },
- {
- code: 60059,
- msg: "播放失败",
- desc: "",
- text: "ezopen地址均不可用",
- type: "talk"
- }
- ];
- var time = [
- {
- code: 200,
- msg: "",
- desc: "",
- text: "操作成功",
- type: "time"
- },
- {
- code: 10001,
- msg: "播放失败",
- desc: "参数为空或格式不正确",
- text: "参数错误",
- type: "time"
- },
- {
- code: 10002,
- msg: "账号异常,播放失败",
- desc: "",
- text: "accessToken异常或过期",
- type: "time"
- },
- {
- code: 10004,
- msg: "账号异常,播放失败",
- desc: "",
- text: "用户不存在",
- type: "time"
- },
- {
- code: 10005,
- msg: "账号异常,播放失败",
- desc: "",
- text: "appKey异常",
- type: "time"
- },
- {
- code: 10011,
- msg: "播放失败",
- desc: "设备对应用户未注册至应用下",
- text: "未开通萤石服务",
- type: "time"
- },
- {
- code: 10013,
- msg: "账号异常,播放失败",
- desc: "",
- text: "非开发者账号无权限调用",
- type: "time"
- },
- {
- code: 10030,
- msg: "播放失败",
- desc: "",
- text: "appkey和appsecret不匹配",
- type: "time"
- },
- {
- code: 20002,
- msg: "设备不存在请检查设备连接情况",
- desc: "设备序列号输入有误或者设备未被添加或者通道异常",
- text: "设备不存在",
- type: "time"
- },
- {
- code: 20014,
- msg: "播放失败",
- desc: "",
- text: "deviceSerial不合法",
- type: "time"
- },
- {
- code: 20032,
- msg: "设备不存在请检查设备连接情况",
- desc: "",
- text: "该用户下通道不存在",
- type: "time"
- },
- {
- code: 60024,
- msg: "播放失败请重试",
- desc: "",
- text: "取消订阅操作失败",
- type: "time"
- },
- {
- code: 49999,
- msg: "播放失败请重试",
- desc: "",
- text: "操作异常",
- type: "time"
- }
- ];
- var uikitCode = {
- ptzStart: ptzStart,
- ptzStop: ptzStop,
- talk: talk,
- time: time
- };
- var UikitCode = /*#__PURE__*/function () {
- function UikitCode(x, y) {
- _classCallCheck$1(this, UikitCode);
- this.coreX = x;
- this.coreY = y;
- console.log("uikitCode", uikitCode);
- }
- _createClass$1(UikitCode, [{
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "matchInfo",
- value: function matchInfo(code, type) {
- if (uikitCode[type]) {
- var obj = {};
- uikitCode[type].map(function (item) {
- if (item.code == code) {
- obj = item;
- }
- });
- return obj;
- } else {
- return {
- code: 500,
- msg: "未知错误",
- desc: "未知的错误码,或错误码类型有误",
- text: "",
- type: type
- };
- }
- }
- }]);
- return UikitCode;
- }();
- var Ptz = /*#__PURE__*/function () {
- function Ptz(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, Ptz);
- this.jSPlugin = jSPlugin;
- this.codeHandler = new UikitCode();
- this.pluginStatus = new Status(this, this.jSPlugin.id);
- console.log("云台初始化");
- if (document.getElementById(this.jSPlugin.id + "-ez-ptz-item")) {
- return false;
- }
- var ptzWrap = document.createElement('div');
- ptzWrap.id = this.jSPlugin.id + "-ez-ptz-item";
- ptzWrap.className = "ez-ptz-wrap";
- ptzWrap.style = "display:none";
- var oS = document.createElement('style');
- 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 }";
- document.getElementsByTagName("head")[0].appendChild(oS);
- 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 ");
- document.getElementById("".concat(jSPlugin.id, "-wrap")).appendChild(ptzWrap);
- // 云台控制事件绑定
- // 云台控制
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).onmousedown = function (e) {
- e.preventDefault();
- console.log("触摸开始");
- _this._handlePtzTouch(e, 'start');
- };
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).onmouseup = function (e) {
- e.preventDefault();
- console.log("触摸结束");
- _this._handlePtzTouch(e, 'stop');
- };
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).ontouchstart = function (e) {
- e.preventDefault();
- console.log("触摸开始");
- _this._handlePtzTouch(e, 'start');
- };
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).ontouchend = function (e) {
- e.preventDefault();
- console.log("触摸结束", e);
- _this._handlePtzTouch(e, 'stop');
- };
- }
- _createClass$1(Ptz, [{
- key: "show",
- value: function show() {
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-item")).style = "display: inline-block";
- }
- }, {
- key: "hide",
- value: function hide() {
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-item")).style = "display: none";
- }
- }, {
- key: "_handlePtzTouch",
- value: function _handlePtzTouch(e, type) {
- var _this2 = this;
- var container = document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).getBoundingClientRect();
- var containerCenterX = container.left + 41;
- var containerCenterY = container.top + 41;
- var eventX = e.x || e.changedTouches[0].clientX;
- var eventY = e.y || e.changedTouches[0].clientY;
- var left = eventX - containerCenterX;
- var top = eventY - containerCenterY;
- var direction = 0; //操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
- var url = this.jSPlugin.env.domain + "/api/lapp/device/ptz/start";
- // var nextPtzImg = ptzNormalImg;
- // var nextPtzImgFailed = ptzNormalImg;
- // 判读方位
- if (Math.abs(left) > Math.abs(top)) {
- if (left > 0) {
- direction = 3;
- // nextPtzImg = ptzRightImgSuccess;
- // nextPtzImgFailed = ptzRightImgFailed;
- } else {
- direction = 2;
- // nextPtzImg = ptzLeftImgSuccess;
- // nextPtzImgFailed = ptzLeftImgFailed;
- }
- } else {
- if (top > 0) {
- direction = 1;
- // nextPtzImg = ptzDownImgSuccess;
- // nextPtzImgFailed = ptzDownImgFailed;
- } else {
- direction = 0;
- // nextPtzImg = ptzTopImgSuccess;
- // nextPtzImgFailed = ptzTopImgFailed;
- }
- }
- // 兼容画面旋转90度
- if (/^rotate\(90/.test(document.getElementById("".concat(this.jSPlugin.id, "-wrap")).style.transform)) {
- switch (direction) {
- case 0:
- direction = 2; // 上转化为左
- break;
- case 1:
- direction = 3; // 下转化为右
- break;
- case 2:
- direction = 1; // 左转化为下
- break;
- case 3:
- direction = 0; // 右转化为上
- break;
- }
- }
- 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%)");
- if (type === 'stop') {
- url = this.jSPlugin.env.domain + '/api/lapp/device/ptz/stop';
- document.getElementById("".concat(this.jSPlugin.id, "-ez-ptz-container")).style = "";
- }
- var data = new FormData();
- data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
- data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
- data.append("speed", 1);
- data.append("direction", direction);
- data.append("accessToken", this.jSPlugin.accessToken);
- fetch(url, {
- method: "POST",
- body: data
- }).then(function (response) {
- return response.json();
- }).then(function (rt) {
- if (rt.code == 200) ; else {
- //document.getElementById('ptz-img-container').childNodes[0].src = nextPtzImgFailed;
- // layer.msg(data.msg);
- console.log(rt.code, _this2.codeHandler.matchInfo(rt.code, type === 'start' ? 'ptzStart' : 'ptzStop'));
- _this2.pluginStatus.loadingSetText({
- text: _this2.codeHandler.matchInfo(rt.code, type === 'start' ? 'ptzStart' : 'ptzStop').msg,
- color: 'red',
- delayClear: 2000
- });
- if (rt.code == 60005 || rt.code == 60002 || rt.code == 60003 || rt.code == 60004) {
- 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%)");
- }
- }
- })["catch"](function (err) {
- console.log("云台调用异常", err);
- });
- }
- }]);
- return Ptz;
- }();
- (function (f) {
- if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
- module.exports = f();
- } else if (typeof define === "function" && define.amd) {
- define([], f);
- } else {
- var g;
- if (typeof window !== "undefined") {
- g = window;
- } else if (typeof global !== "undefined") {
- g = global;
- } else if (typeof self !== "undefined") {
- g = self;
- } else {
- g = this;
- }
- g.adapter = f();
- }
- })(function () {
- return function () {
- function r(e, n, t) {
- function o(i, f) {
- if (!n[i]) {
- if (!e[i]) {
- var c = "function" == typeof require && require;
- if (!f && c) return c(i, !0);
- if (u) return u(i, !0);
- var a = new Error("Cannot find module '" + i + "'");
- throw a.code = "MODULE_NOT_FOUND", a;
- }
- var p = n[i] = {
- exports: {}
- };
- e[i][0].call(p.exports, function (r) {
- var n = e[i][1][r];
- return o(n || r);
- }, p, p.exports, r, e, n, t);
- }
- return n[i].exports;
- }
- for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
- o(t[i]);
- }
- return o;
- }
- return r;
- }()({
- 1: [function (require, module, exports) {
- var _adapter_factory = require('./adapter_factory.js');
- var adapter = (0, _adapter_factory.adapterFactory)({
- window: window
- });
- window.adapter = adapter;
- module.exports = adapter; // this is the difference from adapter_core.
- }, {
- "./adapter_factory.js": 2
- }],
- 2: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.adapterFactory = adapterFactory;
- var _utils = require('./utils');
- var utils = _interopRequireWildcard(_utils);
- var _chrome_shim = require('./chrome/chrome_shim');
- var chromeShim = _interopRequireWildcard(_chrome_shim);
- var _edge_shim = require('./edge/edge_shim');
- var edgeShim = _interopRequireWildcard(_edge_shim);
- var _firefox_shim = require('./firefox/firefox_shim');
- var firefoxShim = _interopRequireWildcard(_firefox_shim);
- var _safari_shim = require('./safari/safari_shim');
- var safariShim = _interopRequireWildcard(_safari_shim);
- var _common_shim = require('./common_shim');
- var commonShim = _interopRequireWildcard(_common_shim);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- // Shimming starts here.
- /*
- * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree.
- */
- function adapterFactory() {
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- window = _ref.window;
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
- shimChrome: true,
- shimFirefox: true,
- shimEdge: true,
- shimSafari: true
- };
- // Utils.
- var logging = utils.log;
- var browserDetails = utils.detectBrowser(window);
- var adapter = {
- browserDetails: browserDetails,
- commonShim: commonShim,
- extractVersion: utils.extractVersion,
- disableLog: utils.disableLog,
- disableWarnings: utils.disableWarnings
- };
- // Shim browser if found.
- switch (browserDetails.browser) {
- case 'chrome':
- if (!chromeShim || !chromeShim.shimPeerConnection || !options.shimChrome) {
- logging('Chrome shim is not included in this adapter release.');
- return adapter;
- }
- logging('adapter.js shimming chrome.');
- // Export to the adapter global object visible in the browser.
- adapter.browserShim = chromeShim;
- chromeShim.shimGetUserMedia(window);
- chromeShim.shimMediaStream(window);
- chromeShim.shimPeerConnection(window);
- chromeShim.shimOnTrack(window);
- chromeShim.shimAddTrackRemoveTrack(window);
- chromeShim.shimGetSendersWithDtmf(window);
- chromeShim.shimGetStats(window);
- chromeShim.shimSenderReceiverGetStats(window);
- chromeShim.fixNegotiationNeeded(window);
- commonShim.shimRTCIceCandidate(window);
- commonShim.shimConnectionState(window);
- commonShim.shimMaxMessageSize(window);
- commonShim.shimSendThrowTypeError(window);
- commonShim.removeAllowExtmapMixed(window);
- break;
- case 'firefox':
- if (!firefoxShim || !firefoxShim.shimPeerConnection || !options.shimFirefox) {
- logging('Firefox shim is not included in this adapter release.');
- return adapter;
- }
- logging('adapter.js shimming firefox.');
- // Export to the adapter global object visible in the browser.
- adapter.browserShim = firefoxShim;
- firefoxShim.shimGetUserMedia(window);
- firefoxShim.shimPeerConnection(window);
- firefoxShim.shimOnTrack(window);
- firefoxShim.shimRemoveStream(window);
- firefoxShim.shimSenderGetStats(window);
- firefoxShim.shimReceiverGetStats(window);
- firefoxShim.shimRTCDataChannel(window);
- firefoxShim.shimAddTransceiver(window);
- firefoxShim.shimCreateOffer(window);
- firefoxShim.shimCreateAnswer(window);
- commonShim.shimRTCIceCandidate(window);
- commonShim.shimConnectionState(window);
- commonShim.shimMaxMessageSize(window);
- commonShim.shimSendThrowTypeError(window);
- break;
- case 'edge':
- if (!edgeShim || !edgeShim.shimPeerConnection || !options.shimEdge) {
- logging('MS edge shim is not included in this adapter release.');
- return adapter;
- }
- logging('adapter.js shimming edge.');
- // Export to the adapter global object visible in the browser.
- adapter.browserShim = edgeShim;
- edgeShim.shimGetUserMedia(window);
- edgeShim.shimGetDisplayMedia(window);
- edgeShim.shimPeerConnection(window);
- edgeShim.shimReplaceTrack(window);
- // the edge shim implements the full RTCIceCandidate object.
- commonShim.shimMaxMessageSize(window);
- commonShim.shimSendThrowTypeError(window);
- break;
- case 'safari':
- if (!safariShim || !options.shimSafari) {
- logging('Safari shim is not included in this adapter release.');
- return adapter;
- }
- logging('adapter.js shimming safari.');
- // Export to the adapter global object visible in the browser.
- adapter.browserShim = safariShim;
- safariShim.shimRTCIceServerUrls(window);
- safariShim.shimCreateOfferLegacy(window);
- safariShim.shimCallbacksAPI(window);
- safariShim.shimLocalStreamsAPI(window);
- safariShim.shimRemoteStreamsAPI(window);
- safariShim.shimTrackEventTransceiver(window);
- safariShim.shimGetUserMedia(window);
- commonShim.shimRTCIceCandidate(window);
- commonShim.shimMaxMessageSize(window);
- commonShim.shimSendThrowTypeError(window);
- commonShim.removeAllowExtmapMixed(window);
- break;
- default:
- logging('Unsupported browser!');
- break;
- }
- return adapter;
- }
- // Browser shims.
- }, {
- "./chrome/chrome_shim": 3,
- "./common_shim": 6,
- "./edge/edge_shim": 7,
- "./firefox/firefox_shim": 11,
- "./safari/safari_shim": 14,
- "./utils": 15
- }],
- 3: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- var _getusermedia = require('./getusermedia');
- Object.defineProperty(exports, 'shimGetUserMedia', {
- enumerable: true,
- get: function get() {
- return _getusermedia.shimGetUserMedia;
- }
- });
- var _getdisplaymedia = require('./getdisplaymedia');
- Object.defineProperty(exports, 'shimGetDisplayMedia', {
- enumerable: true,
- get: function get() {
- return _getdisplaymedia.shimGetDisplayMedia;
- }
- });
- exports.shimMediaStream = shimMediaStream;
- exports.shimOnTrack = shimOnTrack;
- exports.shimGetSendersWithDtmf = shimGetSendersWithDtmf;
- exports.shimGetStats = shimGetStats;
- exports.shimSenderReceiverGetStats = shimSenderReceiverGetStats;
- exports.shimAddTrackRemoveTrackWithNative = shimAddTrackRemoveTrackWithNative;
- exports.shimAddTrackRemoveTrack = shimAddTrackRemoveTrack;
- exports.shimPeerConnection = shimPeerConnection;
- exports.fixNegotiationNeeded = fixNegotiationNeeded;
- var _utils = require('../utils.js');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function shimMediaStream(window) {
- window.MediaStream = window.MediaStream || window.webkitMediaStream;
- }
- function shimOnTrack(window) {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && !('ontrack' in window.RTCPeerConnection.prototype)) {
- Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {
- get: function get() {
- return this._ontrack;
- },
- set: function set(f) {
- if (this._ontrack) {
- this.removeEventListener('track', this._ontrack);
- }
- this.addEventListener('track', this._ontrack = f);
- },
- enumerable: true,
- configurable: true
- });
- var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
- window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
- var _this = this;
- if (!this._ontrackpoly) {
- this._ontrackpoly = function (e) {
- // onaddstream does not fire when a track is added to an existing
- // stream. But stream.onaddtrack is implemented so we use that.
- e.stream.addEventListener('addtrack', function (te) {
- var receiver = void 0;
- if (window.RTCPeerConnection.prototype.getReceivers) {
- receiver = _this.getReceivers().find(function (r) {
- return r.track && r.track.id === te.track.id;
- });
- } else {
- receiver = {
- track: te.track
- };
- }
- var event = new Event('track');
- event.track = te.track;
- event.receiver = receiver;
- event.transceiver = {
- receiver: receiver
- };
- event.streams = [e.stream];
- _this.dispatchEvent(event);
- });
- e.stream.getTracks().forEach(function (track) {
- var receiver = void 0;
- if (window.RTCPeerConnection.prototype.getReceivers) {
- receiver = _this.getReceivers().find(function (r) {
- return r.track && r.track.id === track.id;
- });
- } else {
- receiver = {
- track: track
- };
- }
- var event = new Event('track');
- event.track = track;
- event.receiver = receiver;
- event.transceiver = {
- receiver: receiver
- };
- event.streams = [e.stream];
- _this.dispatchEvent(event);
- });
- };
- this.addEventListener('addstream', this._ontrackpoly);
- }
- return origSetRemoteDescription.apply(this, arguments);
- };
- } else {
- // even if RTCRtpTransceiver is in window, it is only used and
- // emitted in unified-plan. Unfortunately this means we need
- // to unconditionally wrap the event.
- utils.wrapPeerConnectionEvent(window, 'track', function (e) {
- if (!e.transceiver) {
- Object.defineProperty(e, 'transceiver', {
- value: {
- receiver: e.receiver
- }
- });
- }
- return e;
- });
- }
- }
- function shimGetSendersWithDtmf(window) {
- // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && !('getSenders' in window.RTCPeerConnection.prototype) && 'createDTMFSender' in window.RTCPeerConnection.prototype) {
- var shimSenderWithDtmf = function shimSenderWithDtmf(pc, track) {
- return {
- track: track,
- get dtmf() {
- if (this._dtmf === undefined) {
- if (track.kind === 'audio') {
- this._dtmf = pc.createDTMFSender(track);
- } else {
- this._dtmf = null;
- }
- }
- return this._dtmf;
- },
- _pc: pc
- };
- };
- // augment addTrack when getSenders is not available.
- if (!window.RTCPeerConnection.prototype.getSenders) {
- window.RTCPeerConnection.prototype.getSenders = function getSenders() {
- this._senders = this._senders || [];
- return this._senders.slice(); // return a copy of the internal state.
- };
- var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
- window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
- var sender = origAddTrack.apply(this, arguments);
- if (!sender) {
- sender = shimSenderWithDtmf(this, track);
- this._senders.push(sender);
- }
- return sender;
- };
- var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
- window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
- origRemoveTrack.apply(this, arguments);
- var idx = this._senders.indexOf(sender);
- if (idx !== -1) {
- this._senders.splice(idx, 1);
- }
- };
- }
- var origAddStream = window.RTCPeerConnection.prototype.addStream;
- window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
- var _this2 = this;
- this._senders = this._senders || [];
- origAddStream.apply(this, [stream]);
- stream.getTracks().forEach(function (track) {
- _this2._senders.push(shimSenderWithDtmf(_this2, track));
- });
- };
- var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
- window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
- var _this3 = this;
- this._senders = this._senders || [];
- origRemoveStream.apply(this, [stream]);
- stream.getTracks().forEach(function (track) {
- var sender = _this3._senders.find(function (s) {
- return s.track === track;
- });
- if (sender) {
- // remove sender
- _this3._senders.splice(_this3._senders.indexOf(sender), 1);
- }
- });
- };
- } 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)) {
- var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
- window.RTCPeerConnection.prototype.getSenders = function getSenders() {
- var _this4 = this;
- var senders = origGetSenders.apply(this, []);
- senders.forEach(function (sender) {
- return sender._pc = _this4;
- });
- return senders;
- };
- Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
- get: function get() {
- if (this._dtmf === undefined) {
- if (this.track.kind === 'audio') {
- this._dtmf = this._pc.createDTMFSender(this.track);
- } else {
- this._dtmf = null;
- }
- }
- return this._dtmf;
- }
- });
- }
- }
- function shimGetStats(window) {
- if (!window.RTCPeerConnection) {
- return;
- }
- var origGetStats = window.RTCPeerConnection.prototype.getStats;
- window.RTCPeerConnection.prototype.getStats = function getStats() {
- var _this5 = this;
- var _arguments = Array.prototype.slice.call(arguments),
- selector = _arguments[0],
- onSucc = _arguments[1],
- onErr = _arguments[2];
- // If selector is a function then we are in the old style stats so just
- // pass back the original getStats format to avoid breaking old users.
- if (arguments.length > 0 && typeof selector === 'function') {
- return origGetStats.apply(this, arguments);
- }
- // When spec-style getStats is supported, return those when called with
- // either no arguments or the selector argument is null.
- if (origGetStats.length === 0 && (arguments.length === 0 || typeof selector !== 'function')) {
- return origGetStats.apply(this, []);
- }
- var fixChromeStats_ = function fixChromeStats_(response) {
- var standardReport = {};
- var reports = response.result();
- reports.forEach(function (report) {
- var standardStats = {
- id: report.id,
- timestamp: report.timestamp,
- type: {
- localcandidate: 'local-candidate',
- remotecandidate: 'remote-candidate'
- }[report.type] || report.type
- };
- report.names().forEach(function (name) {
- standardStats[name] = report.stat(name);
- });
- standardReport[standardStats.id] = standardStats;
- });
- return standardReport;
- };
- // shim getStats with maplike support
- var makeMapStats = function makeMapStats(stats) {
- return new Map(Object.keys(stats).map(function (key) {
- return [key, stats[key]];
- }));
- };
- if (arguments.length >= 2) {
- var successCallbackWrapper_ = function successCallbackWrapper_(response) {
- onSucc(makeMapStats(fixChromeStats_(response)));
- };
- return origGetStats.apply(this, [successCallbackWrapper_, selector]);
- }
- // promise-support
- return new Promise(function (resolve, reject) {
- origGetStats.apply(_this5, [function (response) {
- resolve(makeMapStats(fixChromeStats_(response)));
- }, reject]);
- }).then(onSucc, onErr);
- };
- }
- function shimSenderReceiverGetStats(window) {
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender && window.RTCRtpReceiver)) {
- return;
- }
- // shim sender stats.
- if (!('getStats' in window.RTCRtpSender.prototype)) {
- var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
- if (origGetSenders) {
- window.RTCPeerConnection.prototype.getSenders = function getSenders() {
- var _this6 = this;
- var senders = origGetSenders.apply(this, []);
- senders.forEach(function (sender) {
- return sender._pc = _this6;
- });
- return senders;
- };
- }
- var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
- if (origAddTrack) {
- window.RTCPeerConnection.prototype.addTrack = function addTrack() {
- var sender = origAddTrack.apply(this, arguments);
- sender._pc = this;
- return sender;
- };
- }
- window.RTCRtpSender.prototype.getStats = function getStats() {
- var sender = this;
- return this._pc.getStats().then(function (result) {
- return (
- /* Note: this will include stats of all senders that
- * send a track with the same id as sender.track as
- * it is not possible to identify the RTCRtpSender.
- */
- utils.filterStats(result, sender.track, true)
- );
- });
- };
- }
- // shim receiver stats.
- if (!('getStats' in window.RTCRtpReceiver.prototype)) {
- var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
- if (origGetReceivers) {
- window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {
- var _this7 = this;
- var receivers = origGetReceivers.apply(this, []);
- receivers.forEach(function (receiver) {
- return receiver._pc = _this7;
- });
- return receivers;
- };
- }
- utils.wrapPeerConnectionEvent(window, 'track', function (e) {
- e.receiver._pc = e.srcElement;
- return e;
- });
- window.RTCRtpReceiver.prototype.getStats = function getStats() {
- var receiver = this;
- return this._pc.getStats().then(function (result) {
- return utils.filterStats(result, receiver.track, false);
- });
- };
- }
- if (!('getStats' in window.RTCRtpSender.prototype && 'getStats' in window.RTCRtpReceiver.prototype)) {
- return;
- }
- // shim RTCPeerConnection.getStats(track).
- var origGetStats = window.RTCPeerConnection.prototype.getStats;
- window.RTCPeerConnection.prototype.getStats = function getStats() {
- if (arguments.length > 0 && arguments[0] instanceof window.MediaStreamTrack) {
- var track = arguments[0];
- var sender = void 0;
- var receiver = void 0;
- var err = void 0;
- this.getSenders().forEach(function (s) {
- if (s.track === track) {
- if (sender) {
- err = true;
- } else {
- sender = s;
- }
- }
- });
- this.getReceivers().forEach(function (r) {
- if (r.track === track) {
- if (receiver) {
- err = true;
- } else {
- receiver = r;
- }
- }
- return r.track === track;
- });
- if (err || sender && receiver) {
- return Promise.reject(new DOMException('There are more than one sender or receiver for the track.', 'InvalidAccessError'));
- } else if (sender) {
- return sender.getStats();
- } else if (receiver) {
- return receiver.getStats();
- }
- return Promise.reject(new DOMException('There is no sender or receiver for the track.', 'InvalidAccessError'));
- }
- return origGetStats.apply(this, arguments);
- };
- }
- function shimAddTrackRemoveTrackWithNative(window) {
- // shim addTrack/removeTrack with native variants in order to make
- // the interactions with legacy getLocalStreams behave as in other browsers.
- // Keeps a mapping stream.id => [stream, rtpsenders...]
- window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
- var _this8 = this;
- this._shimmedLocalStreams = this._shimmedLocalStreams || {};
- return Object.keys(this._shimmedLocalStreams).map(function (streamId) {
- return _this8._shimmedLocalStreams[streamId][0];
- });
- };
- var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
- window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
- if (!stream) {
- return origAddTrack.apply(this, arguments);
- }
- this._shimmedLocalStreams = this._shimmedLocalStreams || {};
- var sender = origAddTrack.apply(this, arguments);
- if (!this._shimmedLocalStreams[stream.id]) {
- this._shimmedLocalStreams[stream.id] = [stream, sender];
- } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {
- this._shimmedLocalStreams[stream.id].push(sender);
- }
- return sender;
- };
- var origAddStream = window.RTCPeerConnection.prototype.addStream;
- window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
- var _this9 = this;
- this._shimmedLocalStreams = this._shimmedLocalStreams || {};
- stream.getTracks().forEach(function (track) {
- var alreadyExists = _this9.getSenders().find(function (s) {
- return s.track === track;
- });
- if (alreadyExists) {
- throw new DOMException('Track already exists.', 'InvalidAccessError');
- }
- });
- var existingSenders = this.getSenders();
- origAddStream.apply(this, arguments);
- var newSenders = this.getSenders().filter(function (newSender) {
- return existingSenders.indexOf(newSender) === -1;
- });
- this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);
- };
- var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
- window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
- this._shimmedLocalStreams = this._shimmedLocalStreams || {};
- delete this._shimmedLocalStreams[stream.id];
- return origRemoveStream.apply(this, arguments);
- };
- var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
- window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
- var _this10 = this;
- this._shimmedLocalStreams = this._shimmedLocalStreams || {};
- if (sender) {
- Object.keys(this._shimmedLocalStreams).forEach(function (streamId) {
- var idx = _this10._shimmedLocalStreams[streamId].indexOf(sender);
- if (idx !== -1) {
- _this10._shimmedLocalStreams[streamId].splice(idx, 1);
- }
- if (_this10._shimmedLocalStreams[streamId].length === 1) {
- delete _this10._shimmedLocalStreams[streamId];
- }
- });
- }
- return origRemoveTrack.apply(this, arguments);
- };
- }
- function shimAddTrackRemoveTrack(window) {
- if (!window.RTCPeerConnection) {
- return;
- }
- var browserDetails = utils.detectBrowser(window);
- // shim addTrack and removeTrack.
- if (window.RTCPeerConnection.prototype.addTrack && browserDetails.version >= 65) {
- return shimAddTrackRemoveTrackWithNative(window);
- }
- // also shim pc.getLocalStreams when addTrack is shimmed
- // to return the original streams.
- var origGetLocalStreams = window.RTCPeerConnection.prototype.getLocalStreams;
- window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
- var _this11 = this;
- var nativeStreams = origGetLocalStreams.apply(this);
- this._reverseStreams = this._reverseStreams || {};
- return nativeStreams.map(function (stream) {
- return _this11._reverseStreams[stream.id];
- });
- };
- var origAddStream = window.RTCPeerConnection.prototype.addStream;
- window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
- var _this12 = this;
- this._streams = this._streams || {};
- this._reverseStreams = this._reverseStreams || {};
- stream.getTracks().forEach(function (track) {
- var alreadyExists = _this12.getSenders().find(function (s) {
- return s.track === track;
- });
- if (alreadyExists) {
- throw new DOMException('Track already exists.', 'InvalidAccessError');
- }
- });
- // Add identity mapping for consistency with addTrack.
- // Unless this is being used with a stream from addTrack.
- if (!this._reverseStreams[stream.id]) {
- var newStream = new window.MediaStream(stream.getTracks());
- this._streams[stream.id] = newStream;
- this._reverseStreams[newStream.id] = stream;
- stream = newStream;
- }
- origAddStream.apply(this, [stream]);
- };
- var origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
- window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
- this._streams = this._streams || {};
- this._reverseStreams = this._reverseStreams || {};
- origRemoveStream.apply(this, [this._streams[stream.id] || stream]);
- delete this._reverseStreams[this._streams[stream.id] ? this._streams[stream.id].id : stream.id];
- delete this._streams[stream.id];
- };
- window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {
- var _this13 = this;
- if (this.signalingState === 'closed') {
- throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError');
- }
- var streams = [].slice.call(arguments, 1);
- if (streams.length !== 1 || !streams[0].getTracks().find(function (t) {
- return t === track;
- })) {
- // this is not fully correct but all we can manage without
- // [[associated MediaStreams]] internal slot.
- throw new DOMException('The adapter.js addTrack polyfill only supports a single ' + ' stream which is associated with the specified track.', 'NotSupportedError');
- }
- var alreadyExists = this.getSenders().find(function (s) {
- return s.track === track;
- });
- if (alreadyExists) {
- throw new DOMException('Track already exists.', 'InvalidAccessError');
- }
- this._streams = this._streams || {};
- this._reverseStreams = this._reverseStreams || {};
- var oldStream = this._streams[stream.id];
- if (oldStream) {
- // this is using odd Chrome behaviour, use with caution:
- // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815
- // Note: we rely on the high-level addTrack/dtmf shim to
- // create the sender with a dtmf sender.
- oldStream.addTrack(track);
- // Trigger ONN async.
- Promise.resolve().then(function () {
- _this13.dispatchEvent(new Event('negotiationneeded'));
- });
- } else {
- var newStream = new window.MediaStream([track]);
- this._streams[stream.id] = newStream;
- this._reverseStreams[newStream.id] = stream;
- this.addStream(newStream);
- }
- return this.getSenders().find(function (s) {
- return s.track === track;
- });
- };
- // replace the internal stream id with the external one and
- // vice versa.
- function replaceInternalStreamId(pc, description) {
- var sdp = description.sdp;
- Object.keys(pc._reverseStreams || []).forEach(function (internalId) {
- var externalStream = pc._reverseStreams[internalId];
- var internalStream = pc._streams[externalStream.id];
- sdp = sdp.replace(new RegExp(internalStream.id, 'g'), externalStream.id);
- });
- return new RTCSessionDescription({
- type: description.type,
- sdp: sdp
- });
- }
- function replaceExternalStreamId(pc, description) {
- var sdp = description.sdp;
- Object.keys(pc._reverseStreams || []).forEach(function (internalId) {
- var externalStream = pc._reverseStreams[internalId];
- var internalStream = pc._streams[externalStream.id];
- sdp = sdp.replace(new RegExp(externalStream.id, 'g'), internalStream.id);
- });
- return new RTCSessionDescription({
- type: description.type,
- sdp: sdp
- });
- }
- ['createOffer', 'createAnswer'].forEach(function (method) {
- var nativeMethod = window.RTCPeerConnection.prototype[method];
- var methodObj = _defineProperty({}, method, function () {
- var _this14 = this;
- var args = arguments;
- var isLegacyCall = arguments.length && typeof arguments[0] === 'function';
- if (isLegacyCall) {
- return nativeMethod.apply(this, [function (description) {
- var desc = replaceInternalStreamId(_this14, description);
- args[0].apply(null, [desc]);
- }, function (err) {
- if (args[1]) {
- args[1].apply(null, err);
- }
- }, arguments[2]]);
- }
- return nativeMethod.apply(this, arguments).then(function (description) {
- return replaceInternalStreamId(_this14, description);
- });
- });
- window.RTCPeerConnection.prototype[method] = methodObj[method];
- });
- var origSetLocalDescription = window.RTCPeerConnection.prototype.setLocalDescription;
- window.RTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {
- if (!arguments.length || !arguments[0].type) {
- return origSetLocalDescription.apply(this, arguments);
- }
- arguments[0] = replaceExternalStreamId(this, arguments[0]);
- return origSetLocalDescription.apply(this, arguments);
- };
- // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier
- var origLocalDescription = Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype, 'localDescription');
- Object.defineProperty(window.RTCPeerConnection.prototype, 'localDescription', {
- get: function get() {
- var description = origLocalDescription.get.apply(this);
- if (description.type === '') {
- return description;
- }
- return replaceInternalStreamId(this, description);
- }
- });
- window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
- var _this15 = this;
- if (this.signalingState === 'closed') {
- throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError');
- }
- // We can not yet check for sender instanceof RTCRtpSender
- // since we shim RTPSender. So we check if sender._pc is set.
- if (!sender._pc) {
- throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.', 'TypeError');
- }
- var isLocal = sender._pc === this;
- if (!isLocal) {
- throw new DOMException('Sender was not created by this connection.', 'InvalidAccessError');
- }
- // Search for the native stream the senders track belongs to.
- this._streams = this._streams || {};
- var stream = void 0;
- Object.keys(this._streams).forEach(function (streamid) {
- var hasTrack = _this15._streams[streamid].getTracks().find(function (track) {
- return sender.track === track;
- });
- if (hasTrack) {
- stream = _this15._streams[streamid];
- }
- });
- if (stream) {
- if (stream.getTracks().length === 1) {
- // if this is the last track of the stream, remove the stream. This
- // takes care of any shimmed _senders.
- this.removeStream(this._reverseStreams[stream.id]);
- } else {
- // relying on the same odd chrome behaviour as above.
- stream.removeTrack(sender.track);
- }
- this.dispatchEvent(new Event('negotiationneeded'));
- }
- };
- }
- function shimPeerConnection(window) {
- var browserDetails = utils.detectBrowser(window);
- if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {
- // very basic support for old versions.
- window.RTCPeerConnection = window.webkitRTCPeerConnection;
- }
- if (!window.RTCPeerConnection) {
- return;
- }
- // shim implicit creation of RTCSessionDescription/RTCIceCandidate
- if (browserDetails.version < 53) {
- ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
- var nativeMethod = window.RTCPeerConnection.prototype[method];
- var methodObj = _defineProperty({}, method, function () {
- arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);
- return nativeMethod.apply(this, arguments);
- });
- window.RTCPeerConnection.prototype[method] = methodObj[method];
- });
- }
- // support for addIceCandidate(null or undefined)
- var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate;
- window.RTCPeerConnection.prototype.addIceCandidate = function addIceCandidate() {
- if (!arguments[0]) {
- if (arguments[1]) {
- arguments[1].apply(null);
- }
- return Promise.resolve();
- }
- // Firefox 68+ emits and processes {candidate: "", ...}, ignore
- // in older versions. Native support planned for Chrome M77.
- if (browserDetails.version < 78 && arguments[0] && arguments[0].candidate === '') {
- return Promise.resolve();
- }
- return nativeAddIceCandidate.apply(this, arguments);
- };
- }
- function fixNegotiationNeeded(window) {
- utils.wrapPeerConnectionEvent(window, 'negotiationneeded', function (e) {
- var pc = e.target;
- if (pc.signalingState !== 'stable') {
- return;
- }
- return e;
- });
- }
- }, {
- "../utils.js": 15,
- "./getdisplaymedia": 4,
- "./getusermedia": 5
- }],
- 4: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = shimGetDisplayMedia;
- function shimGetDisplayMedia(window, getSourceId) {
- if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
- return;
- }
- if (!window.navigator.mediaDevices) {
- return;
- }
- // getSourceId is a function that returns a promise resolving with
- // the sourceId of the screen/window/tab to be shared.
- if (typeof getSourceId !== 'function') {
- console.error('shimGetDisplayMedia: getSourceId argument is not ' + 'a function');
- return;
- }
- window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
- return getSourceId(constraints).then(function (sourceId) {
- var widthSpecified = constraints.video && constraints.video.width;
- var heightSpecified = constraints.video && constraints.video.height;
- var frameRateSpecified = constraints.video && constraints.video.frameRate;
- constraints.video = {
- mandatory: {
- chromeMediaSource: 'desktop',
- chromeMediaSourceId: sourceId,
- maxFrameRate: frameRateSpecified || 3
- }
- };
- if (widthSpecified) {
- constraints.video.mandatory.maxWidth = widthSpecified;
- }
- if (heightSpecified) {
- constraints.video.mandatory.maxHeight = heightSpecified;
- }
- return window.navigator.mediaDevices.getUserMedia(constraints);
- });
- };
- }
- }, {}],
- 5: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- exports.shimGetUserMedia = shimGetUserMedia;
- var _utils = require('../utils.js');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- var logging = utils.log;
- function shimGetUserMedia(window) {
- var navigator = window && window.navigator;
- if (!navigator.mediaDevices) {
- return;
- }
- var browserDetails = utils.detectBrowser(window);
- var constraintsToChrome_ = function constraintsToChrome_(c) {
- if ((typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) !== 'object' || c.mandatory || c.optional) {
- return c;
- }
- var cc = {};
- Object.keys(c).forEach(function (key) {
- if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
- return;
- }
- var r = _typeof$1(c[key]) === 'object' ? c[key] : {
- ideal: c[key]
- };
- if (r.exact !== undefined && typeof r.exact === 'number') {
- r.min = r.max = r.exact;
- }
- var oldname_ = function oldname_(prefix, name) {
- if (prefix) {
- return prefix + name.charAt(0).toUpperCase() + name.slice(1);
- }
- return name === 'deviceId' ? 'sourceId' : name;
- };
- if (r.ideal !== undefined) {
- cc.optional = cc.optional || [];
- var oc = {};
- if (typeof r.ideal === 'number') {
- oc[oldname_('min', key)] = r.ideal;
- cc.optional.push(oc);
- oc = {};
- oc[oldname_('max', key)] = r.ideal;
- cc.optional.push(oc);
- } else {
- oc[oldname_('', key)] = r.ideal;
- cc.optional.push(oc);
- }
- }
- if (r.exact !== undefined && typeof r.exact !== 'number') {
- cc.mandatory = cc.mandatory || {};
- cc.mandatory[oldname_('', key)] = r.exact;
- } else {
- ['min', 'max'].forEach(function (mix) {
- if (r[mix] !== undefined) {
- cc.mandatory = cc.mandatory || {};
- cc.mandatory[oldname_(mix, key)] = r[mix];
- }
- });
- }
- });
- if (c.advanced) {
- cc.optional = (cc.optional || []).concat(c.advanced);
- }
- return cc;
- };
- var shimConstraints_ = function shimConstraints_(constraints, func) {
- if (browserDetails.version >= 61) {
- return func(constraints);
- }
- constraints = JSON.parse(JSON.stringify(constraints));
- if (constraints && _typeof$1(constraints.audio) === 'object') {
- var remap = function remap(obj, a, b) {
- if (a in obj && !(b in obj)) {
- obj[b] = obj[a];
- delete obj[a];
- }
- };
- constraints = JSON.parse(JSON.stringify(constraints));
- remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');
- remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');
- constraints.audio = constraintsToChrome_(constraints.audio);
- }
- if (constraints && _typeof$1(constraints.video) === 'object') {
- // Shim facingMode for mobile & surface pro.
- var face = constraints.video.facingMode;
- face = face && ((typeof face === 'undefined' ? 'undefined' : _typeof$1(face)) === 'object' ? face : {
- ideal: face
- });
- var getSupportedFacingModeLies = browserDetails.version < 66;
- if (face && (face.exact === 'user' || face.exact === 'environment' || face.ideal === 'user' || face.ideal === 'environment') && !(navigator.mediaDevices.getSupportedConstraints && navigator.mediaDevices.getSupportedConstraints().facingMode && !getSupportedFacingModeLies)) {
- delete constraints.video.facingMode;
- var matches = void 0;
- if (face.exact === 'environment' || face.ideal === 'environment') {
- matches = ['back', 'rear'];
- } else if (face.exact === 'user' || face.ideal === 'user') {
- matches = ['front'];
- }
- if (matches) {
- // Look for matches in label, or use last cam for back (typical).
- return navigator.mediaDevices.enumerateDevices().then(function (devices) {
- devices = devices.filter(function (d) {
- return d.kind === 'videoinput';
- });
- var dev = devices.find(function (d) {
- return matches.some(function (match) {
- return d.label.toLowerCase().includes(match);
- });
- });
- if (!dev && devices.length && matches.includes('back')) {
- dev = devices[devices.length - 1]; // more likely the back cam
- }
- if (dev) {
- constraints.video.deviceId = face.exact ? {
- exact: dev.deviceId
- } : {
- ideal: dev.deviceId
- };
- }
- constraints.video = constraintsToChrome_(constraints.video);
- logging('chrome: ' + JSON.stringify(constraints));
- return func(constraints);
- });
- }
- }
- constraints.video = constraintsToChrome_(constraints.video);
- }
- logging('chrome: ' + JSON.stringify(constraints));
- return func(constraints);
- };
- var shimError_ = function shimError_(e) {
- if (browserDetails.version >= 64) {
- return e;
- }
- return {
- name: {
- PermissionDeniedError: 'NotAllowedError',
- PermissionDismissedError: 'NotAllowedError',
- InvalidStateError: 'NotAllowedError',
- DevicesNotFoundError: 'NotFoundError',
- ConstraintNotSatisfiedError: 'OverconstrainedError',
- TrackStartError: 'NotReadableError',
- MediaDeviceFailedDueToShutdown: 'NotAllowedError',
- MediaDeviceKillSwitchOn: 'NotAllowedError',
- TabCaptureError: 'AbortError',
- ScreenCaptureError: 'AbortError',
- DeviceCaptureError: 'AbortError'
- }[e.name] || e.name,
- message: e.message,
- constraint: e.constraint || e.constraintName,
- toString: function toString() {
- return this.name + (this.message && ': ') + this.message;
- }
- };
- };
- var getUserMedia_ = function getUserMedia_(constraints, onSuccess, onError) {
- shimConstraints_(constraints, function (c) {
- navigator.webkitGetUserMedia(c, onSuccess, function (e) {
- if (onError) {
- onError(shimError_(e));
- }
- });
- });
- };
- navigator.getUserMedia = getUserMedia_.bind(navigator);
- // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia
- // function which returns a Promise, it does not accept spec-style
- // constraints.
- if (navigator.mediaDevices.getUserMedia) {
- var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
- navigator.mediaDevices.getUserMedia = function (cs) {
- return shimConstraints_(cs, function (c) {
- return origGetUserMedia(c).then(function (stream) {
- if (c.audio && !stream.getAudioTracks().length || c.video && !stream.getVideoTracks().length) {
- stream.getTracks().forEach(function (track) {
- track.stop();
- });
- throw new DOMException('', 'NotFoundError');
- }
- return stream;
- }, function (e) {
- return Promise.reject(shimError_(e));
- });
- });
- };
- }
- }
- }, {
- "../utils.js": 15
- }],
- 6: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- exports.shimRTCIceCandidate = shimRTCIceCandidate;
- exports.shimMaxMessageSize = shimMaxMessageSize;
- exports.shimSendThrowTypeError = shimSendThrowTypeError;
- exports.shimConnectionState = shimConnectionState;
- exports.removeAllowExtmapMixed = removeAllowExtmapMixed;
- var _sdp = require('sdp');
- var _sdp2 = _interopRequireDefault(_sdp);
- var _utils = require('./utils');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- function shimRTCIceCandidate(window) {
- // foundation is arbitrarily chosen as an indicator for full support for
- // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
- if (!window.RTCIceCandidate || window.RTCIceCandidate && 'foundation' in window.RTCIceCandidate.prototype) {
- return;
- }
- var NativeRTCIceCandidate = window.RTCIceCandidate;
- window.RTCIceCandidate = function RTCIceCandidate(args) {
- // Remove the a= which shouldn't be part of the candidate string.
- if ((typeof args === 'undefined' ? 'undefined' : _typeof$1(args)) === 'object' && args.candidate && args.candidate.indexOf('a=') === 0) {
- args = JSON.parse(JSON.stringify(args));
- args.candidate = args.candidate.substr(2);
- }
- if (args.candidate && args.candidate.length) {
- // Augment the native candidate with the parsed fields.
- var nativeCandidate = new NativeRTCIceCandidate(args);
- var parsedCandidate = _sdp2["default"].parseCandidate(args.candidate);
- var augmentedCandidate = Object.assign(nativeCandidate, parsedCandidate);
- // Add a serializer that does not serialize the extra attributes.
- augmentedCandidate.toJSON = function toJSON() {
- return {
- candidate: augmentedCandidate.candidate,
- sdpMid: augmentedCandidate.sdpMid,
- sdpMLineIndex: augmentedCandidate.sdpMLineIndex,
- usernameFragment: augmentedCandidate.usernameFragment
- };
- };
- return augmentedCandidate;
- }
- return new NativeRTCIceCandidate(args);
- };
- window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;
- // Hook up the augmented candidate in onicecandidate and
- // addEventListener('icecandidate', ...)
- utils.wrapPeerConnectionEvent(window, 'icecandidate', function (e) {
- if (e.candidate) {
- Object.defineProperty(e, 'candidate', {
- value: new window.RTCIceCandidate(e.candidate),
- writable: 'false'
- });
- }
- return e;
- });
- }
- function shimMaxMessageSize(window) {
- if (!window.RTCPeerConnection) {
- return;
- }
- var browserDetails = utils.detectBrowser(window);
- if (!('sctp' in window.RTCPeerConnection.prototype)) {
- Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {
- get: function get() {
- return typeof this._sctp === 'undefined' ? null : this._sctp;
- }
- });
- }
- var sctpInDescription = function sctpInDescription(description) {
- if (!description || !description.sdp) {
- return false;
- }
- var sections = _sdp2["default"].splitSections(description.sdp);
- sections.shift();
- return sections.some(function (mediaSection) {
- var mLine = _sdp2["default"].parseMLine(mediaSection);
- return mLine && mLine.kind === 'application' && mLine.protocol.indexOf('SCTP') !== -1;
- });
- };
- var getRemoteFirefoxVersion = function getRemoteFirefoxVersion(description) {
- // TODO: Is there a better solution for detecting Firefox?
- var match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
- if (match === null || match.length < 2) {
- return -1;
- }
- var version = parseInt(match[1], 10);
- // Test for NaN (yes, this is ugly)
- return version !== version ? -1 : version;
- };
- var getCanSendMaxMessageSize = function getCanSendMaxMessageSize(remoteIsFirefox) {
- // Every implementation we know can send at least 64 KiB.
- // Note: Although Chrome is technically able to send up to 256 KiB, the
- // data does not reach the other peer reliably.
- // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419
- var canSendMaxMessageSize = 65536;
- if (browserDetails.browser === 'firefox') {
- if (browserDetails.version < 57) {
- if (remoteIsFirefox === -1) {
- // FF < 57 will send in 16 KiB chunks using the deprecated PPID
- // fragmentation.
- canSendMaxMessageSize = 16384;
- } else {
- // However, other FF (and RAWRTC) can reassemble PPID-fragmented
- // messages. Thus, supporting ~2 GiB when sending.
- canSendMaxMessageSize = 2147483637;
- }
- } else if (browserDetails.version < 60) {
- // Currently, all FF >= 57 will reset the remote maximum message size
- // to the default value when a data channel is created at a later
- // stage. :(
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831
- canSendMaxMessageSize = browserDetails.version === 57 ? 65535 : 65536;
- } else {
- // FF >= 60 supports sending ~2 GiB
- canSendMaxMessageSize = 2147483637;
- }
- }
- return canSendMaxMessageSize;
- };
- var getMaxMessageSize = function getMaxMessageSize(description, remoteIsFirefox) {
- // Note: 65536 bytes is the default value from the SDP spec. Also,
- // every implementation we know supports receiving 65536 bytes.
- var maxMessageSize = 65536;
- // FF 57 has a slightly incorrect default remote max message size, so
- // we need to adjust it here to avoid a failure when sending.
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697
- if (browserDetails.browser === 'firefox' && browserDetails.version === 57) {
- maxMessageSize = 65535;
- }
- var match = _sdp2["default"].matchPrefix(description.sdp, 'a=max-message-size:');
- if (match.length > 0) {
- maxMessageSize = parseInt(match[0].substr(19), 10);
- } else if (browserDetails.browser === 'firefox' && remoteIsFirefox !== -1) {
- // If the maximum message size is not present in the remote SDP and
- // both local and remote are Firefox, the remote peer can receive
- // ~2 GiB.
- maxMessageSize = 2147483637;
- }
- return maxMessageSize;
- };
- var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
- window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
- this._sctp = null;
- // Chrome decided to not expose .sctp in plan-b mode.
- // As usual, adapter.js has to do an 'ugly worakaround'
- // to cover up the mess.
- if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {
- var _getConfiguration = this.getConfiguration(),
- sdpSemantics = _getConfiguration.sdpSemantics;
- if (sdpSemantics === 'plan-b') {
- Object.defineProperty(this, 'sctp', {
- get: function get() {
- return typeof this._sctp === 'undefined' ? null : this._sctp;
- },
- enumerable: true,
- configurable: true
- });
- }
- }
- if (sctpInDescription(arguments[0])) {
- // Check if the remote is FF.
- var isFirefox = getRemoteFirefoxVersion(arguments[0]);
- // Get the maximum message size the local peer is capable of sending
- var canSendMMS = getCanSendMaxMessageSize(isFirefox);
- // Get the maximum message size of the remote peer.
- var remoteMMS = getMaxMessageSize(arguments[0], isFirefox);
- // Determine final maximum message size
- var maxMessageSize = void 0;
- if (canSendMMS === 0 && remoteMMS === 0) {
- maxMessageSize = Number.POSITIVE_INFINITY;
- } else if (canSendMMS === 0 || remoteMMS === 0) {
- maxMessageSize = Math.max(canSendMMS, remoteMMS);
- } else {
- maxMessageSize = Math.min(canSendMMS, remoteMMS);
- }
- // Create a dummy RTCSctpTransport object and the 'maxMessageSize'
- // attribute.
- var sctp = {};
- Object.defineProperty(sctp, 'maxMessageSize', {
- get: function get() {
- return maxMessageSize;
- }
- });
- this._sctp = sctp;
- }
- return origSetRemoteDescription.apply(this, arguments);
- };
- }
- function shimSendThrowTypeError(window) {
- if (!(window.RTCPeerConnection && 'createDataChannel' in window.RTCPeerConnection.prototype)) {
- return;
- }
- // Note: Although Firefox >= 57 has a native implementation, the maximum
- // message size can be reset for all data channels at a later stage.
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831
- function wrapDcSend(dc, pc) {
- var origDataChannelSend = dc.send;
- dc.send = function send() {
- var data = arguments[0];
- var length = data.length || data.size || data.byteLength;
- if (dc.readyState === 'open' && pc.sctp && length > pc.sctp.maxMessageSize) {
- throw new TypeError('Message too large (can send a maximum of ' + pc.sctp.maxMessageSize + ' bytes)');
- }
- return origDataChannelSend.apply(dc, arguments);
- };
- }
- var origCreateDataChannel = window.RTCPeerConnection.prototype.createDataChannel;
- window.RTCPeerConnection.prototype.createDataChannel = function createDataChannel() {
- var dataChannel = origCreateDataChannel.apply(this, arguments);
- wrapDcSend(dataChannel, this);
- return dataChannel;
- };
- utils.wrapPeerConnectionEvent(window, 'datachannel', function (e) {
- wrapDcSend(e.channel, e.target);
- return e;
- });
- }
- /* shims RTCConnectionState by pretending it is the same as iceConnectionState.
- * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12
- * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect
- * since DTLS failures would be hidden. See
- * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827
- * for the Firefox tracking bug.
- */
- function shimConnectionState(window) {
- if (!window.RTCPeerConnection || 'connectionState' in window.RTCPeerConnection.prototype) {
- return;
- }
- var proto = window.RTCPeerConnection.prototype;
- Object.defineProperty(proto, 'connectionState', {
- get: function get() {
- return {
- completed: 'connected',
- checking: 'connecting'
- }[this.iceConnectionState] || this.iceConnectionState;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(proto, 'onconnectionstatechange', {
- get: function get() {
- return this._onconnectionstatechange || null;
- },
- set: function set(cb) {
- if (this._onconnectionstatechange) {
- this.removeEventListener('connectionstatechange', this._onconnectionstatechange);
- delete this._onconnectionstatechange;
- }
- if (cb) {
- this.addEventListener('connectionstatechange', this._onconnectionstatechange = cb);
- }
- },
- enumerable: true,
- configurable: true
- });
- ['setLocalDescription', 'setRemoteDescription'].forEach(function (method) {
- var origMethod = proto[method];
- proto[method] = function () {
- if (!this._connectionstatechangepoly) {
- this._connectionstatechangepoly = function (e) {
- var pc = e.target;
- if (pc._lastConnectionState !== pc.connectionState) {
- pc._lastConnectionState = pc.connectionState;
- var newEvent = new Event('connectionstatechange', e);
- pc.dispatchEvent(newEvent);
- }
- return e;
- };
- this.addEventListener('iceconnectionstatechange', this._connectionstatechangepoly);
- }
- return origMethod.apply(this, arguments);
- };
- });
- }
- function removeAllowExtmapMixed(window) {
- /* remove a=extmap-allow-mixed for Chrome < M71 */
- if (!window.RTCPeerConnection) {
- return;
- }
- var browserDetails = utils.detectBrowser(window);
- if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {
- return;
- }
- var nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;
- window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription(desc) {
- if (desc && desc.sdp && desc.sdp.indexOf('\na=extmap-allow-mixed') !== -1) {
- desc.sdp = desc.sdp.split('\n').filter(function (line) {
- return line.trim() !== 'a=extmap-allow-mixed';
- }).join('\n');
- }
- return nativeSRD.apply(this, arguments);
- };
- }
- }, {
- "./utils": 15,
- "sdp": 17
- }],
- 7: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
- var _getusermedia = require('./getusermedia');
- Object.defineProperty(exports, 'shimGetUserMedia', {
- enumerable: true,
- get: function get() {
- return _getusermedia.shimGetUserMedia;
- }
- });
- var _getdisplaymedia = require('./getdisplaymedia');
- Object.defineProperty(exports, 'shimGetDisplayMedia', {
- enumerable: true,
- get: function get() {
- return _getdisplaymedia.shimGetDisplayMedia;
- }
- });
- exports.shimPeerConnection = shimPeerConnection;
- exports.shimReplaceTrack = shimReplaceTrack;
- var _utils = require('../utils');
- var utils = _interopRequireWildcard(_utils);
- var _filtericeservers = require('./filtericeservers');
- var _rtcpeerconnectionShim = require('rtcpeerconnection-shim');
- var _rtcpeerconnectionShim2 = _interopRequireDefault(_rtcpeerconnectionShim);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function shimPeerConnection(window) {
- var browserDetails = utils.detectBrowser(window);
- if (window.RTCIceGatherer) {
- if (!window.RTCIceCandidate) {
- window.RTCIceCandidate = function RTCIceCandidate(args) {
- return args;
- };
- }
- if (!window.RTCSessionDescription) {
- window.RTCSessionDescription = function RTCSessionDescription(args) {
- return args;
- };
- }
- // this adds an additional event listener to MediaStrackTrack that signals
- // when a tracks enabled property was changed. Workaround for a bug in
- // addStream, see below. No longer required in 15025+
- if (browserDetails.version < 15025) {
- var origMSTEnabled = Object.getOwnPropertyDescriptor(window.MediaStreamTrack.prototype, 'enabled');
- Object.defineProperty(window.MediaStreamTrack.prototype, 'enabled', {
- set: function set(value) {
- origMSTEnabled.set.call(this, value);
- var ev = new Event('enabled');
- ev.enabled = value;
- this.dispatchEvent(ev);
- }
- });
- }
- }
- // ORTC defines the DTMF sender a bit different.
- // https://github.com/w3c/ortc/issues/714
- if (window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) {
- Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
- get: function get() {
- if (this._dtmf === undefined) {
- if (this.track.kind === 'audio') {
- this._dtmf = new window.RTCDtmfSender(this);
- } else if (this.track.kind === 'video') {
- this._dtmf = null;
- }
- }
- return this._dtmf;
- }
- });
- }
- // Edge currently only implements the RTCDtmfSender, not the
- // RTCDTMFSender alias. See http://draft.ortc.org/#rtcdtmfsender2*
- if (window.RTCDtmfSender && !window.RTCDTMFSender) {
- window.RTCDTMFSender = window.RTCDtmfSender;
- }
- var RTCPeerConnectionShim = (0, _rtcpeerconnectionShim2["default"])(window, browserDetails.version);
- window.RTCPeerConnection = function RTCPeerConnection(config) {
- if (config && config.iceServers) {
- config.iceServers = (0, _filtericeservers.filterIceServers)(config.iceServers, browserDetails.version);
- utils.log('ICE servers after filtering:', config.iceServers);
- }
- return new RTCPeerConnectionShim(config);
- };
- window.RTCPeerConnection.prototype = RTCPeerConnectionShim.prototype;
- }
- function shimReplaceTrack(window) {
- // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614
- if (window.RTCRtpSender && !('replaceTrack' in window.RTCRtpSender.prototype)) {
- window.RTCRtpSender.prototype.replaceTrack = window.RTCRtpSender.prototype.setTrack;
- }
- }
- }, {
- "../utils": 15,
- "./filtericeservers": 8,
- "./getdisplaymedia": 9,
- "./getusermedia": 10,
- "rtcpeerconnection-shim": 16
- }],
- 8: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.filterIceServers = filterIceServers;
- var _utils = require('../utils');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- // Edge does not like
- // 1) stun: filtered after 14393 unless ?transport=udp is present
- // 2) turn: that does not have all of turn:host:port?transport=udp
- // 3) turn: with ipv6 addresses
- // 4) turn: occurring muliple times
- function filterIceServers(iceServers, edgeVersion) {
- var hasTurn = false;
- iceServers = JSON.parse(JSON.stringify(iceServers));
- return iceServers.filter(function (server) {
- if (server && (server.urls || server.url)) {
- var urls = server.urls || server.url;
- if (server.url && !server.urls) {
- utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');
- }
- var isString = typeof urls === 'string';
- if (isString) {
- urls = [urls];
- }
- urls = urls.filter(function (url) {
- // filter STUN unconditionally.
- if (url.indexOf('stun:') === 0) {
- return false;
- }
- var validTurn = url.startsWith('turn') && !url.startsWith('turn:[') && url.includes('transport=udp');
- if (validTurn && !hasTurn) {
- hasTurn = true;
- return true;
- }
- return validTurn && !hasTurn;
- });
- delete server.url;
- server.urls = isString ? urls[0] : urls;
- return !!urls.length;
- }
- });
- }
- }, {
- "../utils": 15
- }],
- 9: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = shimGetDisplayMedia;
- function shimGetDisplayMedia(window) {
- if (!('getDisplayMedia' in window.navigator)) {
- return;
- }
- if (!window.navigator.mediaDevices) {
- return;
- }
- if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
- return;
- }
- window.navigator.mediaDevices.getDisplayMedia = window.navigator.getDisplayMedia.bind(window.navigator);
- }
- }, {}],
- 10: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetUserMedia = shimGetUserMedia;
- function shimGetUserMedia(window) {
- var navigator = window && window.navigator;
- var shimError_ = function shimError_(e) {
- return {
- name: {
- PermissionDeniedError: 'NotAllowedError'
- }[e.name] || e.name,
- message: e.message,
- constraint: e.constraint,
- toString: function toString() {
- return this.name;
- }
- };
- };
- // getUserMedia error shim.
- var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
- navigator.mediaDevices.getUserMedia = function (c) {
- return origGetUserMedia(c)["catch"](function (e) {
- return Promise.reject(shimError_(e));
- });
- };
- }
- }, {}],
- 11: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = exports.shimGetUserMedia = undefined;
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- var _getusermedia = require('./getusermedia');
- Object.defineProperty(exports, 'shimGetUserMedia', {
- enumerable: true,
- get: function get() {
- return _getusermedia.shimGetUserMedia;
- }
- });
- var _getdisplaymedia = require('./getdisplaymedia');
- Object.defineProperty(exports, 'shimGetDisplayMedia', {
- enumerable: true,
- get: function get() {
- return _getdisplaymedia.shimGetDisplayMedia;
- }
- });
- exports.shimOnTrack = shimOnTrack;
- exports.shimPeerConnection = shimPeerConnection;
- exports.shimSenderGetStats = shimSenderGetStats;
- exports.shimReceiverGetStats = shimReceiverGetStats;
- exports.shimRemoveStream = shimRemoveStream;
- exports.shimRTCDataChannel = shimRTCDataChannel;
- exports.shimAddTransceiver = shimAddTransceiver;
- exports.shimCreateOffer = shimCreateOffer;
- exports.shimCreateAnswer = shimCreateAnswer;
- var _utils = require('../utils');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function shimOnTrack(window) {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {
- Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
- get: function get() {
- return {
- receiver: this.receiver
- };
- }
- });
- }
- }
- function shimPeerConnection(window) {
- var browserDetails = utils.detectBrowser(window);
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {
- return; // probably media.peerconnection.enabled=false in about:config
- }
- if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {
- // very basic support for old versions.
- window.RTCPeerConnection = window.mozRTCPeerConnection;
- }
- if (browserDetails.version < 53) {
- // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.
- ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
- var nativeMethod = window.RTCPeerConnection.prototype[method];
- var methodObj = _defineProperty({}, method, function () {
- arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);
- return nativeMethod.apply(this, arguments);
- });
- window.RTCPeerConnection.prototype[method] = methodObj[method];
- });
- }
- // support for addIceCandidate(null or undefined)
- // as well as ignoring {sdpMid, candidate: ""}
- if (browserDetails.version < 68) {
- var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate;
- window.RTCPeerConnection.prototype.addIceCandidate = function addIceCandidate() {
- if (!arguments[0]) {
- if (arguments[1]) {
- arguments[1].apply(null);
- }
- return Promise.resolve();
- }
- // Firefox 68+ emits and processes {candidate: "", ...}, ignore
- // in older versions.
- if (arguments[0] && arguments[0].candidate === '') {
- return Promise.resolve();
- }
- return nativeAddIceCandidate.apply(this, arguments);
- };
- }
- var modernStatsTypes = {
- inboundrtp: 'inbound-rtp',
- outboundrtp: 'outbound-rtp',
- candidatepair: 'candidate-pair',
- localcandidate: 'local-candidate',
- remotecandidate: 'remote-candidate'
- };
- var nativeGetStats = window.RTCPeerConnection.prototype.getStats;
- window.RTCPeerConnection.prototype.getStats = function getStats() {
- var _arguments = Array.prototype.slice.call(arguments),
- selector = _arguments[0],
- onSucc = _arguments[1],
- onErr = _arguments[2];
- return nativeGetStats.apply(this, [selector || null]).then(function (stats) {
- if (browserDetails.version < 53 && !onSucc) {
- // Shim only promise getStats with spec-hyphens in type names
- // Leave callback version alone; misc old uses of forEach before Map
- try {
- stats.forEach(function (stat) {
- stat.type = modernStatsTypes[stat.type] || stat.type;
- });
- } catch (e) {
- if (e.name !== 'TypeError') {
- throw e;
- }
- // Avoid TypeError: "type" is read-only, in old versions. 34-43ish
- stats.forEach(function (stat, i) {
- stats.set(i, Object.assign({}, stat, {
- type: modernStatsTypes[stat.type] || stat.type
- }));
- });
- }
- }
- return stats;
- }).then(onSucc, onErr);
- };
- }
- function shimSenderGetStats(window) {
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {
- return;
- }
- if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {
- return;
- }
- var origGetSenders = window.RTCPeerConnection.prototype.getSenders;
- if (origGetSenders) {
- window.RTCPeerConnection.prototype.getSenders = function getSenders() {
- var _this = this;
- var senders = origGetSenders.apply(this, []);
- senders.forEach(function (sender) {
- return sender._pc = _this;
- });
- return senders;
- };
- }
- var origAddTrack = window.RTCPeerConnection.prototype.addTrack;
- if (origAddTrack) {
- window.RTCPeerConnection.prototype.addTrack = function addTrack() {
- var sender = origAddTrack.apply(this, arguments);
- sender._pc = this;
- return sender;
- };
- }
- window.RTCRtpSender.prototype.getStats = function getStats() {
- return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map());
- };
- }
- function shimReceiverGetStats(window) {
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {
- return;
- }
- if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {
- return;
- }
- var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
- if (origGetReceivers) {
- window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {
- var _this2 = this;
- var receivers = origGetReceivers.apply(this, []);
- receivers.forEach(function (receiver) {
- return receiver._pc = _this2;
- });
- return receivers;
- };
- }
- utils.wrapPeerConnectionEvent(window, 'track', function (e) {
- e.receiver._pc = e.srcElement;
- return e;
- });
- window.RTCRtpReceiver.prototype.getStats = function getStats() {
- return this._pc.getStats(this.track);
- };
- }
- function shimRemoveStream(window) {
- if (!window.RTCPeerConnection || 'removeStream' in window.RTCPeerConnection.prototype) {
- return;
- }
- window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
- var _this3 = this;
- utils.deprecated('removeStream', 'removeTrack');
- this.getSenders().forEach(function (sender) {
- if (sender.track && stream.getTracks().includes(sender.track)) {
- _this3.removeTrack(sender);
- }
- });
- };
- }
- function shimRTCDataChannel(window) {
- // rename DataChannel to RTCDataChannel (native fix in FF60):
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851
- if (window.DataChannel && !window.RTCDataChannel) {
- window.RTCDataChannel = window.DataChannel;
- }
- }
- function shimAddTransceiver(window) {
- // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
- // Firefox ignores the init sendEncodings options passed to addTransceiver
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
- return;
- }
- var origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;
- if (origAddTransceiver) {
- window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {
- this.setParametersPromises = [];
- var initParameters = arguments[1];
- var shouldPerformCheck = initParameters && 'sendEncodings' in initParameters;
- if (shouldPerformCheck) {
- // If sendEncodings params are provided, validate grammar
- initParameters.sendEncodings.forEach(function (encodingParam) {
- if ('rid' in encodingParam) {
- var ridRegex = /^[a-z0-9]{0,16}$/i;
- if (!ridRegex.test(encodingParam.rid)) {
- throw new TypeError('Invalid RID value provided.');
- }
- }
- if ('scaleResolutionDownBy' in encodingParam) {
- if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {
- throw new RangeError('scale_resolution_down_by must be >= 1.0');
- }
- }
- if ('maxFramerate' in encodingParam) {
- if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {
- throw new RangeError('max_framerate must be >= 0.0');
- }
- }
- });
- }
- var transceiver = origAddTransceiver.apply(this, arguments);
- if (shouldPerformCheck) {
- // Check if the init options were applied. If not we do this in an
- // asynchronous way and save the promise reference in a global object.
- // This is an ugly hack, but at the same time is way more robust than
- // checking the sender parameters before and after the createOffer
- // Also note that after the createoffer we are not 100% sure that
- // the params were asynchronously applied so we might miss the
- // opportunity to recreate offer.
- var sender = transceiver.sender;
- var params = sender.getParameters();
- if (!('encodings' in params)) {
- params.encodings = initParameters.sendEncodings;
- this.setParametersPromises.push(sender.setParameters(params)["catch"](function () {}));
- }
- }
- return transceiver;
- };
- }
- }
- function shimCreateOffer(window) {
- // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
- // Firefox ignores the init sendEncodings options passed to addTransceiver
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
- return;
- }
- var origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
- window.RTCPeerConnection.prototype.createOffer = function createOffer() {
- var _this4 = this,
- _arguments2 = arguments;
- if (this.setParametersPromises && this.setParametersPromises.length) {
- return Promise.all(this.setParametersPromises).then(function () {
- return origCreateOffer.apply(_this4, _arguments2);
- })["finally"](function () {
- _this4.setParametersPromises = [];
- });
- }
- return origCreateOffer.apply(this, arguments);
- };
- }
- function shimCreateAnswer(window) {
- // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
- // Firefox ignores the init sendEncodings options passed to addTransceiver
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
- if (!((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCPeerConnection)) {
- return;
- }
- var origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;
- window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {
- var _this5 = this,
- _arguments3 = arguments;
- if (this.setParametersPromises && this.setParametersPromises.length) {
- return Promise.all(this.setParametersPromises).then(function () {
- return origCreateAnswer.apply(_this5, _arguments3);
- })["finally"](function () {
- _this5.setParametersPromises = [];
- });
- }
- return origCreateAnswer.apply(this, arguments);
- };
- }
- }, {
- "../utils": 15,
- "./getdisplaymedia": 12,
- "./getusermedia": 13
- }],
- 12: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shimGetDisplayMedia = shimGetDisplayMedia;
- function shimGetDisplayMedia(window, preferredMediaSource) {
- if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
- return;
- }
- if (!window.navigator.mediaDevices) {
- return;
- }
- window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
- if (!(constraints && constraints.video)) {
- var err = new DOMException('getDisplayMedia without video ' + 'constraints is undefined');
- err.name = 'NotFoundError';
- // from https://heycam.github.io/webidl/#idl-DOMException-error-names
- err.code = 8;
- return Promise.reject(err);
- }
- if (constraints.video === true) {
- constraints.video = {
- mediaSource: preferredMediaSource
- };
- } else {
- constraints.video.mediaSource = preferredMediaSource;
- }
- return window.navigator.mediaDevices.getUserMedia(constraints);
- };
- }
- }, {}],
- 13: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- exports.shimGetUserMedia = shimGetUserMedia;
- var _utils = require('../utils');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function shimGetUserMedia(window) {
- var browserDetails = utils.detectBrowser(window);
- var navigator = window && window.navigator;
- var MediaStreamTrack = window && window.MediaStreamTrack;
- navigator.getUserMedia = function (constraints, onSuccess, onError) {
- // Replace Firefox 44+'s deprecation warning with unprefixed version.
- utils.deprecated('navigator.getUserMedia', 'navigator.mediaDevices.getUserMedia');
- navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);
- };
- if (!(browserDetails.version > 55 && 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {
- var remap = function remap(obj, a, b) {
- if (a in obj && !(b in obj)) {
- obj[b] = obj[a];
- delete obj[a];
- }
- };
- var nativeGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
- navigator.mediaDevices.getUserMedia = function (c) {
- if ((typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) === 'object' && _typeof$1(c.audio) === 'object') {
- c = JSON.parse(JSON.stringify(c));
- remap(c.audio, 'autoGainControl', 'mozAutoGainControl');
- remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');
- }
- return nativeGetUserMedia(c);
- };
- if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {
- var nativeGetSettings = MediaStreamTrack.prototype.getSettings;
- MediaStreamTrack.prototype.getSettings = function () {
- var obj = nativeGetSettings.apply(this, arguments);
- remap(obj, 'mozAutoGainControl', 'autoGainControl');
- remap(obj, 'mozNoiseSuppression', 'noiseSuppression');
- return obj;
- };
- }
- if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {
- var nativeApplyConstraints = MediaStreamTrack.prototype.applyConstraints;
- MediaStreamTrack.prototype.applyConstraints = function (c) {
- if (this.kind === 'audio' && (typeof c === 'undefined' ? 'undefined' : _typeof$1(c)) === 'object') {
- c = JSON.parse(JSON.stringify(c));
- remap(c, 'autoGainControl', 'mozAutoGainControl');
- remap(c, 'noiseSuppression', 'mozNoiseSuppression');
- }
- return nativeApplyConstraints.apply(this, [c]);
- };
- }
- }
- }
- }, {
- "../utils": 15
- }],
- 14: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- exports.shimLocalStreamsAPI = shimLocalStreamsAPI;
- exports.shimRemoteStreamsAPI = shimRemoteStreamsAPI;
- exports.shimCallbacksAPI = shimCallbacksAPI;
- exports.shimGetUserMedia = shimGetUserMedia;
- exports.shimConstraints = shimConstraints;
- exports.shimRTCIceServerUrls = shimRTCIceServerUrls;
- exports.shimTrackEventTransceiver = shimTrackEventTransceiver;
- exports.shimCreateOfferLegacy = shimCreateOfferLegacy;
- var _utils = require('../utils');
- var utils = _interopRequireWildcard(_utils);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj["default"] = obj;
- return newObj;
- }
- }
- function shimLocalStreamsAPI(window) {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
- return;
- }
- if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {
- window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {
- if (!this._localStreams) {
- this._localStreams = [];
- }
- return this._localStreams;
- };
- }
- if (!('addStream' in window.RTCPeerConnection.prototype)) {
- var _addTrack = window.RTCPeerConnection.prototype.addTrack;
- window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
- var _this = this;
- if (!this._localStreams) {
- this._localStreams = [];
- }
- if (!this._localStreams.includes(stream)) {
- this._localStreams.push(stream);
- }
- // Try to emulate Chrome's behaviour of adding in audio-video order.
- // Safari orders by track id.
- stream.getAudioTracks().forEach(function (track) {
- return _addTrack.call(_this, track, stream);
- });
- stream.getVideoTracks().forEach(function (track) {
- return _addTrack.call(_this, track, stream);
- });
- };
- window.RTCPeerConnection.prototype.addTrack = function addTrack(track) {
- var stream = arguments[1];
- if (stream) {
- if (!this._localStreams) {
- this._localStreams = [stream];
- } else if (!this._localStreams.includes(stream)) {
- this._localStreams.push(stream);
- }
- }
- return _addTrack.apply(this, arguments);
- };
- }
- if (!('removeStream' in window.RTCPeerConnection.prototype)) {
- window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {
- var _this2 = this;
- if (!this._localStreams) {
- this._localStreams = [];
- }
- var index = this._localStreams.indexOf(stream);
- if (index === -1) {
- return;
- }
- this._localStreams.splice(index, 1);
- var tracks = stream.getTracks();
- this.getSenders().forEach(function (sender) {
- if (tracks.includes(sender.track)) {
- _this2.removeTrack(sender);
- }
- });
- };
- }
- }
- function shimRemoteStreamsAPI(window) {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
- return;
- }
- if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {
- window.RTCPeerConnection.prototype.getRemoteStreams = function getRemoteStreams() {
- return this._remoteStreams ? this._remoteStreams : [];
- };
- }
- if (!('onaddstream' in window.RTCPeerConnection.prototype)) {
- Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {
- get: function get() {
- return this._onaddstream;
- },
- set: function set(f) {
- var _this3 = this;
- if (this._onaddstream) {
- this.removeEventListener('addstream', this._onaddstream);
- this.removeEventListener('track', this._onaddstreampoly);
- }
- this.addEventListener('addstream', this._onaddstream = f);
- this.addEventListener('track', this._onaddstreampoly = function (e) {
- e.streams.forEach(function (stream) {
- if (!_this3._remoteStreams) {
- _this3._remoteStreams = [];
- }
- if (_this3._remoteStreams.includes(stream)) {
- return;
- }
- _this3._remoteStreams.push(stream);
- var event = new Event('addstream');
- event.stream = stream;
- _this3.dispatchEvent(event);
- });
- });
- }
- });
- var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;
- window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
- var pc = this;
- if (!this._onaddstreampoly) {
- this.addEventListener('track', this._onaddstreampoly = function (e) {
- e.streams.forEach(function (stream) {
- if (!pc._remoteStreams) {
- pc._remoteStreams = [];
- }
- if (pc._remoteStreams.indexOf(stream) >= 0) {
- return;
- }
- pc._remoteStreams.push(stream);
- var event = new Event('addstream');
- event.stream = stream;
- pc.dispatchEvent(event);
- });
- });
- }
- return origSetRemoteDescription.apply(pc, arguments);
- };
- }
- }
- function shimCallbacksAPI(window) {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) !== 'object' || !window.RTCPeerConnection) {
- return;
- }
- var prototype = window.RTCPeerConnection.prototype;
- var origCreateOffer = prototype.createOffer;
- var origCreateAnswer = prototype.createAnswer;
- var setLocalDescription = prototype.setLocalDescription;
- var setRemoteDescription = prototype.setRemoteDescription;
- var addIceCandidate = prototype.addIceCandidate;
- prototype.createOffer = function createOffer(successCallback, failureCallback) {
- var options = arguments.length >= 2 ? arguments[2] : arguments[0];
- var promise = origCreateOffer.apply(this, [options]);
- if (!failureCallback) {
- return promise;
- }
- promise.then(successCallback, failureCallback);
- return Promise.resolve();
- };
- prototype.createAnswer = function createAnswer(successCallback, failureCallback) {
- var options = arguments.length >= 2 ? arguments[2] : arguments[0];
- var promise = origCreateAnswer.apply(this, [options]);
- if (!failureCallback) {
- return promise;
- }
- promise.then(successCallback, failureCallback);
- return Promise.resolve();
- };
- var withCallback = function withCallback(description, successCallback, failureCallback) {
- var promise = setLocalDescription.apply(this, [description]);
- if (!failureCallback) {
- return promise;
- }
- promise.then(successCallback, failureCallback);
- return Promise.resolve();
- };
- prototype.setLocalDescription = withCallback;
- withCallback = function withCallback(description, successCallback, failureCallback) {
- var promise = setRemoteDescription.apply(this, [description]);
- if (!failureCallback) {
- return promise;
- }
- promise.then(successCallback, failureCallback);
- return Promise.resolve();
- };
- prototype.setRemoteDescription = withCallback;
- withCallback = function withCallback(candidate, successCallback, failureCallback) {
- var promise = addIceCandidate.apply(this, [candidate]);
- if (!failureCallback) {
- return promise;
- }
- promise.then(successCallback, failureCallback);
- return Promise.resolve();
- };
- prototype.addIceCandidate = withCallback;
- }
- function shimGetUserMedia(window) {
- var navigator = window && window.navigator;
- if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
- // shim not needed in Safari 12.1
- var mediaDevices = navigator.mediaDevices;
- var _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);
- navigator.mediaDevices.getUserMedia = function (constraints) {
- return _getUserMedia(shimConstraints(constraints));
- };
- }
- if (!navigator.getUserMedia && navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
- navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {
- navigator.mediaDevices.getUserMedia(constraints).then(cb, errcb);
- }.bind(navigator);
- }
- }
- function shimConstraints(constraints) {
- if (constraints && constraints.video !== undefined) {
- return Object.assign({}, constraints, {
- video: utils.compactObject(constraints.video)
- });
- }
- return constraints;
- }
- function shimRTCIceServerUrls(window) {
- // migrate from non-spec RTCIceServer.url to RTCIceServer.urls
- var OrigPeerConnection = window.RTCPeerConnection;
- window.RTCPeerConnection = function RTCPeerConnection(pcConfig, pcConstraints) {
- if (pcConfig && pcConfig.iceServers) {
- var newIceServers = [];
- for (var i = 0; i < pcConfig.iceServers.length; i++) {
- var server = pcConfig.iceServers[i];
- if (!server.hasOwnProperty('urls') && server.hasOwnProperty('url')) {
- utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');
- server = JSON.parse(JSON.stringify(server));
- server.urls = server.url;
- delete server.url;
- newIceServers.push(server);
- } else {
- newIceServers.push(pcConfig.iceServers[i]);
- }
- }
- pcConfig.iceServers = newIceServers;
- }
- return new OrigPeerConnection(pcConfig, pcConstraints);
- };
- window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;
- // wrap static methods. Currently just generateCertificate.
- if ('generateCertificate' in window.RTCPeerConnection) {
- Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {
- get: function get() {
- return OrigPeerConnection.generateCertificate;
- }
- });
- }
- }
- function shimTrackEventTransceiver(window) {
- // Add event.transceiver member over deprecated event.receiver
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {
- Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
- get: function get() {
- return {
- receiver: this.receiver
- };
- }
- });
- }
- }
- function shimCreateOfferLegacy(window) {
- var origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
- window.RTCPeerConnection.prototype.createOffer = function createOffer(offerOptions) {
- if (offerOptions) {
- if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {
- // support bit values
- offerOptions.offerToReceiveAudio = !!offerOptions.offerToReceiveAudio;
- }
- var audioTransceiver = this.getTransceivers().find(function (transceiver) {
- return transceiver.receiver.track.kind === 'audio';
- });
- if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {
- if (audioTransceiver.direction === 'sendrecv') {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection('sendonly');
- } else {
- audioTransceiver.direction = 'sendonly';
- }
- } else if (audioTransceiver.direction === 'recvonly') {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection('inactive');
- } else {
- audioTransceiver.direction = 'inactive';
- }
- }
- } else if (offerOptions.offerToReceiveAudio === true && !audioTransceiver) {
- this.addTransceiver('audio');
- }
- if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {
- // support bit values
- offerOptions.offerToReceiveVideo = !!offerOptions.offerToReceiveVideo;
- }
- var videoTransceiver = this.getTransceivers().find(function (transceiver) {
- return transceiver.receiver.track.kind === 'video';
- });
- if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {
- if (videoTransceiver.direction === 'sendrecv') {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection('sendonly');
- } else {
- videoTransceiver.direction = 'sendonly';
- }
- } else if (videoTransceiver.direction === 'recvonly') {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection('inactive');
- } else {
- videoTransceiver.direction = 'inactive';
- }
- }
- } else if (offerOptions.offerToReceiveVideo === true && !videoTransceiver) {
- this.addTransceiver('video');
- }
- }
- return origCreateOffer.apply(this, arguments);
- };
- }
- }, {
- "../utils": 15
- }],
- 15: [function (require, module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
- return _typeof(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
- };
- exports.extractVersion = extractVersion;
- exports.wrapPeerConnectionEvent = wrapPeerConnectionEvent;
- exports.disableLog = disableLog;
- exports.disableWarnings = disableWarnings;
- exports.log = log;
- exports.deprecated = deprecated;
- exports.detectBrowser = detectBrowser;
- exports.compactObject = compactObject;
- exports.walkStats = walkStats;
- exports.filterStats = filterStats;
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var logDisabled_ = true;
- var deprecationWarnings_ = true;
- /**
- * Extract browser version out of the provided user agent string.
- *
- * @param {!string} uastring userAgent string.
- * @param {!string} expr Regular expression used as match criteria.
- * @param {!number} pos position in the version string to be returned.
- * @return {!number} browser version.
- */
- function extractVersion(uastring, expr, pos) {
- var match = uastring.match(expr);
- return match && match.length >= pos && parseInt(match[pos], 10);
- }
- // Wraps the peerconnection event eventNameToWrap in a function
- // which returns the modified event object (or false to prevent
- // the event).
- function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {
- if (!window.RTCPeerConnection) {
- return;
- }
- var proto = window.RTCPeerConnection.prototype;
- var nativeAddEventListener = proto.addEventListener;
- proto.addEventListener = function (nativeEventName, cb) {
- if (nativeEventName !== eventNameToWrap) {
- return nativeAddEventListener.apply(this, arguments);
- }
- var wrappedCallback = function wrappedCallback(e) {
- var modifiedEvent = wrapper(e);
- if (modifiedEvent) {
- cb(modifiedEvent);
- }
- };
- this._eventMap = this._eventMap || {};
- this._eventMap[cb] = wrappedCallback;
- return nativeAddEventListener.apply(this, [nativeEventName, wrappedCallback]);
- };
- var nativeRemoveEventListener = proto.removeEventListener;
- proto.removeEventListener = function (nativeEventName, cb) {
- if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[cb]) {
- return nativeRemoveEventListener.apply(this, arguments);
- }
- var unwrappedCb = this._eventMap[cb];
- delete this._eventMap[cb];
- return nativeRemoveEventListener.apply(this, [nativeEventName, unwrappedCb]);
- };
- Object.defineProperty(proto, 'on' + eventNameToWrap, {
- get: function get() {
- return this['_on' + eventNameToWrap];
- },
- set: function set(cb) {
- if (this['_on' + eventNameToWrap]) {
- this.removeEventListener(eventNameToWrap, this['_on' + eventNameToWrap]);
- delete this['_on' + eventNameToWrap];
- }
- if (cb) {
- this.addEventListener(eventNameToWrap, this['_on' + eventNameToWrap] = cb);
- }
- },
- enumerable: true,
- configurable: true
- });
- }
- function disableLog(bool) {
- if (typeof bool !== 'boolean') {
- return new Error('Argument type: ' + (typeof bool === 'undefined' ? 'undefined' : _typeof$1(bool)) + '. Please use a boolean.');
- }
- logDisabled_ = bool;
- return bool ? 'adapter.js logging disabled' : 'adapter.js logging enabled';
- }
- /**
- * Disable or enable deprecation warnings
- * @param {!boolean} bool set to true to disable warnings.
- */
- function disableWarnings(bool) {
- if (typeof bool !== 'boolean') {
- return new Error('Argument type: ' + (typeof bool === 'undefined' ? 'undefined' : _typeof$1(bool)) + '. Please use a boolean.');
- }
- deprecationWarnings_ = !bool;
- return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');
- }
- function log() {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof$1(window)) === 'object') {
- if (logDisabled_) {
- return;
- }
- if (typeof console !== 'undefined' && typeof console.log === 'function') {
- console.log.apply(console, arguments);
- }
- }
- }
- /**
- * Shows a deprecation warning suggesting the modern and spec-compatible API.
- */
- function deprecated(oldMethod, newMethod) {
- if (!deprecationWarnings_) {
- return;
- }
- console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.');
- }
- /**
- * Browser detector.
- *
- * @return {object} result containing browser and version
- * properties.
- */
- function detectBrowser(window) {
- var navigator = window.navigator;
- // Returned result object.
- var result = {
- browser: null,
- version: null
- };
- // Fail early if it's not a browser
- if (typeof window === 'undefined' || !window.navigator) {
- result.browser = 'Not a browser.';
- return result;
- }
- if (navigator.mozGetUserMedia) {
- // Firefox.
- result.browser = 'firefox';
- result.version = extractVersion(navigator.userAgent, /Firefox\/(\d+)\./, 1);
- } else if (navigator.webkitGetUserMedia || window.isSecureContext === false && window.webkitRTCPeerConnection && !window.RTCIceGatherer) {
- // Chrome, Chromium, Webview, Opera.
- // Version matches Chrome/WebRTC version.
- // Chrome 74 removed webkitGetUserMedia on http as well so we need the
- // more complicated fallback to webkitRTCPeerConnection.
- result.browser = 'chrome';
- result.version = extractVersion(navigator.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
- } else if (navigator.mediaDevices && navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) {
- // Edge.
- result.browser = 'edge';
- result.version = extractVersion(navigator.userAgent, /Edge\/(\d+).(\d+)$/, 2);
- } else if (window.RTCPeerConnection && navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) {
- // Safari.
- result.browser = 'safari';
- result.version = extractVersion(navigator.userAgent, /AppleWebKit\/(\d+)\./, 1);
- result.supportsUnifiedPlan = window.RTCRtpTransceiver && 'currentDirection' in window.RTCRtpTransceiver.prototype;
- } else {
- // Default fallthrough: not supported.
- result.browser = 'Not a supported browser.';
- return result;
- }
- return result;
- }
- /**
- * Checks if something is an object.
- *
- * @param {*} val The something you want to check.
- * @return true if val is an object, false otherwise.
- */
- function isObject(val) {
- return Object.prototype.toString.call(val) === '[object Object]';
- }
- /**
- * Remove all empty objects and undefined values
- * from a nested object -- an enhanced and vanilla version
- * of Lodash's `compact`.
- */
- function compactObject(data) {
- if (!isObject(data)) {
- return data;
- }
- return Object.keys(data).reduce(function (accumulator, key) {
- var isObj = isObject(data[key]);
- var value = isObj ? compactObject(data[key]) : data[key];
- var isEmptyObject = isObj && !Object.keys(value).length;
- if (value === undefined || isEmptyObject) {
- return accumulator;
- }
- return Object.assign(accumulator, _defineProperty({}, key, value));
- }, {});
- }
- /* iterates the stats graph recursively. */
- function walkStats(stats, base, resultSet) {
- if (!base || resultSet.has(base.id)) {
- return;
- }
- resultSet.set(base.id, base);
- Object.keys(base).forEach(function (name) {
- if (name.endsWith('Id')) {
- walkStats(stats, stats.get(base[name]), resultSet);
- } else if (name.endsWith('Ids')) {
- base[name].forEach(function (id) {
- walkStats(stats, stats.get(id), resultSet);
- });
- }
- });
- }
- /* filter getStats for a sender/receiver track. */
- function filterStats(result, track, outbound) {
- var streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';
- var filteredResult = new Map();
- if (track === null) {
- return filteredResult;
- }
- var trackStats = [];
- result.forEach(function (value) {
- if (value.type === 'track' && value.trackIdentifier === track.id) {
- trackStats.push(value);
- }
- });
- trackStats.forEach(function (trackStat) {
- result.forEach(function (stats) {
- if (stats.type === streamStatsType && stats.trackId === trackStat.id) {
- walkStats(result, stats, filteredResult);
- }
- });
- });
- return filteredResult;
- }
- }, {}],
- 16: [function (require, module, exports) {
- var SDPUtils = require('sdp');
- function fixStatsType(stat) {
- return {
- inboundrtp: 'inbound-rtp',
- outboundrtp: 'outbound-rtp',
- candidatepair: 'candidate-pair',
- localcandidate: 'local-candidate',
- remotecandidate: 'remote-candidate'
- }[stat.type] || stat.type;
- }
- function writeMediaSection(transceiver, caps, type, stream, dtlsRole) {
- var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);
- // Map ICE parameters (ufrag, pwd) to SDP.
- sdp += SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());
- // Map DTLS parameters to SDP.
- sdp += SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : dtlsRole || 'active');
- sdp += 'a=mid:' + transceiver.mid + '\r\n';
- if (transceiver.rtpSender && transceiver.rtpReceiver) {
- sdp += 'a=sendrecv\r\n';
- } else if (transceiver.rtpSender) {
- sdp += 'a=sendonly\r\n';
- } else if (transceiver.rtpReceiver) {
- sdp += 'a=recvonly\r\n';
- } else {
- sdp += 'a=inactive\r\n';
- }
- if (transceiver.rtpSender) {
- var trackId = transceiver.rtpSender._initialTrackId || transceiver.rtpSender.track.id;
- transceiver.rtpSender._initialTrackId = trackId;
- // spec.
- var msid = 'msid:' + (stream ? stream.id : '-') + ' ' + trackId + '\r\n';
- sdp += 'a=' + msid;
- // for Chrome. Legacy should no longer be required.
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid;
- // RTX
- if (transceiver.sendEncodingParameters[0].rtx) {
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid;
- sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n';
- }
- }
- // FIXME: this should be written by writeRtpDescription.
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
- if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
- }
- return sdp;
- }
- // Edge does not like
- // 1) stun: filtered after 14393 unless ?transport=udp is present
- // 2) turn: that does not have all of turn:host:port?transport=udp
- // 3) turn: with ipv6 addresses
- // 4) turn: occurring muliple times
- function filterIceServers(iceServers, edgeVersion) {
- var hasTurn = false;
- iceServers = JSON.parse(JSON.stringify(iceServers));
- return iceServers.filter(function (server) {
- if (server && (server.urls || server.url)) {
- var urls = server.urls || server.url;
- if (server.url && !server.urls) {
- console.warn('RTCIceServer.url is deprecated! Use urls instead.');
- }
- var isString = typeof urls === 'string';
- if (isString) {
- urls = [urls];
- }
- urls = urls.filter(function (url) {
- var validTurn = url.indexOf('turn:') === 0 && url.indexOf('transport=udp') !== -1 && url.indexOf('turn:[') === -1 && !hasTurn;
- if (validTurn) {
- hasTurn = true;
- return true;
- }
- return url.indexOf('stun:') === 0 && edgeVersion >= 14393 && url.indexOf('?transport=udp') === -1;
- });
- delete server.url;
- server.urls = isString ? urls[0] : urls;
- return !!urls.length;
- }
- });
- }
- // Determines the intersection of local and remote capabilities.
- function getCommonCapabilities(localCapabilities, remoteCapabilities) {
- var commonCapabilities = {
- codecs: [],
- headerExtensions: [],
- fecMechanisms: []
- };
- var findCodecByPayloadType = function findCodecByPayloadType(pt, codecs) {
- pt = parseInt(pt, 10);
- for (var i = 0; i < codecs.length; i++) {
- if (codecs[i].payloadType === pt || codecs[i].preferredPayloadType === pt) {
- return codecs[i];
- }
- }
- };
- var rtxCapabilityMatches = function rtxCapabilityMatches(lRtx, rRtx, lCodecs, rCodecs) {
- var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs);
- var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs);
- return lCodec && rCodec && lCodec.name.toLowerCase() === rCodec.name.toLowerCase();
- };
- localCapabilities.codecs.forEach(function (lCodec) {
- for (var i = 0; i < remoteCapabilities.codecs.length; i++) {
- var rCodec = remoteCapabilities.codecs[i];
- if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() && lCodec.clockRate === rCodec.clockRate) {
- if (lCodec.name.toLowerCase() === 'rtx' && lCodec.parameters && rCodec.parameters.apt) {
- // for RTX we need to find the local rtx that has a apt
- // which points to the same local codec as the remote one.
- if (!rtxCapabilityMatches(lCodec, rCodec, localCapabilities.codecs, remoteCapabilities.codecs)) {
- continue;
- }
- }
- rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy
- // number of channels is the highest common number of channels
- rCodec.numChannels = Math.min(lCodec.numChannels, rCodec.numChannels);
- // push rCodec so we reply with offerer payload type
- commonCapabilities.codecs.push(rCodec);
- // determine common feedback mechanisms
- rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function (fb) {
- for (var j = 0; j < lCodec.rtcpFeedback.length; j++) {
- if (lCodec.rtcpFeedback[j].type === fb.type && lCodec.rtcpFeedback[j].parameter === fb.parameter) {
- return true;
- }
- }
- return false;
- });
- // FIXME: also need to determine .parameters
- // see https://github.com/openpeer/ortc/issues/569
- break;
- }
- }
- });
- localCapabilities.headerExtensions.forEach(function (lHeaderExtension) {
- for (var i = 0; i < remoteCapabilities.headerExtensions.length; i++) {
- var rHeaderExtension = remoteCapabilities.headerExtensions[i];
- if (lHeaderExtension.uri === rHeaderExtension.uri) {
- commonCapabilities.headerExtensions.push(rHeaderExtension);
- break;
- }
- }
- });
- // FIXME: fecMechanisms
- return commonCapabilities;
- }
- // is action=setLocalDescription with type allowed in signalingState
- function isActionAllowedInSignalingState(action, type, signalingState) {
- return {
- offer: {
- setLocalDescription: ['stable', 'have-local-offer'],
- setRemoteDescription: ['stable', 'have-remote-offer']
- },
- answer: {
- setLocalDescription: ['have-remote-offer', 'have-local-pranswer'],
- setRemoteDescription: ['have-local-offer', 'have-remote-pranswer']
- }
- }[type][action].indexOf(signalingState) !== -1;
- }
- function maybeAddCandidate(iceTransport, candidate) {
- // Edge's internal representation adds some fields therefore
- // not all fieldѕ are taken into account.
- var alreadyAdded = iceTransport.getRemoteCandidates().find(function (remoteCandidate) {
- 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;
- });
- if (!alreadyAdded) {
- iceTransport.addRemoteCandidate(candidate);
- }
- return !alreadyAdded;
- }
- function makeError(name, description) {
- var e = new Error(description);
- e.name = name;
- // legacy error codes from https://heycam.github.io/webidl/#idl-DOMException-error-names
- e.code = {
- NotSupportedError: 9,
- InvalidStateError: 11,
- InvalidAccessError: 15,
- TypeError: undefined,
- OperationError: undefined
- }[name];
- return e;
- }
- module.exports = function (window, edgeVersion) {
- // https://w3c.github.io/mediacapture-main/#mediastream
- // Helper function to add the track to the stream and
- // dispatch the event ourselves.
- function addTrackToStreamAndFireEvent(track, stream) {
- stream.addTrack(track);
- stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack', {
- track: track
- }));
- }
- function removeTrackFromStreamAndFireEvent(track, stream) {
- stream.removeTrack(track);
- stream.dispatchEvent(new window.MediaStreamTrackEvent('removetrack', {
- track: track
- }));
- }
- function fireAddTrack(pc, track, receiver, streams) {
- var trackEvent = new Event('track');
- trackEvent.track = track;
- trackEvent.receiver = receiver;
- trackEvent.transceiver = {
- receiver: receiver
- };
- trackEvent.streams = streams;
- window.setTimeout(function () {
- pc._dispatchEvent('track', trackEvent);
- });
- }
- var RTCPeerConnection = function RTCPeerConnection(config) {
- var pc = this;
- var _eventTarget = document.createDocumentFragment();
- ['addEventListener', 'removeEventListener', 'dispatchEvent'].forEach(function (method) {
- pc[method] = _eventTarget[method].bind(_eventTarget);
- });
- this.canTrickleIceCandidates = null;
- this.needNegotiation = false;
- this.localStreams = [];
- this.remoteStreams = [];
- this._localDescription = null;
- this._remoteDescription = null;
- this.signalingState = 'stable';
- this.iceConnectionState = 'new';
- this.connectionState = 'new';
- this.iceGatheringState = 'new';
- config = JSON.parse(JSON.stringify(config || {}));
- this.usingBundle = config.bundlePolicy === 'max-bundle';
- if (config.rtcpMuxPolicy === 'negotiate') {
- throw makeError('NotSupportedError', 'rtcpMuxPolicy \'negotiate\' is not supported');
- } else if (!config.rtcpMuxPolicy) {
- config.rtcpMuxPolicy = 'require';
- }
- switch (config.iceTransportPolicy) {
- case 'all':
- case 'relay':
- break;
- default:
- config.iceTransportPolicy = 'all';
- break;
- }
- switch (config.bundlePolicy) {
- case 'balanced':
- case 'max-compat':
- case 'max-bundle':
- break;
- default:
- config.bundlePolicy = 'balanced';
- break;
- }
- config.iceServers = filterIceServers(config.iceServers || [], edgeVersion);
- this._iceGatherers = [];
- if (config.iceCandidatePoolSize) {
- for (var i = config.iceCandidatePoolSize; i > 0; i--) {
- this._iceGatherers.push(new window.RTCIceGatherer({
- iceServers: config.iceServers,
- gatherPolicy: config.iceTransportPolicy
- }));
- }
- } else {
- config.iceCandidatePoolSize = 0;
- }
- this._config = config;
- // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ...
- // everything that is needed to describe a SDP m-line.
- this.transceivers = [];
- this._sdpSessionId = SDPUtils.generateSessionId();
- this._sdpSessionVersion = 0;
- this._dtlsRole = undefined; // role for a=setup to use in answers.
- this._isClosed = false;
- };
- Object.defineProperty(RTCPeerConnection.prototype, 'localDescription', {
- configurable: true,
- get: function get() {
- return this._localDescription;
- }
- });
- Object.defineProperty(RTCPeerConnection.prototype, 'remoteDescription', {
- configurable: true,
- get: function get() {
- return this._remoteDescription;
- }
- });
- // set up event handlers on prototype
- RTCPeerConnection.prototype.onicecandidate = null;
- RTCPeerConnection.prototype.onaddstream = null;
- RTCPeerConnection.prototype.ontrack = null;
- RTCPeerConnection.prototype.onremovestream = null;
- RTCPeerConnection.prototype.onsignalingstatechange = null;
- RTCPeerConnection.prototype.oniceconnectionstatechange = null;
- RTCPeerConnection.prototype.onconnectionstatechange = null;
- RTCPeerConnection.prototype.onicegatheringstatechange = null;
- RTCPeerConnection.prototype.onnegotiationneeded = null;
- RTCPeerConnection.prototype.ondatachannel = null;
- RTCPeerConnection.prototype._dispatchEvent = function (name, event) {
- if (this._isClosed) {
- return;
- }
- this.dispatchEvent(event);
- if (typeof this['on' + name] === 'function') {
- this['on' + name](event);
- }
- };
- RTCPeerConnection.prototype._emitGatheringStateChange = function () {
- var event = new Event('icegatheringstatechange');
- this._dispatchEvent('icegatheringstatechange', event);
- };
- RTCPeerConnection.prototype.getConfiguration = function () {
- return this._config;
- };
- RTCPeerConnection.prototype.getLocalStreams = function () {
- return this.localStreams;
- };
- RTCPeerConnection.prototype.getRemoteStreams = function () {
- return this.remoteStreams;
- };
- // internal helper to create a transceiver object.
- // (which is not yet the same as the WebRTC 1.0 transceiver)
- RTCPeerConnection.prototype._createTransceiver = function (kind, doNotAdd) {
- var hasBundleTransport = this.transceivers.length > 0;
- var transceiver = {
- track: null,
- iceGatherer: null,
- iceTransport: null,
- dtlsTransport: null,
- localCapabilities: null,
- remoteCapabilities: null,
- rtpSender: null,
- rtpReceiver: null,
- kind: kind,
- mid: null,
- sendEncodingParameters: null,
- recvEncodingParameters: null,
- stream: null,
- associatedRemoteMediaStreams: [],
- wantReceive: true
- };
- if (this.usingBundle && hasBundleTransport) {
- transceiver.iceTransport = this.transceivers[0].iceTransport;
- transceiver.dtlsTransport = this.transceivers[0].dtlsTransport;
- } else {
- var transports = this._createIceAndDtlsTransports();
- transceiver.iceTransport = transports.iceTransport;
- transceiver.dtlsTransport = transports.dtlsTransport;
- }
- if (!doNotAdd) {
- this.transceivers.push(transceiver);
- }
- return transceiver;
- };
- RTCPeerConnection.prototype.addTrack = function (track, stream) {
- if (this._isClosed) {
- throw makeError('InvalidStateError', 'Attempted to call addTrack on a closed peerconnection.');
- }
- var alreadyExists = this.transceivers.find(function (s) {
- return s.track === track;
- });
- if (alreadyExists) {
- throw makeError('InvalidAccessError', 'Track already exists.');
- }
- var transceiver;
- for (var i = 0; i < this.transceivers.length; i++) {
- if (!this.transceivers[i].track && this.transceivers[i].kind === track.kind) {
- transceiver = this.transceivers[i];
- }
- }
- if (!transceiver) {
- transceiver = this._createTransceiver(track.kind);
- }
- this._maybeFireNegotiationNeeded();
- if (this.localStreams.indexOf(stream) === -1) {
- this.localStreams.push(stream);
- }
- transceiver.track = track;
- transceiver.stream = stream;
- transceiver.rtpSender = new window.RTCRtpSender(track, transceiver.dtlsTransport);
- return transceiver.rtpSender;
- };
- RTCPeerConnection.prototype.addStream = function (stream) {
- var pc = this;
- if (edgeVersion >= 15025) {
- stream.getTracks().forEach(function (track) {
- pc.addTrack(track, stream);
- });
- } else {
- // Clone is necessary for local demos mostly, attaching directly
- // to two different senders does not work (build 10547).
- // Fixed in 15025 (or earlier)
- var clonedStream = stream.clone();
- stream.getTracks().forEach(function (track, idx) {
- var clonedTrack = clonedStream.getTracks()[idx];
- track.addEventListener('enabled', function (event) {
- clonedTrack.enabled = event.enabled;
- });
- });
- clonedStream.getTracks().forEach(function (track) {
- pc.addTrack(track, clonedStream);
- });
- }
- };
- RTCPeerConnection.prototype.removeTrack = function (sender) {
- if (this._isClosed) {
- throw makeError('InvalidStateError', 'Attempted to call removeTrack on a closed peerconnection.');
- }
- if (!(sender instanceof window.RTCRtpSender)) {
- throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.');
- }
- var transceiver = this.transceivers.find(function (t) {
- return t.rtpSender === sender;
- });
- if (!transceiver) {
- throw makeError('InvalidAccessError', 'Sender was not created by this connection.');
- }
- var stream = transceiver.stream;
- transceiver.rtpSender.stop();
- transceiver.rtpSender = null;
- transceiver.track = null;
- transceiver.stream = null;
- // remove the stream from the set of local streams
- var localStreams = this.transceivers.map(function (t) {
- return t.stream;
- });
- if (localStreams.indexOf(stream) === -1 && this.localStreams.indexOf(stream) > -1) {
- this.localStreams.splice(this.localStreams.indexOf(stream), 1);
- }
- this._maybeFireNegotiationNeeded();
- };
- RTCPeerConnection.prototype.removeStream = function (stream) {
- var pc = this;
- stream.getTracks().forEach(function (track) {
- var sender = pc.getSenders().find(function (s) {
- return s.track === track;
- });
- if (sender) {
- pc.removeTrack(sender);
- }
- });
- };
- RTCPeerConnection.prototype.getSenders = function () {
- return this.transceivers.filter(function (transceiver) {
- return !!transceiver.rtpSender;
- }).map(function (transceiver) {
- return transceiver.rtpSender;
- });
- };
- RTCPeerConnection.prototype.getReceivers = function () {
- return this.transceivers.filter(function (transceiver) {
- return !!transceiver.rtpReceiver;
- }).map(function (transceiver) {
- return transceiver.rtpReceiver;
- });
- };
- RTCPeerConnection.prototype._createIceGatherer = function (sdpMLineIndex, usingBundle) {
- var pc = this;
- if (usingBundle && sdpMLineIndex > 0) {
- return this.transceivers[0].iceGatherer;
- } else if (this._iceGatherers.length) {
- return this._iceGatherers.shift();
- }
- var iceGatherer = new window.RTCIceGatherer({
- iceServers: this._config.iceServers,
- gatherPolicy: this._config.iceTransportPolicy
- });
- Object.defineProperty(iceGatherer, 'state', {
- value: 'new',
- writable: true
- });
- this.transceivers[sdpMLineIndex].bufferedCandidateEvents = [];
- this.transceivers[sdpMLineIndex].bufferCandidates = function (event) {
- var end = !event.candidate || Object.keys(event.candidate).length === 0;
- // polyfill since RTCIceGatherer.state is not implemented in
- // Edge 10547 yet.
- iceGatherer.state = end ? 'completed' : 'gathering';
- if (pc.transceivers[sdpMLineIndex].bufferedCandidateEvents !== null) {
- pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event);
- }
- };
- iceGatherer.addEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates);
- return iceGatherer;
- };
- // start gathering from an RTCIceGatherer.
- RTCPeerConnection.prototype._gather = function (mid, sdpMLineIndex) {
- var pc = this;
- var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
- if (iceGatherer.onlocalcandidate) {
- return;
- }
- var bufferedCandidateEvents = this.transceivers[sdpMLineIndex].bufferedCandidateEvents;
- this.transceivers[sdpMLineIndex].bufferedCandidateEvents = null;
- iceGatherer.removeEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates);
- iceGatherer.onlocalcandidate = function (evt) {
- if (pc.usingBundle && sdpMLineIndex > 0) {
- // if we know that we use bundle we can drop candidates with
- // ѕdpMLineIndex > 0. If we don't do this then our state gets
- // confused since we dispose the extra ice gatherer.
- return;
- }
- var event = new Event('icecandidate');
- event.candidate = {
- sdpMid: mid,
- sdpMLineIndex: sdpMLineIndex
- };
- var cand = evt.candidate;
- // Edge emits an empty object for RTCIceCandidateComplete‥
- var end = !cand || Object.keys(cand).length === 0;
- if (end) {
- // polyfill since RTCIceGatherer.state is not implemented in
- // Edge 10547 yet.
- if (iceGatherer.state === 'new' || iceGatherer.state === 'gathering') {
- iceGatherer.state = 'completed';
- }
- } else {
- if (iceGatherer.state === 'new') {
- iceGatherer.state = 'gathering';
- }
- // RTCIceCandidate doesn't have a component, needs to be added
- cand.component = 1;
- // also the usernameFragment. TODO: update SDP to take both variants.
- cand.ufrag = iceGatherer.getLocalParameters().usernameFragment;
- var serializedCandidate = SDPUtils.writeCandidate(cand);
- event.candidate = Object.assign(event.candidate, SDPUtils.parseCandidate(serializedCandidate));
- event.candidate.candidate = serializedCandidate;
- event.candidate.toJSON = function () {
- return {
- candidate: event.candidate.candidate,
- sdpMid: event.candidate.sdpMid,
- sdpMLineIndex: event.candidate.sdpMLineIndex,
- usernameFragment: event.candidate.usernameFragment
- };
- };
- }
- // update local description.
- var sections = SDPUtils.getMediaSections(pc._localDescription.sdp);
- if (!end) {
- sections[event.candidate.sdpMLineIndex] += 'a=' + event.candidate.candidate + '\r\n';
- } else {
- sections[event.candidate.sdpMLineIndex] += 'a=end-of-candidates\r\n';
- }
- pc._localDescription.sdp = SDPUtils.getDescription(pc._localDescription.sdp) + sections.join('');
- var complete = pc.transceivers.every(function (transceiver) {
- return transceiver.iceGatherer && transceiver.iceGatherer.state === 'completed';
- });
- if (pc.iceGatheringState !== 'gathering') {
- pc.iceGatheringState = 'gathering';
- pc._emitGatheringStateChange();
- }
- // Emit candidate. Also emit null candidate when all gatherers are
- // complete.
- if (!end) {
- pc._dispatchEvent('icecandidate', event);
- }
- if (complete) {
- pc._dispatchEvent('icecandidate', new Event('icecandidate'));
- pc.iceGatheringState = 'complete';
- pc._emitGatheringStateChange();
- }
- };
- // emit already gathered candidates.
- window.setTimeout(function () {
- bufferedCandidateEvents.forEach(function (e) {
- iceGatherer.onlocalcandidate(e);
- });
- }, 0);
- };
- // Create ICE transport and DTLS transport.
- RTCPeerConnection.prototype._createIceAndDtlsTransports = function () {
- var pc = this;
- var iceTransport = new window.RTCIceTransport(null);
- iceTransport.onicestatechange = function () {
- pc._updateIceConnectionState();
- pc._updateConnectionState();
- };
- var dtlsTransport = new window.RTCDtlsTransport(iceTransport);
- dtlsTransport.ondtlsstatechange = function () {
- pc._updateConnectionState();
- };
- dtlsTransport.onerror = function () {
- // onerror does not set state to failed by itself.
- Object.defineProperty(dtlsTransport, 'state', {
- value: 'failed',
- writable: true
- });
- pc._updateConnectionState();
- };
- return {
- iceTransport: iceTransport,
- dtlsTransport: dtlsTransport
- };
- };
- // Destroy ICE gatherer, ICE transport and DTLS transport.
- // Without triggering the callbacks.
- RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function (sdpMLineIndex) {
- var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
- if (iceGatherer) {
- delete iceGatherer.onlocalcandidate;
- delete this.transceivers[sdpMLineIndex].iceGatherer;
- }
- var iceTransport = this.transceivers[sdpMLineIndex].iceTransport;
- if (iceTransport) {
- delete iceTransport.onicestatechange;
- delete this.transceivers[sdpMLineIndex].iceTransport;
- }
- var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport;
- if (dtlsTransport) {
- delete dtlsTransport.ondtlsstatechange;
- delete dtlsTransport.onerror;
- delete this.transceivers[sdpMLineIndex].dtlsTransport;
- }
- };
- // Start the RTP Sender and Receiver for a transceiver.
- RTCPeerConnection.prototype._transceive = function (transceiver, send, recv) {
- var params = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
- if (send && transceiver.rtpSender) {
- params.encodings = transceiver.sendEncodingParameters;
- params.rtcp = {
- cname: SDPUtils.localCName,
- compound: transceiver.rtcpParameters.compound
- };
- if (transceiver.recvEncodingParameters.length) {
- params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc;
- }
- transceiver.rtpSender.send(params);
- }
- if (recv && transceiver.rtpReceiver && params.codecs.length > 0) {
- // remove RTX field in Edge 14942
- if (transceiver.kind === 'video' && transceiver.recvEncodingParameters && edgeVersion < 15019) {
- transceiver.recvEncodingParameters.forEach(function (p) {
- delete p.rtx;
- });
- }
- if (transceiver.recvEncodingParameters.length) {
- params.encodings = transceiver.recvEncodingParameters;
- } else {
- params.encodings = [{}];
- }
- params.rtcp = {
- compound: transceiver.rtcpParameters.compound
- };
- if (transceiver.rtcpParameters.cname) {
- params.rtcp.cname = transceiver.rtcpParameters.cname;
- }
- if (transceiver.sendEncodingParameters.length) {
- params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc;
- }
- transceiver.rtpReceiver.receive(params);
- }
- };
- RTCPeerConnection.prototype.setLocalDescription = function (description) {
- var pc = this;
- // Note: pranswer is not supported.
- if (['offer', 'answer'].indexOf(description.type) === -1) {
- return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"'));
- }
- if (!isActionAllowedInSignalingState('setLocalDescription', description.type, pc.signalingState) || pc._isClosed) {
- return Promise.reject(makeError('InvalidStateError', 'Can not set local ' + description.type + ' in state ' + pc.signalingState));
- }
- var sections;
- var sessionpart;
- if (description.type === 'offer') {
- // VERY limited support for SDP munging. Limited to:
- // * changing the order of codecs
- sections = SDPUtils.splitSections(description.sdp);
- sessionpart = sections.shift();
- sections.forEach(function (mediaSection, sdpMLineIndex) {
- var caps = SDPUtils.parseRtpParameters(mediaSection);
- pc.transceivers[sdpMLineIndex].localCapabilities = caps;
- });
- pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
- pc._gather(transceiver.mid, sdpMLineIndex);
- });
- } else if (description.type === 'answer') {
- sections = SDPUtils.splitSections(pc._remoteDescription.sdp);
- sessionpart = sections.shift();
- var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0;
- sections.forEach(function (mediaSection, sdpMLineIndex) {
- var transceiver = pc.transceivers[sdpMLineIndex];
- var iceGatherer = transceiver.iceGatherer;
- var iceTransport = transceiver.iceTransport;
- var dtlsTransport = transceiver.dtlsTransport;
- var localCapabilities = transceiver.localCapabilities;
- var remoteCapabilities = transceiver.remoteCapabilities;
- // treat bundle-only as not-rejected.
- var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;
- if (!rejected && !transceiver.rejected) {
- var remoteIceParameters = SDPUtils.getIceParameters(mediaSection, sessionpart);
- var remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection, sessionpart);
- if (isIceLite) {
- remoteDtlsParameters.role = 'server';
- }
- if (!pc.usingBundle || sdpMLineIndex === 0) {
- pc._gather(transceiver.mid, sdpMLineIndex);
- if (iceTransport.state === 'new') {
- iceTransport.start(iceGatherer, remoteIceParameters, isIceLite ? 'controlling' : 'controlled');
- }
- if (dtlsTransport.state === 'new') {
- dtlsTransport.start(remoteDtlsParameters);
- }
- }
- // Calculate intersection of capabilities.
- var params = getCommonCapabilities(localCapabilities, remoteCapabilities);
- // Start the RTCRtpSender. The RTCRtpReceiver for this
- // transceiver has already been started in setRemoteDescription.
- pc._transceive(transceiver, params.codecs.length > 0, false);
- }
- });
- }
- pc._localDescription = {
- type: description.type,
- sdp: description.sdp
- };
- if (description.type === 'offer') {
- pc._updateSignalingState('have-local-offer');
- } else {
- pc._updateSignalingState('stable');
- }
- return Promise.resolve();
- };
- RTCPeerConnection.prototype.setRemoteDescription = function (description) {
- var pc = this;
- // Note: pranswer is not supported.
- if (['offer', 'answer'].indexOf(description.type) === -1) {
- return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"'));
- }
- if (!isActionAllowedInSignalingState('setRemoteDescription', description.type, pc.signalingState) || pc._isClosed) {
- return Promise.reject(makeError('InvalidStateError', 'Can not set remote ' + description.type + ' in state ' + pc.signalingState));
- }
- var streams = {};
- pc.remoteStreams.forEach(function (stream) {
- streams[stream.id] = stream;
- });
- var receiverList = [];
- var sections = SDPUtils.splitSections(description.sdp);
- var sessionpart = sections.shift();
- var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0;
- var usingBundle = SDPUtils.matchPrefix(sessionpart, 'a=group:BUNDLE ').length > 0;
- pc.usingBundle = usingBundle;
- var iceOptions = SDPUtils.matchPrefix(sessionpart, 'a=ice-options:')[0];
- if (iceOptions) {
- pc.canTrickleIceCandidates = iceOptions.substr(14).split(' ').indexOf('trickle') >= 0;
- } else {
- pc.canTrickleIceCandidates = false;
- }
- sections.forEach(function (mediaSection, sdpMLineIndex) {
- var lines = SDPUtils.splitLines(mediaSection);
- var kind = SDPUtils.getKind(mediaSection);
- // treat bundle-only as not-rejected.
- var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;
- var protocol = lines[0].substr(2).split(' ')[2];
- var direction = SDPUtils.getDirection(mediaSection, sessionpart);
- var remoteMsid = SDPUtils.parseMsid(mediaSection);
- var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier();
- // Reject datachannels which are not implemented yet.
- if (rejected || kind === 'application' && (protocol === 'DTLS/SCTP' || protocol === 'UDP/DTLS/SCTP')) {
- // TODO: this is dangerous in the case where a non-rejected m-line
- // becomes rejected.
- pc.transceivers[sdpMLineIndex] = {
- mid: mid,
- kind: kind,
- protocol: protocol,
- rejected: true
- };
- return;
- }
- if (!rejected && pc.transceivers[sdpMLineIndex] && pc.transceivers[sdpMLineIndex].rejected) {
- // recycle a rejected transceiver.
- pc.transceivers[sdpMLineIndex] = pc._createTransceiver(kind, true);
- }
- var transceiver;
- var iceGatherer;
- var iceTransport;
- var dtlsTransport;
- var rtpReceiver;
- var sendEncodingParameters;
- var recvEncodingParameters;
- var localCapabilities;
- var track;
- // FIXME: ensure the mediaSection has rtcp-mux set.
- var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);
- var remoteIceParameters;
- var remoteDtlsParameters;
- if (!rejected) {
- remoteIceParameters = SDPUtils.getIceParameters(mediaSection, sessionpart);
- remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection, sessionpart);
- remoteDtlsParameters.role = 'client';
- }
- recvEncodingParameters = SDPUtils.parseRtpEncodingParameters(mediaSection);
- var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection);
- var isComplete = SDPUtils.matchPrefix(mediaSection, 'a=end-of-candidates', sessionpart).length > 0;
- var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:').map(function (cand) {
- return SDPUtils.parseCandidate(cand);
- }).filter(function (cand) {
- return cand.component === 1;
- });
- // Check if we can use BUNDLE and dispose transports.
- if ((description.type === 'offer' || description.type === 'answer') && !rejected && usingBundle && sdpMLineIndex > 0 && pc.transceivers[sdpMLineIndex]) {
- pc._disposeIceAndDtlsTransports(sdpMLineIndex);
- pc.transceivers[sdpMLineIndex].iceGatherer = pc.transceivers[0].iceGatherer;
- pc.transceivers[sdpMLineIndex].iceTransport = pc.transceivers[0].iceTransport;
- pc.transceivers[sdpMLineIndex].dtlsTransport = pc.transceivers[0].dtlsTransport;
- if (pc.transceivers[sdpMLineIndex].rtpSender) {
- pc.transceivers[sdpMLineIndex].rtpSender.setTransport(pc.transceivers[0].dtlsTransport);
- }
- if (pc.transceivers[sdpMLineIndex].rtpReceiver) {
- pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(pc.transceivers[0].dtlsTransport);
- }
- }
- if (description.type === 'offer' && !rejected) {
- transceiver = pc.transceivers[sdpMLineIndex] || pc._createTransceiver(kind);
- transceiver.mid = mid;
- if (!transceiver.iceGatherer) {
- transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, usingBundle);
- }
- if (cands.length && transceiver.iceTransport.state === 'new') {
- if (isComplete && (!usingBundle || sdpMLineIndex === 0)) {
- transceiver.iceTransport.setRemoteCandidates(cands);
- } else {
- cands.forEach(function (candidate) {
- maybeAddCandidate(transceiver.iceTransport, candidate);
- });
- }
- }
- localCapabilities = window.RTCRtpReceiver.getCapabilities(kind);
- // filter RTX until additional stuff needed for RTX is implemented
- // in adapter.js
- if (edgeVersion < 15019) {
- localCapabilities.codecs = localCapabilities.codecs.filter(function (codec) {
- return codec.name !== 'rtx';
- });
- }
- sendEncodingParameters = transceiver.sendEncodingParameters || [{
- ssrc: (2 * sdpMLineIndex + 2) * 1001
- }];
- // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
- var isNewTrack = false;
- if (direction === 'sendrecv' || direction === 'sendonly') {
- isNewTrack = !transceiver.rtpReceiver;
- rtpReceiver = transceiver.rtpReceiver || new window.RTCRtpReceiver(transceiver.dtlsTransport, kind);
- if (isNewTrack) {
- var stream;
- track = rtpReceiver.track;
- // FIXME: does not work with Plan B.
- if (remoteMsid && remoteMsid.stream === '-') ; else if (remoteMsid) {
- if (!streams[remoteMsid.stream]) {
- streams[remoteMsid.stream] = new window.MediaStream();
- Object.defineProperty(streams[remoteMsid.stream], 'id', {
- get: function get() {
- return remoteMsid.stream;
- }
- });
- }
- Object.defineProperty(track, 'id', {
- get: function get() {
- return remoteMsid.track;
- }
- });
- stream = streams[remoteMsid.stream];
- } else {
- if (!streams["default"]) {
- streams["default"] = new window.MediaStream();
- }
- stream = streams["default"];
- }
- if (stream) {
- addTrackToStreamAndFireEvent(track, stream);
- transceiver.associatedRemoteMediaStreams.push(stream);
- }
- receiverList.push([track, rtpReceiver, stream]);
- }
- } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track) {
- transceiver.associatedRemoteMediaStreams.forEach(function (s) {
- var nativeTrack = s.getTracks().find(function (t) {
- return t.id === transceiver.rtpReceiver.track.id;
- });
- if (nativeTrack) {
- removeTrackFromStreamAndFireEvent(nativeTrack, s);
- }
- });
- transceiver.associatedRemoteMediaStreams = [];
- }
- transceiver.localCapabilities = localCapabilities;
- transceiver.remoteCapabilities = remoteCapabilities;
- transceiver.rtpReceiver = rtpReceiver;
- transceiver.rtcpParameters = rtcpParameters;
- transceiver.sendEncodingParameters = sendEncodingParameters;
- transceiver.recvEncodingParameters = recvEncodingParameters;
- // Start the RTCRtpReceiver now. The RTPSender is started in
- // setLocalDescription.
- pc._transceive(pc.transceivers[sdpMLineIndex], false, isNewTrack);
- } else if (description.type === 'answer' && !rejected) {
- transceiver = pc.transceivers[sdpMLineIndex];
- iceGatherer = transceiver.iceGatherer;
- iceTransport = transceiver.iceTransport;
- dtlsTransport = transceiver.dtlsTransport;
- rtpReceiver = transceiver.rtpReceiver;
- sendEncodingParameters = transceiver.sendEncodingParameters;
- localCapabilities = transceiver.localCapabilities;
- pc.transceivers[sdpMLineIndex].recvEncodingParameters = recvEncodingParameters;
- pc.transceivers[sdpMLineIndex].remoteCapabilities = remoteCapabilities;
- pc.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters;
- if (cands.length && iceTransport.state === 'new') {
- if ((isIceLite || isComplete) && (!usingBundle || sdpMLineIndex === 0)) {
- iceTransport.setRemoteCandidates(cands);
- } else {
- cands.forEach(function (candidate) {
- maybeAddCandidate(transceiver.iceTransport, candidate);
- });
- }
- }
- if (!usingBundle || sdpMLineIndex === 0) {
- if (iceTransport.state === 'new') {
- iceTransport.start(iceGatherer, remoteIceParameters, 'controlling');
- }
- if (dtlsTransport.state === 'new') {
- dtlsTransport.start(remoteDtlsParameters);
- }
- }
- // If the offer contained RTX but the answer did not,
- // remove RTX from sendEncodingParameters.
- var commonCapabilities = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
- var hasRtx = commonCapabilities.codecs.filter(function (c) {
- return c.name.toLowerCase() === 'rtx';
- }).length;
- if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
- delete transceiver.sendEncodingParameters[0].rtx;
- }
- pc._transceive(transceiver, direction === 'sendrecv' || direction === 'recvonly', direction === 'sendrecv' || direction === 'sendonly');
- // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
- if (rtpReceiver && (direction === 'sendrecv' || direction === 'sendonly')) {
- track = rtpReceiver.track;
- if (remoteMsid) {
- if (!streams[remoteMsid.stream]) {
- streams[remoteMsid.stream] = new window.MediaStream();
- }
- addTrackToStreamAndFireEvent(track, streams[remoteMsid.stream]);
- receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]);
- } else {
- if (!streams["default"]) {
- streams["default"] = new window.MediaStream();
- }
- addTrackToStreamAndFireEvent(track, streams["default"]);
- receiverList.push([track, rtpReceiver, streams["default"]]);
- }
- } else {
- // FIXME: actually the receiver should be created later.
- delete transceiver.rtpReceiver;
- }
- }
- });
- if (pc._dtlsRole === undefined) {
- pc._dtlsRole = description.type === 'offer' ? 'active' : 'passive';
- }
- pc._remoteDescription = {
- type: description.type,
- sdp: description.sdp
- };
- if (description.type === 'offer') {
- pc._updateSignalingState('have-remote-offer');
- } else {
- pc._updateSignalingState('stable');
- }
- Object.keys(streams).forEach(function (sid) {
- var stream = streams[sid];
- if (stream.getTracks().length) {
- if (pc.remoteStreams.indexOf(stream) === -1) {
- pc.remoteStreams.push(stream);
- var event = new Event('addstream');
- event.stream = stream;
- window.setTimeout(function () {
- pc._dispatchEvent('addstream', event);
- });
- }
- receiverList.forEach(function (item) {
- var track = item[0];
- var receiver = item[1];
- if (stream.id !== item[2].id) {
- return;
- }
- fireAddTrack(pc, track, receiver, [stream]);
- });
- }
- });
- receiverList.forEach(function (item) {
- if (item[2]) {
- return;
- }
- fireAddTrack(pc, item[0], item[1], []);
- });
- // check whether addIceCandidate({}) was called within four seconds after
- // setRemoteDescription.
- window.setTimeout(function () {
- if (!(pc && pc.transceivers)) {
- return;
- }
- pc.transceivers.forEach(function (transceiver) {
- if (transceiver.iceTransport && transceiver.iceTransport.state === 'new' && transceiver.iceTransport.getRemoteCandidates().length > 0) {
- console.warn('Timeout for addRemoteCandidate. Consider sending ' + 'an end-of-candidates notification');
- transceiver.iceTransport.addRemoteCandidate({});
- }
- });
- }, 4000);
- return Promise.resolve();
- };
- RTCPeerConnection.prototype.close = function () {
- this.transceivers.forEach(function (transceiver) {
- /* not yet
- if (transceiver.iceGatherer) {
- transceiver.iceGatherer.close();
- }
- */
- if (transceiver.iceTransport) {
- transceiver.iceTransport.stop();
- }
- if (transceiver.dtlsTransport) {
- transceiver.dtlsTransport.stop();
- }
- if (transceiver.rtpSender) {
- transceiver.rtpSender.stop();
- }
- if (transceiver.rtpReceiver) {
- transceiver.rtpReceiver.stop();
- }
- });
- // FIXME: clean up tracks, local streams, remote streams, etc
- this._isClosed = true;
- this._updateSignalingState('closed');
- };
- // Update the signaling state.
- RTCPeerConnection.prototype._updateSignalingState = function (newState) {
- this.signalingState = newState;
- var event = new Event('signalingstatechange');
- this._dispatchEvent('signalingstatechange', event);
- };
- // Determine whether to fire the negotiationneeded event.
- RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function () {
- var pc = this;
- if (this.signalingState !== 'stable' || this.needNegotiation === true) {
- return;
- }
- this.needNegotiation = true;
- window.setTimeout(function () {
- if (pc.needNegotiation) {
- pc.needNegotiation = false;
- var event = new Event('negotiationneeded');
- pc._dispatchEvent('negotiationneeded', event);
- }
- }, 0);
- };
- // Update the ice connection state.
- RTCPeerConnection.prototype._updateIceConnectionState = function () {
- var newState;
- var states = {
- 'new': 0,
- closed: 0,
- checking: 0,
- connected: 0,
- completed: 0,
- disconnected: 0,
- failed: 0
- };
- this.transceivers.forEach(function (transceiver) {
- if (transceiver.iceTransport && !transceiver.rejected) {
- states[transceiver.iceTransport.state]++;
- }
- });
- newState = 'new';
- if (states.failed > 0) {
- newState = 'failed';
- } else if (states.checking > 0) {
- newState = 'checking';
- } else if (states.disconnected > 0) {
- newState = 'disconnected';
- } else if (states["new"] > 0) {
- newState = 'new';
- } else if (states.connected > 0) {
- newState = 'connected';
- } else if (states.completed > 0) {
- newState = 'completed';
- }
- if (newState !== this.iceConnectionState) {
- this.iceConnectionState = newState;
- var event = new Event('iceconnectionstatechange');
- this._dispatchEvent('iceconnectionstatechange', event);
- }
- };
- // Update the connection state.
- RTCPeerConnection.prototype._updateConnectionState = function () {
- var newState;
- var states = {
- 'new': 0,
- closed: 0,
- connecting: 0,
- connected: 0,
- completed: 0,
- disconnected: 0,
- failed: 0
- };
- this.transceivers.forEach(function (transceiver) {
- if (transceiver.iceTransport && transceiver.dtlsTransport && !transceiver.rejected) {
- states[transceiver.iceTransport.state]++;
- states[transceiver.dtlsTransport.state]++;
- }
- });
- // ICETransport.completed and connected are the same for this purpose.
- states.connected += states.completed;
- newState = 'new';
- if (states.failed > 0) {
- newState = 'failed';
- } else if (states.connecting > 0) {
- newState = 'connecting';
- } else if (states.disconnected > 0) {
- newState = 'disconnected';
- } else if (states["new"] > 0) {
- newState = 'new';
- } else if (states.connected > 0) {
- newState = 'connected';
- }
- if (newState !== this.connectionState) {
- this.connectionState = newState;
- var event = new Event('connectionstatechange');
- this._dispatchEvent('connectionstatechange', event);
- }
- };
- RTCPeerConnection.prototype.createOffer = function () {
- var pc = this;
- if (pc._isClosed) {
- return Promise.reject(makeError('InvalidStateError', 'Can not call createOffer after close'));
- }
- var numAudioTracks = pc.transceivers.filter(function (t) {
- return t.kind === 'audio';
- }).length;
- var numVideoTracks = pc.transceivers.filter(function (t) {
- return t.kind === 'video';
- }).length;
- // Determine number of audio and video tracks we need to send/recv.
- var offerOptions = arguments[0];
- if (offerOptions) {
- // Reject Chrome legacy constraints.
- if (offerOptions.mandatory || offerOptions.optional) {
- throw new TypeError('Legacy mandatory/optional constraints not supported.');
- }
- if (offerOptions.offerToReceiveAudio !== undefined) {
- if (offerOptions.offerToReceiveAudio === true) {
- numAudioTracks = 1;
- } else if (offerOptions.offerToReceiveAudio === false) {
- numAudioTracks = 0;
- } else {
- numAudioTracks = offerOptions.offerToReceiveAudio;
- }
- }
- if (offerOptions.offerToReceiveVideo !== undefined) {
- if (offerOptions.offerToReceiveVideo === true) {
- numVideoTracks = 1;
- } else if (offerOptions.offerToReceiveVideo === false) {
- numVideoTracks = 0;
- } else {
- numVideoTracks = offerOptions.offerToReceiveVideo;
- }
- }
- }
- pc.transceivers.forEach(function (transceiver) {
- if (transceiver.kind === 'audio') {
- numAudioTracks--;
- if (numAudioTracks < 0) {
- transceiver.wantReceive = false;
- }
- } else if (transceiver.kind === 'video') {
- numVideoTracks--;
- if (numVideoTracks < 0) {
- transceiver.wantReceive = false;
- }
- }
- });
- // Create M-lines for recvonly streams.
- while (numAudioTracks > 0 || numVideoTracks > 0) {
- if (numAudioTracks > 0) {
- pc._createTransceiver('audio');
- numAudioTracks--;
- }
- if (numVideoTracks > 0) {
- pc._createTransceiver('video');
- numVideoTracks--;
- }
- }
- var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++);
- pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
- // For each track, create an ice gatherer, ice transport,
- // dtls transport, potentially rtpsender and rtpreceiver.
- var track = transceiver.track;
- var kind = transceiver.kind;
- var mid = transceiver.mid || SDPUtils.generateIdentifier();
- transceiver.mid = mid;
- if (!transceiver.iceGatherer) {
- transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, pc.usingBundle);
- }
- var localCapabilities = window.RTCRtpSender.getCapabilities(kind);
- // filter RTX until additional stuff needed for RTX is implemented
- // in adapter.js
- if (edgeVersion < 15019) {
- localCapabilities.codecs = localCapabilities.codecs.filter(function (codec) {
- return codec.name !== 'rtx';
- });
- }
- localCapabilities.codecs.forEach(function (codec) {
- // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552
- // by adding level-asymmetry-allowed=1
- if (codec.name === 'H264' && codec.parameters['level-asymmetry-allowed'] === undefined) {
- codec.parameters['level-asymmetry-allowed'] = '1';
- }
- // for subsequent offers, we might have to re-use the payload
- // type of the last offer.
- if (transceiver.remoteCapabilities && transceiver.remoteCapabilities.codecs) {
- transceiver.remoteCapabilities.codecs.forEach(function (remoteCodec) {
- if (codec.name.toLowerCase() === remoteCodec.name.toLowerCase() && codec.clockRate === remoteCodec.clockRate) {
- codec.preferredPayloadType = remoteCodec.payloadType;
- }
- });
- }
- });
- localCapabilities.headerExtensions.forEach(function (hdrExt) {
- var remoteExtensions = transceiver.remoteCapabilities && transceiver.remoteCapabilities.headerExtensions || [];
- remoteExtensions.forEach(function (rHdrExt) {
- if (hdrExt.uri === rHdrExt.uri) {
- hdrExt.id = rHdrExt.id;
- }
- });
- });
- // generate an ssrc now, to be used later in rtpSender.send
- var sendEncodingParameters = transceiver.sendEncodingParameters || [{
- ssrc: (2 * sdpMLineIndex + 1) * 1001
- }];
- if (track) {
- // add RTX
- if (edgeVersion >= 15019 && kind === 'video' && !sendEncodingParameters[0].rtx) {
- sendEncodingParameters[0].rtx = {
- ssrc: sendEncodingParameters[0].ssrc + 1
- };
- }
- }
- if (transceiver.wantReceive) {
- transceiver.rtpReceiver = new window.RTCRtpReceiver(transceiver.dtlsTransport, kind);
- }
- transceiver.localCapabilities = localCapabilities;
- transceiver.sendEncodingParameters = sendEncodingParameters;
- });
- // always offer BUNDLE and dispose on return if not supported.
- if (pc._config.bundlePolicy !== 'max-compat') {
- sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function (t) {
- return t.mid;
- }).join(' ') + '\r\n';
- }
- sdp += 'a=ice-options:trickle\r\n';
- pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
- sdp += writeMediaSection(transceiver, transceiver.localCapabilities, 'offer', transceiver.stream, pc._dtlsRole);
- sdp += 'a=rtcp-rsize\r\n';
- if (transceiver.iceGatherer && pc.iceGatheringState !== 'new' && (sdpMLineIndex === 0 || !pc.usingBundle)) {
- transceiver.iceGatherer.getLocalCandidates().forEach(function (cand) {
- cand.component = 1;
- sdp += 'a=' + SDPUtils.writeCandidate(cand) + '\r\n';
- });
- if (transceiver.iceGatherer.state === 'completed') {
- sdp += 'a=end-of-candidates\r\n';
- }
- }
- });
- var desc = new window.RTCSessionDescription({
- type: 'offer',
- sdp: sdp
- });
- return Promise.resolve(desc);
- };
- RTCPeerConnection.prototype.createAnswer = function () {
- var pc = this;
- if (pc._isClosed) {
- return Promise.reject(makeError('InvalidStateError', 'Can not call createAnswer after close'));
- }
- if (!(pc.signalingState === 'have-remote-offer' || pc.signalingState === 'have-local-pranswer')) {
- return Promise.reject(makeError('InvalidStateError', 'Can not call createAnswer in signalingState ' + pc.signalingState));
- }
- var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++);
- if (pc.usingBundle) {
- sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function (t) {
- return t.mid;
- }).join(' ') + '\r\n';
- }
- sdp += 'a=ice-options:trickle\r\n';
- var mediaSectionsInOffer = SDPUtils.getMediaSections(pc._remoteDescription.sdp).length;
- pc.transceivers.forEach(function (transceiver, sdpMLineIndex) {
- if (sdpMLineIndex + 1 > mediaSectionsInOffer) {
- return;
- }
- if (transceiver.rejected) {
- if (transceiver.kind === 'application') {
- if (transceiver.protocol === 'DTLS/SCTP') {
- // legacy fmt
- sdp += 'm=application 0 DTLS/SCTP 5000\r\n';
- } else {
- sdp += 'm=application 0 ' + transceiver.protocol + ' webrtc-datachannel\r\n';
- }
- } else if (transceiver.kind === 'audio') {
- sdp += 'm=audio 0 UDP/TLS/RTP/SAVPF 0\r\n' + 'a=rtpmap:0 PCMU/8000\r\n';
- } else if (transceiver.kind === 'video') {
- sdp += 'm=video 0 UDP/TLS/RTP/SAVPF 120\r\n' + 'a=rtpmap:120 VP8/90000\r\n';
- }
- sdp += 'c=IN IP4 0.0.0.0\r\n' + 'a=inactive\r\n' + 'a=mid:' + transceiver.mid + '\r\n';
- return;
- }
- // FIXME: look at direction.
- if (transceiver.stream) {
- var localTrack;
- if (transceiver.kind === 'audio') {
- localTrack = transceiver.stream.getAudioTracks()[0];
- } else if (transceiver.kind === 'video') {
- localTrack = transceiver.stream.getVideoTracks()[0];
- }
- if (localTrack) {
- // add RTX
- if (edgeVersion >= 15019 && transceiver.kind === 'video' && !transceiver.sendEncodingParameters[0].rtx) {
- transceiver.sendEncodingParameters[0].rtx = {
- ssrc: transceiver.sendEncodingParameters[0].ssrc + 1
- };
- }
- }
- }
- // Calculate intersection of capabilities.
- var commonCapabilities = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities);
- var hasRtx = commonCapabilities.codecs.filter(function (c) {
- return c.name.toLowerCase() === 'rtx';
- }).length;
- if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
- delete transceiver.sendEncodingParameters[0].rtx;
- }
- sdp += writeMediaSection(transceiver, commonCapabilities, 'answer', transceiver.stream, pc._dtlsRole);
- if (transceiver.rtcpParameters && transceiver.rtcpParameters.reducedSize) {
- sdp += 'a=rtcp-rsize\r\n';
- }
- });
- var desc = new window.RTCSessionDescription({
- type: 'answer',
- sdp: sdp
- });
- return Promise.resolve(desc);
- };
- RTCPeerConnection.prototype.addIceCandidate = function (candidate) {
- var pc = this;
- var sections;
- if (candidate && !(candidate.sdpMLineIndex !== undefined || candidate.sdpMid)) {
- return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required'));
- }
- // TODO: needs to go into ops queue.
- return new Promise(function (resolve, reject) {
- if (!pc._remoteDescription) {
- return reject(makeError('InvalidStateError', 'Can not add ICE candidate without a remote description'));
- } else if (!candidate || candidate.candidate === '') {
- for (var j = 0; j < pc.transceivers.length; j++) {
- if (pc.transceivers[j].rejected) {
- continue;
- }
- pc.transceivers[j].iceTransport.addRemoteCandidate({});
- sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
- sections[j] += 'a=end-of-candidates\r\n';
- pc._remoteDescription.sdp = SDPUtils.getDescription(pc._remoteDescription.sdp) + sections.join('');
- if (pc.usingBundle) {
- break;
- }
- }
- } else {
- var sdpMLineIndex = candidate.sdpMLineIndex;
- if (candidate.sdpMid) {
- for (var i = 0; i < pc.transceivers.length; i++) {
- if (pc.transceivers[i].mid === candidate.sdpMid) {
- sdpMLineIndex = i;
- break;
- }
- }
- }
- var transceiver = pc.transceivers[sdpMLineIndex];
- if (transceiver) {
- if (transceiver.rejected) {
- return resolve();
- }
- var cand = Object.keys(candidate.candidate).length > 0 ? SDPUtils.parseCandidate(candidate.candidate) : {};
- // Ignore Chrome's invalid candidates since Edge does not like them.
- if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) {
- return resolve();
- }
- // Ignore RTCP candidates, we assume RTCP-MUX.
- if (cand.component && cand.component !== 1) {
- return resolve();
- }
- // when using bundle, avoid adding candidates to the wrong
- // ice transport. And avoid adding candidates added in the SDP.
- if (sdpMLineIndex === 0 || sdpMLineIndex > 0 && transceiver.iceTransport !== pc.transceivers[0].iceTransport) {
- if (!maybeAddCandidate(transceiver.iceTransport, cand)) {
- return reject(makeError('OperationError', 'Can not add ICE candidate'));
- }
- }
- // update the remoteDescription.
- var candidateString = candidate.candidate.trim();
- if (candidateString.indexOf('a=') === 0) {
- candidateString = candidateString.substr(2);
- }
- sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
- sections[sdpMLineIndex] += 'a=' + (cand.type ? candidateString : 'end-of-candidates') + '\r\n';
- pc._remoteDescription.sdp = SDPUtils.getDescription(pc._remoteDescription.sdp) + sections.join('');
- } else {
- return reject(makeError('OperationError', 'Can not add ICE candidate'));
- }
- }
- resolve();
- });
- };
- RTCPeerConnection.prototype.getStats = function (selector) {
- if (selector && selector instanceof window.MediaStreamTrack) {
- var senderOrReceiver = null;
- this.transceivers.forEach(function (transceiver) {
- if (transceiver.rtpSender && transceiver.rtpSender.track === selector) {
- senderOrReceiver = transceiver.rtpSender;
- } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track === selector) {
- senderOrReceiver = transceiver.rtpReceiver;
- }
- });
- if (!senderOrReceiver) {
- throw makeError('InvalidAccessError', 'Invalid selector.');
- }
- return senderOrReceiver.getStats();
- }
- var promises = [];
- this.transceivers.forEach(function (transceiver) {
- ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport', 'dtlsTransport'].forEach(function (method) {
- if (transceiver[method]) {
- promises.push(transceiver[method].getStats());
- }
- });
- });
- return Promise.all(promises).then(function (allStats) {
- var results = new Map();
- allStats.forEach(function (stats) {
- stats.forEach(function (stat) {
- results.set(stat.id, stat);
- });
- });
- return results;
- });
- };
- // fix low-level stat names and return Map instead of object.
- var ortcObjects = ['RTCRtpSender', 'RTCRtpReceiver', 'RTCIceGatherer', 'RTCIceTransport', 'RTCDtlsTransport'];
- ortcObjects.forEach(function (ortcObjectName) {
- var obj = window[ortcObjectName];
- if (obj && obj.prototype && obj.prototype.getStats) {
- var nativeGetstats = obj.prototype.getStats;
- obj.prototype.getStats = function () {
- return nativeGetstats.apply(this).then(function (nativeStats) {
- var mapStats = new Map();
- Object.keys(nativeStats).forEach(function (id) {
- nativeStats[id].type = fixStatsType(nativeStats[id]);
- mapStats.set(id, nativeStats[id]);
- });
- return mapStats;
- });
- };
- }
- });
- // legacy callback shims. Should be moved to adapter.js some days.
- var methods = ['createOffer', 'createAnswer'];
- methods.forEach(function (method) {
- var nativeMethod = RTCPeerConnection.prototype[method];
- RTCPeerConnection.prototype[method] = function () {
- var args = arguments;
- if (typeof args[0] === 'function' || typeof args[1] === 'function') {
- // legacy
- return nativeMethod.apply(this, [arguments[2]]).then(function (description) {
- if (typeof args[0] === 'function') {
- args[0].apply(null, [description]);
- }
- }, function (error) {
- if (typeof args[1] === 'function') {
- args[1].apply(null, [error]);
- }
- });
- }
- return nativeMethod.apply(this, arguments);
- };
- });
- methods = ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'];
- methods.forEach(function (method) {
- var nativeMethod = RTCPeerConnection.prototype[method];
- RTCPeerConnection.prototype[method] = function () {
- var args = arguments;
- if (typeof args[1] === 'function' || typeof args[2] === 'function') {
- // legacy
- return nativeMethod.apply(this, arguments).then(function () {
- if (typeof args[1] === 'function') {
- args[1].apply(null);
- }
- }, function (error) {
- if (typeof args[2] === 'function') {
- args[2].apply(null, [error]);
- }
- });
- }
- return nativeMethod.apply(this, arguments);
- };
- });
- // getStats is special. It doesn't have a spec legacy method yet we support
- // getStats(something, cb) without error callbacks.
- ['getStats'].forEach(function (method) {
- var nativeMethod = RTCPeerConnection.prototype[method];
- RTCPeerConnection.prototype[method] = function () {
- var args = arguments;
- if (typeof args[1] === 'function') {
- return nativeMethod.apply(this, arguments).then(function () {
- if (typeof args[1] === 'function') {
- args[1].apply(null);
- }
- });
- }
- return nativeMethod.apply(this, arguments);
- };
- });
- return RTCPeerConnection;
- };
- }, {
- "sdp": 17
- }],
- 17: [function (require, module, exports) {
- // SDP helpers.
- var SDPUtils = {};
- // Generate an alphanumeric identifier for cname or mids.
- // TODO: use UUIDs instead? https://gist.github.com/jed/982883
- SDPUtils.generateIdentifier = function () {
- return Math.random().toString(36).substr(2, 10);
- };
- // The RTCP CNAME used by all peerconnections from the same JS.
- SDPUtils.localCName = SDPUtils.generateIdentifier();
- // Splits SDP into lines, dealing with both CRLF and LF.
- SDPUtils.splitLines = function (blob) {
- return blob.trim().split('\n').map(function (line) {
- return line.trim();
- });
- };
- // Splits SDP into sessionpart and mediasections. Ensures CRLF.
- SDPUtils.splitSections = function (blob) {
- var parts = blob.split('\nm=');
- return parts.map(function (part, index) {
- return (index > 0 ? 'm=' + part : part).trim() + '\r\n';
- });
- };
- // returns the session description.
- SDPUtils.getDescription = function (blob) {
- var sections = SDPUtils.splitSections(blob);
- return sections && sections[0];
- };
- // returns the individual media sections.
- SDPUtils.getMediaSections = function (blob) {
- var sections = SDPUtils.splitSections(blob);
- sections.shift();
- return sections;
- };
- // Returns lines that start with a certain prefix.
- SDPUtils.matchPrefix = function (blob, prefix) {
- return SDPUtils.splitLines(blob).filter(function (line) {
- return line.indexOf(prefix) === 0;
- });
- };
- // Parses an ICE candidate line. Sample input:
- // candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8
- // rport 55996"
- SDPUtils.parseCandidate = function (line) {
- var parts;
- // Parse both variants.
- if (line.indexOf('a=candidate:') === 0) {
- parts = line.substring(12).split(' ');
- } else {
- parts = line.substring(10).split(' ');
- }
- var candidate = {
- foundation: parts[0],
- component: parseInt(parts[1], 10),
- protocol: parts[2].toLowerCase(),
- priority: parseInt(parts[3], 10),
- ip: parts[4],
- address: parts[4],
- // address is an alias for ip.
- port: parseInt(parts[5], 10),
- // skip parts[6] == 'typ'
- type: parts[7]
- };
- for (var i = 8; i < parts.length; i += 2) {
- switch (parts[i]) {
- case 'raddr':
- candidate.relatedAddress = parts[i + 1];
- break;
- case 'rport':
- candidate.relatedPort = parseInt(parts[i + 1], 10);
- break;
- case 'tcptype':
- candidate.tcpType = parts[i + 1];
- break;
- case 'ufrag':
- candidate.ufrag = parts[i + 1]; // for backward compability.
- candidate.usernameFragment = parts[i + 1];
- break;
- default:
- // extension handling, in particular ufrag
- candidate[parts[i]] = parts[i + 1];
- break;
- }
- }
- return candidate;
- };
- // Translates a candidate object into SDP candidate attribute.
- SDPUtils.writeCandidate = function (candidate) {
- var sdp = [];
- sdp.push(candidate.foundation);
- sdp.push(candidate.component);
- sdp.push(candidate.protocol.toUpperCase());
- sdp.push(candidate.priority);
- sdp.push(candidate.address || candidate.ip);
- sdp.push(candidate.port);
- var type = candidate.type;
- sdp.push('typ');
- sdp.push(type);
- if (type !== 'host' && candidate.relatedAddress && candidate.relatedPort) {
- sdp.push('raddr');
- sdp.push(candidate.relatedAddress);
- sdp.push('rport');
- sdp.push(candidate.relatedPort);
- }
- if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {
- sdp.push('tcptype');
- sdp.push(candidate.tcpType);
- }
- if (candidate.usernameFragment || candidate.ufrag) {
- sdp.push('ufrag');
- sdp.push(candidate.usernameFragment || candidate.ufrag);
- }
- return 'candidate:' + sdp.join(' ');
- };
- // Parses an ice-options line, returns an array of option tags.
- // a=ice-options:foo bar
- SDPUtils.parseIceOptions = function (line) {
- return line.substr(14).split(' ');
- };
- // Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:
- // a=rtpmap:111 opus/48000/2
- SDPUtils.parseRtpMap = function (line) {
- var parts = line.substr(9).split(' ');
- var parsed = {
- payloadType: parseInt(parts.shift(), 10) // was: id
- };
- parts = parts[0].split('/');
- parsed.name = parts[0];
- parsed.clockRate = parseInt(parts[1], 10); // was: clockrate
- parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;
- // legacy alias, got renamed back to channels in ORTC.
- parsed.numChannels = parsed.channels;
- return parsed;
- };
- // Generate an a=rtpmap line from RTCRtpCodecCapability or
- // RTCRtpCodecParameters.
- SDPUtils.writeRtpMap = function (codec) {
- var pt = codec.payloadType;
- if (codec.preferredPayloadType !== undefined) {
- pt = codec.preferredPayloadType;
- }
- var channels = codec.channels || codec.numChannels || 1;
- return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate + (channels !== 1 ? '/' + channels : '') + '\r\n';
- };
- // Parses an a=extmap line (headerextension from RFC 5285). Sample input:
- // a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
- // a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset
- SDPUtils.parseExtmap = function (line) {
- var parts = line.substr(9).split(' ');
- return {
- id: parseInt(parts[0], 10),
- direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',
- uri: parts[1]
- };
- };
- // Generates a=extmap line from RTCRtpHeaderExtensionParameters or
- // RTCRtpHeaderExtension.
- SDPUtils.writeExtmap = function (headerExtension) {
- return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) + (headerExtension.direction && headerExtension.direction !== 'sendrecv' ? '/' + headerExtension.direction : '') + ' ' + headerExtension.uri + '\r\n';
- };
- // Parses an ftmp line, returns dictionary. Sample input:
- // a=fmtp:96 vbr=on;cng=on
- // Also deals with vbr=on; cng=on
- SDPUtils.parseFmtp = function (line) {
- var parsed = {};
- var kv;
- var parts = line.substr(line.indexOf(' ') + 1).split(';');
- for (var j = 0; j < parts.length; j++) {
- kv = parts[j].trim().split('=');
- parsed[kv[0].trim()] = kv[1];
- }
- return parsed;
- };
- // Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters.
- SDPUtils.writeFmtp = function (codec) {
- var line = '';
- var pt = codec.payloadType;
- if (codec.preferredPayloadType !== undefined) {
- pt = codec.preferredPayloadType;
- }
- if (codec.parameters && Object.keys(codec.parameters).length) {
- var params = [];
- Object.keys(codec.parameters).forEach(function (param) {
- if (codec.parameters[param]) {
- params.push(param + '=' + codec.parameters[param]);
- } else {
- params.push(param);
- }
- });
- line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\r\n';
- }
- return line;
- };
- // Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:
- // a=rtcp-fb:98 nack rpsi
- SDPUtils.parseRtcpFb = function (line) {
- var parts = line.substr(line.indexOf(' ') + 1).split(' ');
- return {
- type: parts.shift(),
- parameter: parts.join(' ')
- };
- };
- // Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.
- SDPUtils.writeRtcpFb = function (codec) {
- var lines = '';
- var pt = codec.payloadType;
- if (codec.preferredPayloadType !== undefined) {
- pt = codec.preferredPayloadType;
- }
- if (codec.rtcpFeedback && codec.rtcpFeedback.length) {
- // FIXME: special handling for trr-int?
- codec.rtcpFeedback.forEach(function (fb) {
- lines += 'a=rtcp-fb:' + pt + ' ' + fb.type + (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') + '\r\n';
- });
- }
- return lines;
- };
- // Parses an RFC 5576 ssrc media attribute. Sample input:
- // a=ssrc:3735928559 cname:something
- SDPUtils.parseSsrcMedia = function (line) {
- var sp = line.indexOf(' ');
- var parts = {
- ssrc: parseInt(line.substr(7, sp - 7), 10)
- };
- var colon = line.indexOf(':', sp);
- if (colon > -1) {
- parts.attribute = line.substr(sp + 1, colon - sp - 1);
- parts.value = line.substr(colon + 1);
- } else {
- parts.attribute = line.substr(sp + 1);
- }
- return parts;
- };
- SDPUtils.parseSsrcGroup = function (line) {
- var parts = line.substr(13).split(' ');
- return {
- semantics: parts.shift(),
- ssrcs: parts.map(function (ssrc) {
- return parseInt(ssrc, 10);
- })
- };
- };
- // Extracts the MID (RFC 5888) from a media section.
- // returns the MID or undefined if no mid line was found.
- SDPUtils.getMid = function (mediaSection) {
- var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];
- if (mid) {
- return mid.substr(6);
- }
- };
- SDPUtils.parseFingerprint = function (line) {
- var parts = line.substr(14).split(' ');
- return {
- algorithm: parts[0].toLowerCase(),
- // algorithm is case-sensitive in Edge.
- value: parts[1]
- };
- };
- // Extracts DTLS parameters from SDP media section or sessionpart.
- // FIXME: for consistency with other functions this should only
- // get the fingerprint line as input. See also getIceParameters.
- SDPUtils.getDtlsParameters = function (mediaSection, sessionpart) {
- var lines = SDPUtils.matchPrefix(mediaSection + sessionpart, 'a=fingerprint:');
- // Note: a=setup line is ignored since we use the 'auto' role.
- // Note2: 'algorithm' is not case sensitive except in Edge.
- return {
- role: 'auto',
- fingerprints: lines.map(SDPUtils.parseFingerprint)
- };
- };
- // Serializes DTLS parameters to SDP.
- SDPUtils.writeDtlsParameters = function (params, setupType) {
- var sdp = 'a=setup:' + setupType + '\r\n';
- params.fingerprints.forEach(function (fp) {
- sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\r\n';
- });
- return sdp;
- };
- // Parses ICE information from SDP media section or sessionpart.
- // FIXME: for consistency with other functions this should only
- // get the ice-ufrag and ice-pwd lines as input.
- SDPUtils.getIceParameters = function (mediaSection, sessionpart) {
- var lines = SDPUtils.splitLines(mediaSection);
- // Search in session part, too.
- lines = lines.concat(SDPUtils.splitLines(sessionpart));
- var iceParameters = {
- usernameFragment: lines.filter(function (line) {
- return line.indexOf('a=ice-ufrag:') === 0;
- })[0].substr(12),
- password: lines.filter(function (line) {
- return line.indexOf('a=ice-pwd:') === 0;
- })[0].substr(10)
- };
- return iceParameters;
- };
- // Serializes ICE parameters to SDP.
- SDPUtils.writeIceParameters = function (params) {
- return 'a=ice-ufrag:' + params.usernameFragment + '\r\n' + 'a=ice-pwd:' + params.password + '\r\n';
- };
- // Parses the SDP media section and returns RTCRtpParameters.
- SDPUtils.parseRtpParameters = function (mediaSection) {
- var description = {
- codecs: [],
- headerExtensions: [],
- fecMechanisms: [],
- rtcp: []
- };
- var lines = SDPUtils.splitLines(mediaSection);
- var mline = lines[0].split(' ');
- for (var i = 3; i < mline.length; i++) {
- // find all codecs from mline[3..]
- var pt = mline[i];
- var rtpmapline = SDPUtils.matchPrefix(mediaSection, 'a=rtpmap:' + pt + ' ')[0];
- if (rtpmapline) {
- var codec = SDPUtils.parseRtpMap(rtpmapline);
- var fmtps = SDPUtils.matchPrefix(mediaSection, 'a=fmtp:' + pt + ' ');
- // Only the first a=fmtp:<pt> is considered.
- codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};
- codec.rtcpFeedback = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-fb:' + pt + ' ').map(SDPUtils.parseRtcpFb);
- description.codecs.push(codec);
- // parse FEC mechanisms from rtpmap lines.
- switch (codec.name.toUpperCase()) {
- case 'RED':
- case 'ULPFEC':
- description.fecMechanisms.push(codec.name.toUpperCase());
- break;
- }
- }
- }
- SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function (line) {
- description.headerExtensions.push(SDPUtils.parseExtmap(line));
- });
- // FIXME: parse rtcp.
- return description;
- };
- // Generates parts of the SDP media section describing the capabilities /
- // parameters.
- SDPUtils.writeRtpDescription = function (kind, caps) {
- var sdp = '';
- // Build the mline.
- sdp += 'm=' + kind + ' ';
- sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.
- sdp += ' UDP/TLS/RTP/SAVPF ';
- sdp += caps.codecs.map(function (codec) {
- if (codec.preferredPayloadType !== undefined) {
- return codec.preferredPayloadType;
- }
- return codec.payloadType;
- }).join(' ') + '\r\n';
- sdp += 'c=IN IP4 0.0.0.0\r\n';
- sdp += 'a=rtcp:9 IN IP4 0.0.0.0\r\n';
- // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.
- caps.codecs.forEach(function (codec) {
- sdp += SDPUtils.writeRtpMap(codec);
- sdp += SDPUtils.writeFmtp(codec);
- sdp += SDPUtils.writeRtcpFb(codec);
- });
- var maxptime = 0;
- caps.codecs.forEach(function (codec) {
- if (codec.maxptime > maxptime) {
- maxptime = codec.maxptime;
- }
- });
- if (maxptime > 0) {
- sdp += 'a=maxptime:' + maxptime + '\r\n';
- }
- sdp += 'a=rtcp-mux\r\n';
- if (caps.headerExtensions) {
- caps.headerExtensions.forEach(function (extension) {
- sdp += SDPUtils.writeExtmap(extension);
- });
- }
- // FIXME: write fecMechanisms.
- return sdp;
- };
- // Parses the SDP media section and returns an array of
- // RTCRtpEncodingParameters.
- SDPUtils.parseRtpEncodingParameters = function (mediaSection) {
- var encodingParameters = [];
- var description = SDPUtils.parseRtpParameters(mediaSection);
- var hasRed = description.fecMechanisms.indexOf('RED') !== -1;
- var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;
- // filter a=ssrc:... cname:, ignore PlanB-msid
- var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
- return SDPUtils.parseSsrcMedia(line);
- }).filter(function (parts) {
- return parts.attribute === 'cname';
- });
- var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;
- var secondarySsrc;
- var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID').map(function (line) {
- var parts = line.substr(17).split(' ');
- return parts.map(function (part) {
- return parseInt(part, 10);
- });
- });
- if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {
- secondarySsrc = flows[0][1];
- }
- description.codecs.forEach(function (codec) {
- if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {
- var encParam = {
- ssrc: primarySsrc,
- codecPayloadType: parseInt(codec.parameters.apt, 10)
- };
- if (primarySsrc && secondarySsrc) {
- encParam.rtx = {
- ssrc: secondarySsrc
- };
- }
- encodingParameters.push(encParam);
- if (hasRed) {
- encParam = JSON.parse(JSON.stringify(encParam));
- encParam.fec = {
- ssrc: primarySsrc,
- mechanism: hasUlpfec ? 'red+ulpfec' : 'red'
- };
- encodingParameters.push(encParam);
- }
- }
- });
- if (encodingParameters.length === 0 && primarySsrc) {
- encodingParameters.push({
- ssrc: primarySsrc
- });
- }
- // we support both b=AS and b=TIAS but interpret AS as TIAS.
- var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');
- if (bandwidth.length) {
- if (bandwidth[0].indexOf('b=TIAS:') === 0) {
- bandwidth = parseInt(bandwidth[0].substr(7), 10);
- } else if (bandwidth[0].indexOf('b=AS:') === 0) {
- // use formula from JSEP to convert b=AS to TIAS value.
- bandwidth = parseInt(bandwidth[0].substr(5), 10) * 1000 * 0.95 - 50 * 40 * 8;
- } else {
- bandwidth = undefined;
- }
- encodingParameters.forEach(function (params) {
- params.maxBitrate = bandwidth;
- });
- }
- return encodingParameters;
- };
- // parses http://draft.ortc.org/#rtcrtcpparameters*
- SDPUtils.parseRtcpParameters = function (mediaSection) {
- var rtcpParameters = {};
- // Gets the first SSRC. Note tha with RTX there might be multiple
- // SSRCs.
- var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
- return SDPUtils.parseSsrcMedia(line);
- }).filter(function (obj) {
- return obj.attribute === 'cname';
- })[0];
- if (remoteSsrc) {
- rtcpParameters.cname = remoteSsrc.value;
- rtcpParameters.ssrc = remoteSsrc.ssrc;
- }
- // Edge uses the compound attribute instead of reducedSize
- // compound is !reducedSize
- var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');
- rtcpParameters.reducedSize = rsize.length > 0;
- rtcpParameters.compound = rsize.length === 0;
- // parses the rtcp-mux attrіbute.
- // Note that Edge does not support unmuxed RTCP.
- var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');
- rtcpParameters.mux = mux.length > 0;
- return rtcpParameters;
- };
- // parses either a=msid: or a=ssrc:... msid lines and returns
- // the id of the MediaStream and MediaStreamTrack.
- SDPUtils.parseMsid = function (mediaSection) {
- var parts;
- var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');
- if (spec.length === 1) {
- parts = spec[0].substr(7).split(' ');
- return {
- stream: parts[0],
- track: parts[1]
- };
- }
- var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:').map(function (line) {
- return SDPUtils.parseSsrcMedia(line);
- }).filter(function (msidParts) {
- return msidParts.attribute === 'msid';
- });
- if (planB.length > 0) {
- parts = planB[0].value.split(' ');
- return {
- stream: parts[0],
- track: parts[1]
- };
- }
- };
- // SCTP
- // parses draft-ietf-mmusic-sctp-sdp-26 first and falls back
- // to draft-ietf-mmusic-sctp-sdp-05
- SDPUtils.parseSctpDescription = function (mediaSection) {
- var mline = SDPUtils.parseMLine(mediaSection);
- var maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');
- var maxMessageSize;
- if (maxSizeLine.length > 0) {
- maxMessageSize = parseInt(maxSizeLine[0].substr(19), 10);
- }
- if (isNaN(maxMessageSize)) {
- maxMessageSize = 65536;
- }
- var sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');
- if (sctpPort.length > 0) {
- return {
- port: parseInt(sctpPort[0].substr(12), 10),
- protocol: mline.fmt,
- maxMessageSize: maxMessageSize
- };
- }
- var sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');
- if (sctpMapLines.length > 0) {
- var parts = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:')[0].substr(10).split(' ');
- return {
- port: parseInt(parts[0], 10),
- protocol: parts[1],
- maxMessageSize: maxMessageSize
- };
- }
- };
- // SCTP
- // outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers
- // support by now receiving in this format, unless we originally parsed
- // as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line
- // protocol of DTLS/SCTP -- without UDP/ or TCP/)
- SDPUtils.writeSctpDescription = function (media, sctp) {
- var output = [];
- if (media.protocol !== 'DTLS/SCTP') {
- 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'];
- } else {
- 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'];
- }
- if (sctp.maxMessageSize !== undefined) {
- output.push('a=max-message-size:' + sctp.maxMessageSize + '\r\n');
- }
- return output.join('');
- };
- // Generate a session ID for SDP.
- // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1
- // recommends using a cryptographically random +ve 64-bit value
- // but right now this should be acceptable and within the right range
- SDPUtils.generateSessionId = function () {
- return Math.random().toString().substr(2, 21);
- };
- // Write boilder plate for start of SDP
- // sessId argument is optional - if not supplied it will
- // be generated randomly
- // sessVersion is optional and defaults to 2
- // sessUser is optional and defaults to 'thisisadapterortc'
- SDPUtils.writeSessionBoilerplate = function (sessId, sessVer, sessUser) {
- var sessionId;
- var version = sessVer !== undefined ? sessVer : 2;
- if (sessId) {
- sessionId = sessId;
- } else {
- sessionId = SDPUtils.generateSessionId();
- }
- var user = sessUser || 'thisisadapterortc';
- // FIXME: sess-id should be an NTP timestamp.
- 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';
- };
- SDPUtils.writeMediaSection = function (transceiver, caps, type, stream) {
- var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);
- // Map ICE parameters (ufrag, pwd) to SDP.
- sdp += SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());
- // Map DTLS parameters to SDP.
- sdp += SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : 'active');
- sdp += 'a=mid:' + transceiver.mid + '\r\n';
- if (transceiver.direction) {
- sdp += 'a=' + transceiver.direction + '\r\n';
- } else if (transceiver.rtpSender && transceiver.rtpReceiver) {
- sdp += 'a=sendrecv\r\n';
- } else if (transceiver.rtpSender) {
- sdp += 'a=sendonly\r\n';
- } else if (transceiver.rtpReceiver) {
- sdp += 'a=recvonly\r\n';
- } else {
- sdp += 'a=inactive\r\n';
- }
- if (transceiver.rtpSender) {
- // spec.
- var msid = 'msid:' + stream.id + ' ' + transceiver.rtpSender.track.id + '\r\n';
- sdp += 'a=' + msid;
- // for Chrome.
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid;
- if (transceiver.sendEncodingParameters[0].rtx) {
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid;
- sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n';
- }
- }
- // FIXME: this should be written by writeRtpDescription.
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
- if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
- sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n';
- }
- return sdp;
- };
- // Gets the direction from the mediaSection or the sessionpart.
- SDPUtils.getDirection = function (mediaSection, sessionpart) {
- // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.
- var lines = SDPUtils.splitLines(mediaSection);
- for (var i = 0; i < lines.length; i++) {
- switch (lines[i]) {
- case 'a=sendrecv':
- case 'a=sendonly':
- case 'a=recvonly':
- case 'a=inactive':
- return lines[i].substr(2);
- // FIXME: What should happen here?
- }
- }
- if (sessionpart) {
- return SDPUtils.getDirection(sessionpart);
- }
- return 'sendrecv';
- };
- SDPUtils.getKind = function (mediaSection) {
- var lines = SDPUtils.splitLines(mediaSection);
- var mline = lines[0].split(' ');
- return mline[0].substr(2);
- };
- SDPUtils.isRejected = function (mediaSection) {
- return mediaSection.split(' ', 2)[1] === '0';
- };
- SDPUtils.parseMLine = function (mediaSection) {
- var lines = SDPUtils.splitLines(mediaSection);
- var parts = lines[0].substr(2).split(' ');
- return {
- kind: parts[0],
- port: parseInt(parts[1], 10),
- protocol: parts[2],
- fmt: parts.slice(3).join(' ')
- };
- };
- SDPUtils.parseOLine = function (mediaSection) {
- var line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];
- var parts = line.substr(2).split(' ');
- return {
- username: parts[0],
- sessionId: parts[1],
- sessionVersion: parseInt(parts[2], 10),
- netType: parts[3],
- addressType: parts[4],
- address: parts[5]
- };
- };
- // a very naive interpretation of a valid SDP.
- SDPUtils.isValidSDP = function (blob) {
- if (typeof blob !== 'string' || blob.length === 0) {
- return false;
- }
- var lines = SDPUtils.splitLines(blob);
- for (var i = 0; i < lines.length; i++) {
- if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {
- return false;
- }
- // TODO: check the modifier a bit more.
- }
- return true;
- };
- // Expose public methods.
- if (_typeof(module) === 'object') {
- module.exports = SDPUtils;
- }
- }, {}]
- }, {}, [1])(1);
- });
- /*
- The MIT License (MIT)
- Copyright (c) 2016 Meetecho
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
- */
- // List of sessions
- Janus$1.sessions = {};
- Janus$1.isExtensionEnabled = function () {
- if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
- // No need for the extension, getDisplayMedia is supported
- return true;
- }
- if (window.navigator.userAgent.match('Chrome')) {
- var chromever = parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1], 10);
- var maxver = 33;
- if (window.navigator.userAgent.match('Linux')) maxver = 35; // "known" crash in chrome 34 and 35 on linux
- if (chromever >= 26 && chromever <= maxver) {
- // Older versions of Chrome don't support this extension-based approach, so lie
- return true;
- }
- return Janus$1.extension.isInstalled();
- } else {
- // Firefox of others, no need for the extension (but this doesn't mean it will work)
- return true;
- }
- };
- var defaultExtension = {
- // Screensharing Chrome Extension ID
- extensionId: 'hapfgfdkleiggjjpfpenajgdnfckjpaj',
- isInstalled: function isInstalled() {
- return document.querySelector('#janus-extension-installed') !== null;
- },
- getScreen: function getScreen(callback) {
- var pending = window.setTimeout(function () {
- var error = new Error('NavigatorUserMediaError');
- 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)';
- return callback(error);
- }, 1000);
- this.cache[pending] = callback;
- window.postMessage({
- type: 'janusGetScreen',
- id: pending
- }, '*');
- },
- init: function init() {
- var cache = {};
- this.cache = cache;
- // Wait for events from the Chrome Extension
- window.addEventListener('message', function (event) {
- if (event.origin != window.location.origin) return;
- if (event.data.type == 'janusGotScreen' && cache[event.data.id]) {
- var callback = cache[event.data.id];
- delete cache[event.data.id];
- if (event.data.sourceId === '') {
- // user canceled
- var error = new Error('NavigatorUserMediaError');
- error.name = 'You cancelled the request for permission, giving up...';
- callback(error);
- } else {
- callback(null, event.data.sourceId);
- }
- } else if (event.data.type == 'janusGetScreenPending') {
- console.log('clearing ', event.data.id);
- window.clearTimeout(event.data.id);
- }
- });
- }
- };
- Janus$1.useDefaultDependencies = function (deps) {
- var f = deps && deps.fetch || fetch;
- var p = deps && deps.Promise || Promise;
- var socketCls = deps && deps.WebSocket || WebSocket;
- return {
- newWebSocket: function newWebSocket(server, proto) {
- return new socketCls(server, proto);
- },
- extension: deps && deps.extension || defaultExtension,
- isArray: function isArray(arr) {
- return Array.isArray(arr);
- },
- webRTCAdapter: deps && deps.adapter || window.adapter,
- httpAPICall: function httpAPICall(url, options) {
- var fetchOptions = {
- method: options.verb,
- headers: {
- 'Accept': 'application/json, text/plain, */*'
- },
- cache: 'no-cache'
- };
- if (options.verb === "POST") {
- fetchOptions.headers['Content-Type'] = 'application/json';
- }
- if (options.withCredentials !== undefined) {
- fetchOptions.credentials = options.withCredentials === true ? 'include' : options.withCredentials ? options.withCredentials : 'omit';
- }
- if (options.body !== undefined) {
- fetchOptions.body = JSON.stringify(options.body);
- }
- var fetching = f(url, fetchOptions)["catch"](function (error) {
- return p.reject({
- message: 'Probably a network error, is the server down?',
- error: error
- });
- });
- /*
- * fetch() does not natively support timeouts.
- * Work around this by starting a timeout manually, and racing it agains the fetch() to see which thing resolves first.
- */
- if (options.timeout !== undefined) {
- var timeout = new p(function (resolve, reject) {
- var timerId = setTimeout(function () {
- clearTimeout(timerId);
- return reject({
- message: 'Request timed out',
- timeout: options.timeout
- });
- }, options.timeout);
- });
- fetching = p.race([fetching, timeout]);
- }
- fetching.then(function (response) {
- if (response.ok) {
- if (_typeof(options.success) === _typeof(Janus$1.noop)) {
- return response.json().then(function (parsed) {
- options.success(parsed);
- })["catch"](function (error) {
- return p.reject({
- message: 'Failed to parse response body',
- error: error,
- response: response
- });
- });
- }
- } else {
- return p.reject({
- message: 'API call failed',
- response: response
- });
- }
- })["catch"](function (error) {
- if (_typeof(options.error) === _typeof(Janus$1.noop)) {
- options.error(error.message || '<< internal error >>', error);
- }
- });
- return fetching;
- }
- };
- };
- Janus$1.useOldDependencies = function (deps) {
- var jq = deps && deps.jQuery || jQuery;
- var socketCls = deps && deps.WebSocket || WebSocket;
- return {
- newWebSocket: function newWebSocket(server, proto) {
- return new socketCls(server, proto);
- },
- isArray: function isArray(arr) {
- return jq.isArray(arr);
- },
- extension: deps && deps.extension || defaultExtension,
- webRTCAdapter: deps && deps.adapter || adapter,
- httpAPICall: function httpAPICall(url, options) {
- var payload = options.body !== undefined ? {
- contentType: 'application/json',
- data: JSON.stringify(options.body)
- } : {};
- var credentials = options.withCredentials !== undefined ? {
- xhrFields: {
- withCredentials: options.withCredentials
- }
- } : {};
- return jq.ajax(jq.extend(payload, credentials, {
- url: url,
- type: options.verb,
- cache: false,
- dataType: 'json',
- async: options.async,
- timeout: options.timeout,
- success: function success(result) {
- if (_typeof(options.success) === _typeof(Janus$1.noop)) {
- options.success(result);
- }
- },
- error: function error(xhr, status, err) {
- if (_typeof(options.error) === _typeof(Janus$1.noop)) {
- options.error(status, err);
- }
- }
- }));
- }
- };
- };
- Janus$1.noop = function () {};
- Janus$1.dataChanDefaultLabel = "JanusDataChannel";
- // Note: in the future we may want to change this, e.g., as was
- // attempted in https://github.com/meetecho/janus-gateway/issues/1670
- Janus$1.endOfCandidates = null;
- // Initialization
- Janus$1.init = function (options) {
- options = options || {};
- options.callback = typeof options.callback == "function" ? options.callback : Janus$1.noop;
- if (Janus$1.initDone === true) {
- // Already initialized
- options.callback();
- } else {
- if (typeof console == "undefined" || typeof console.log == "undefined") console = {
- log: function log() {}
- };
- // Console logging (all debugging disabled by default)
- Janus$1.trace = Janus$1.noop;
- Janus$1.debug = Janus$1.noop;
- Janus$1.vdebug = Janus$1.noop;
- Janus$1.log = Janus$1.noop;
- Janus$1.warn = Janus$1.noop;
- Janus$1.error = Janus$1.noop;
- if (options.debug === true || options.debug === "all") {
- // Enable all debugging levels
- Janus$1.trace = console.trace.bind(console);
- Janus$1.debug = console.debug.bind(console);
- Janus$1.vdebug = console.debug.bind(console);
- Janus$1.log = console.log.bind(console);
- Janus$1.warn = console.warn.bind(console);
- Janus$1.error = console.error.bind(console);
- } else if (Array.isArray(options.debug)) {
- for (var i in options.debug) {
- var d = options.debug[i];
- switch (d) {
- case "trace":
- Janus$1.trace = console.trace.bind(console);
- break;
- case "debug":
- Janus$1.debug = console.debug.bind(console);
- break;
- case "vdebug":
- Janus$1.vdebug = console.debug.bind(console);
- break;
- case "log":
- Janus$1.log = console.log.bind(console);
- break;
- case "warn":
- Janus$1.warn = console.warn.bind(console);
- break;
- case "error":
- Janus$1.error = console.error.bind(console);
- break;
- default:
- console.error("Unknown debugging option '" + d + "' (supported: 'trace', 'debug', 'vdebug', 'log', warn', 'error')");
- break;
- }
- }
- }
- Janus$1.log("Initializing library");
- var usedDependencies = options.dependencies || Janus$1.useDefaultDependencies();
- Janus$1.isArray = usedDependencies.isArray;
- Janus$1.webRTCAdapter = usedDependencies.webRTCAdapter;
- Janus$1.httpAPICall = usedDependencies.httpAPICall;
- Janus$1.newWebSocket = usedDependencies.newWebSocket;
- Janus$1.extension = usedDependencies.extension;
- Janus$1.extension.init();
- // Helper method to enumerate devices
- Janus$1.listDevices = function (callback, config) {
- callback = typeof callback == "function" ? callback : Janus$1.noop;
- if (config == null) config = {
- audio: true,
- video: true
- };
- if (Janus$1.isGetUserMediaAvailable()) {
- navigator.mediaDevices.getUserMedia(config).then(function (stream) {
- navigator.mediaDevices.enumerateDevices().then(function (devices) {
- Janus$1.debug(devices);
- callback(devices);
- // Get rid of the now useless stream
- try {
- var tracks = stream.getTracks();
- for (var i in tracks) {
- var mst = tracks[i];
- if (mst !== null && mst !== undefined) mst.stop();
- }
- } catch (e) {}
- });
- })["catch"](function (err) {
- Janus$1.error(err);
- callback([]);
- });
- } else {
- Janus$1.warn("navigator.mediaDevices unavailable");
- callback([]);
- }
- };
- // Helper methods to attach/reattach a stream to a video element (previously part of adapter.js)
- Janus$1.attachMediaStream = function (element, stream) {
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
- var chromever = Janus$1.webRTCAdapter.browserDetails.version;
- // if(chromever >= 52) {
- // element.srcObject = stream;
- // } else if(typeof element.src !== 'undefined') {
- // element.src = URL.createObjectURL(stream);
- // } else {
- // Janus.error("Error attaching stream to element");
- // }
- if (chromever >= 52) {
- element.srcObject = stream;
- } else {
- Janus$1.error("Error attaching stream to element");
- }
- } else {
- element.srcObject = stream;
- }
- };
- Janus$1.reattachMediaStream = function (to, from) {
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
- var chromever = Janus$1.webRTCAdapter.browserDetails.version;
- if (chromever >= 52) {
- to.srcObject = from.srcObject;
- } else if (typeof to.src !== 'undefined') {
- to.src = from.src;
- } else {
- Janus$1.error("Error reattaching stream to element");
- }
- } else {
- to.srcObject = from.srcObject;
- }
- };
- // Detect tab close: make sure we don't loose existing onbeforeunload handlers
- // (note: for iOS we need to subscribe to a different event, 'pagehide', see
- // https://gist.github.com/thehunmonkgroup/6bee8941a49b86be31a787fe8f4b8cfe)
- var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
- var eventName = iOS ? 'pagehide' : 'beforeunload';
- var oldOBF = window["on" + eventName];
- window.addEventListener(eventName, function (event) {
- Janus$1.log("Closing window");
- for (var s in Janus$1.sessions) {
- if (Janus$1.sessions[s] !== null && Janus$1.sessions[s] !== undefined && Janus$1.sessions[s].destroyOnUnload) {
- Janus$1.log("Destroying session " + s);
- Janus$1.sessions[s].destroy({
- asyncRequest: false,
- notifyDestroyed: false
- });
- }
- }
- if (oldOBF && typeof oldOBF == "function") oldOBF();
- });
- // If this is a Safari Technology Preview, check if VP8 is supported
- Janus$1.safariVp8 = false;
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'safari' && Janus$1.webRTCAdapter.browserDetails.version >= 605) {
- // Let's see if RTCRtpSender.getCapabilities() is there
- if (RTCRtpSender && RTCRtpSender.getCapabilities && RTCRtpSender.getCapabilities("video") && RTCRtpSender.getCapabilities("video").codecs && RTCRtpSender.getCapabilities("video").codecs.length) {
- for (var i in RTCRtpSender.getCapabilities("video").codecs) {
- var codec = RTCRtpSender.getCapabilities("video").codecs[i];
- if (codec && codec.mimeType && codec.mimeType.toLowerCase() === "video/vp8") {
- Janus$1.safariVp8 = true;
- break;
- }
- }
- if (Janus$1.safariVp8) {
- Janus$1.log("This version of Safari supports VP8");
- } else {
- 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");
- }
- } else {
- // We do it in a very ugly way, as there's no alternative...
- // We create a PeerConnection to see if VP8 is in an offer
- var testpc = new RTCPeerConnection({}, {});
- testpc.createOffer({
- offerToReceiveVideo: true
- }).then(function (offer) {
- Janus$1.safariVp8 = offer.sdp.indexOf("VP8") !== -1;
- if (Janus$1.safariVp8) {
- Janus$1.log("This version of Safari supports VP8");
- } else {
- 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");
- }
- testpc.close();
- testpc = null;
- });
- }
- }
- // Check if this browser supports Unified Plan and transceivers
- // Based on https://codepen.io/anon/pen/ZqLwWV?editors=0010
- Janus$1.unifiedPlan = false;
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'firefox' && Janus$1.webRTCAdapter.browserDetails.version >= 59) {
- // Firefox definitely does, starting from version 59
- Janus$1.unifiedPlan = true;
- } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome' && Janus$1.webRTCAdapter.browserDetails.version < 72) {
- // Chrome does, but it's only usable from version 72 on
- Janus$1.unifiedPlan = false;
- } else if (typeof RTCRtpTransceiver !== 'undefined' && !('currentDirection' in RTCRtpTransceiver.prototype)) {
- // Safari supports addTransceiver() but not Unified Plan when
- // currentDirection is not defined (see codepen above)
- Janus$1.unifiedPlan = false;
- } else {
- // Check if addTransceiver() throws an exception
- var tempPc = new RTCPeerConnection();
- try {
- tempPc.addTransceiver('audio');
- Janus$1.unifiedPlan = true;
- } catch (e) {}
- tempPc.close();
- }
- Janus$1.initDone = true;
- options.callback();
- }
- };
- // Helper method to check whether WebRTC is supported by this browser
- Janus$1.isWebrtcSupported = function () {
- return window.RTCPeerConnection !== undefined && window.RTCPeerConnection !== null;
- };
- // Helper method to check whether devices can be accessed by this browser (e.g., not possible via plain HTTP)
- Janus$1.isGetUserMediaAvailable = function () {
- return navigator.mediaDevices !== undefined && navigator.mediaDevices !== null && navigator.mediaDevices.getUserMedia !== undefined && navigator.mediaDevices.getUserMedia !== null;
- };
- // Helper method to create random identifiers (e.g., transaction)
- Janus$1.randomString = function (len) {
- var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var randomString = '';
- for (var i = 0; i < len; i++) {
- var randomPoz = Math.floor(Math.random() * charSet.length);
- randomString += charSet.substring(randomPoz, randomPoz + 1);
- }
- return randomString;
- };
- function Janus$1(gatewayCallbacks) {
- if (Janus$1.initDone === undefined) {
- gatewayCallbacks.error("Library not initialized");
- return {};
- }
- if (!Janus$1.isWebrtcSupported()) {
- gatewayCallbacks.error("WebRTC not supported by this browser");
- return {};
- }
- Janus$1.log("Library initialized: " + Janus$1.initDone);
- gatewayCallbacks = gatewayCallbacks || {};
- gatewayCallbacks.success = typeof gatewayCallbacks.success == "function" ? gatewayCallbacks.success : Janus$1.noop;
- gatewayCallbacks.error = typeof gatewayCallbacks.error == "function" ? gatewayCallbacks.error : Janus$1.noop;
- gatewayCallbacks.destroyed = typeof gatewayCallbacks.destroyed == "function" ? gatewayCallbacks.destroyed : Janus$1.noop;
- if (gatewayCallbacks.server === null || gatewayCallbacks.server === undefined) {
- gatewayCallbacks.error("Invalid server url");
- return {};
- }
- var websockets = false;
- var ws = null;
- var wsHandlers = {};
- var wsKeepaliveTimeoutId = null;
- var servers = null,
- serversIndex = 0;
- var server = gatewayCallbacks.server;
- if (Janus$1.isArray(server)) {
- Janus$1.log("Multiple servers provided (" + server.length + "), will use the first that works");
- server = null;
- servers = gatewayCallbacks.server;
- Janus$1.debug(servers);
- } else {
- if (server.indexOf("ws") === 0) {
- websockets = true;
- Janus$1.log("Using WebSockets to contact Janus: " + server);
- } else {
- websockets = false;
- Janus$1.log("Using REST API to contact Janus: " + server);
- }
- }
- var iceServers = gatewayCallbacks.iceServers;
- if (iceServers === undefined || iceServers === null) iceServers = [{
- urls: "stun:stun.l.google.com:19302"
- }];
- var iceTransportPolicy = gatewayCallbacks.iceTransportPolicy;
- var bundlePolicy = gatewayCallbacks.bundlePolicy;
- // Whether IPv6 candidates should be gathered
- var ipv6Support = gatewayCallbacks.ipv6;
- if (ipv6Support === undefined || ipv6Support === null) ipv6Support = false;
- // Whether we should enable the withCredentials flag for XHR requests
- var withCredentials = false;
- if (gatewayCallbacks.withCredentials !== undefined && gatewayCallbacks.withCredentials !== null) withCredentials = gatewayCallbacks.withCredentials === true;
- // Optional max events
- var maxev = 10;
- if (gatewayCallbacks.max_poll_events !== undefined && gatewayCallbacks.max_poll_events !== null) maxev = gatewayCallbacks.max_poll_events;
- if (maxev < 1) maxev = 1;
- // Token to use (only if the token based authentication mechanism is enabled)
- var token = null;
- if (gatewayCallbacks.token !== undefined && gatewayCallbacks.token !== null) token = gatewayCallbacks.token;
- // API secret to use (only if the shared API secret is enabled)
- var apisecret = null;
- if (gatewayCallbacks.apisecret !== undefined && gatewayCallbacks.apisecret !== null) apisecret = gatewayCallbacks.apisecret;
- // Whether we should destroy this session when onbeforeunload is called
- this.destroyOnUnload = true;
- if (gatewayCallbacks.destroyOnUnload !== undefined && gatewayCallbacks.destroyOnUnload !== null) this.destroyOnUnload = gatewayCallbacks.destroyOnUnload === true;
- // Some timeout-related values
- var keepAlivePeriod = 25000;
- if (gatewayCallbacks.keepAlivePeriod !== undefined && gatewayCallbacks.keepAlivePeriod !== null) keepAlivePeriod = gatewayCallbacks.keepAlivePeriod;
- if (isNaN(keepAlivePeriod)) keepAlivePeriod = 25000;
- var longPollTimeout = 60000;
- if (gatewayCallbacks.longPollTimeout !== undefined && gatewayCallbacks.longPollTimeout !== null) longPollTimeout = gatewayCallbacks.longPollTimeout;
- if (isNaN(longPollTimeout)) longPollTimeout = 60000;
- // overrides for default maxBitrate values for simulcasting
- function getMaxBitrates(simulcastMaxBitrates) {
- var maxBitrates = {
- high: 900000,
- medium: 300000,
- low: 100000
- };
- if (simulcastMaxBitrates !== undefined && simulcastMaxBitrates !== null) {
- if (simulcastMaxBitrates.high) maxBitrates.high = simulcastMaxBitrates.high;
- if (simulcastMaxBitrates.medium) maxBitrates.medium = simulcastMaxBitrates.medium;
- if (simulcastMaxBitrates.low) maxBitrates.low = simulcastMaxBitrates.low;
- }
- return maxBitrates;
- }
- var connected = false;
- var sessionId = null;
- var pluginHandles = {};
- var that = this;
- var retries = 0;
- var transactions = {};
- createSession(gatewayCallbacks);
- // Public methods
- this.getServer = function () {
- return server;
- };
- this.isConnected = function () {
- return connected;
- };
- this.reconnect = function (callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- callbacks["reconnect"] = true;
- createSession(callbacks);
- };
- this.getSessionId = function () {
- return sessionId;
- };
- this.destroy = function (callbacks) {
- destroySession(callbacks);
- };
- this.attach = function (callbacks) {
- createHandle(callbacks);
- };
- function eventHandler() {
- if (sessionId == null) return;
- Janus$1.debug('Long poll...');
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- return;
- }
- var longpoll = server + "/" + sessionId + "?rid=" + new Date().getTime();
- if (maxev !== undefined && maxev !== null) longpoll = longpoll + "&maxev=" + maxev;
- if (token !== null && token !== undefined) longpoll = longpoll + "&token=" + encodeURIComponent(token);
- if (apisecret !== null && apisecret !== undefined) longpoll = longpoll + "&apisecret=" + encodeURIComponent(apisecret);
- Janus$1.httpAPICall(longpoll, {
- verb: 'GET',
- withCredentials: withCredentials,
- success: handleEvent,
- timeout: longPollTimeout,
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown);
- retries++;
- if (retries > 3) {
- // Did we just lose the server? :-(
- connected = false;
- gatewayCallbacks.error("Lost connection to the server (is it down?)");
- return;
- }
- eventHandler();
- }
- });
- }
- // Private event handler: this will trigger plugin callbacks, if set
- function handleEvent(json, skipTimeout) {
- retries = 0;
- if (!websockets && sessionId !== undefined && sessionId !== null && skipTimeout !== true) eventHandler();
- if (!websockets && Janus$1.isArray(json)) {
- // We got an array: it means we passed a maxev > 1, iterate on all objects
- for (var i = 0; i < json.length; i++) {
- handleEvent(json[i], true);
- }
- return;
- }
- if (json["rtcgw"] === "keepalive") {
- // Nothing happened
- Janus$1.vdebug("Got a keepalive on session " + sessionId);
- return;
- } else if (json["rtcgw"] === "ack") {
- // Just an ack, we can probably ignore
- Janus$1.debug("Got an ack on session " + sessionId);
- Janus$1.debug(json);
- var transaction = json["transaction"];
- if (transaction !== null && transaction !== undefined) {
- var reportSuccess = transactions[transaction];
- if (reportSuccess !== null && reportSuccess !== undefined) {
- reportSuccess(json);
- }
- delete transactions[transaction];
- }
- return;
- } else if (json["rtcgw"] === "success") {
- // Success!
- Janus$1.debug("Got a success on session " + sessionId);
- Janus$1.debug(json);
- var transaction = json["transaction"];
- if (transaction !== null && transaction !== undefined) {
- var reportSuccess = transactions[transaction];
- if (reportSuccess !== null && reportSuccess !== undefined) {
- reportSuccess(json);
- }
- delete transactions[transaction];
- }
- return;
- } else if (json["rtcgw"] === "trickle") {
- // We got a trickle candidate from Janus
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.debug("This handle is not attached to this session");
- return;
- }
- var candidate = json["candidate"];
- Janus$1.debug("Got a trickled candidate on session " + sessionId);
- Janus$1.debug(candidate);
- var config = pluginHandle.webrtcStuff;
- if (config.pc && config.remoteSdp) {
- // Add candidate right now
- Janus$1.debug("Adding remote candidate:", candidate);
- if (!candidate || candidate.completed === true) {
- // end-of-candidates
- config.pc.addIceCandidate(Janus$1.endOfCandidates);
- } else {
- // New candidate
- config.pc.addIceCandidate(candidate);
- }
- } else {
- // We didn't do setRemoteDescription (trickle got here before the offer?)
- Janus$1.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate");
- if (!config.candidates) config.candidates = [];
- config.candidates.push(candidate);
- Janus$1.debug(config.candidates);
- }
- } else if (json["rtcgw"] === "webrtcup") {
- // The PeerConnection with the server is up! Notify this
- Janus$1.debug("Got a webrtcup event on session " + sessionId);
- Janus$1.debug(json);
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.debug("This handle is not attached to this session");
- return;
- }
- pluginHandle.webrtcState(true);
- return;
- } else if (json["rtcgw"] === "hangup") {
- // A plugin asked the core to hangup a PeerConnection on one of our handles
- Janus$1.debug("Got a hangup event on session " + sessionId);
- Janus$1.debug(json);
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.debug("This handle is not attached to this session");
- return;
- }
- pluginHandle.webrtcState(false, json["reason"]);
- pluginHandle.hangup();
- } else if (json["rtcgw"] === "detached") {
- // A plugin asked the core to detach one of our handles
- Janus$1.debug("Got a detached event on session " + sessionId);
- Janus$1.debug(json);
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- // Don't warn here because destroyHandle causes this situation.
- return;
- }
- pluginHandle.detached = true;
- pluginHandle.ondetached();
- pluginHandle.detach();
- } else if (json["rtcgw"] === "media") {
- // Media started/stopped flowing
- Janus$1.debug("Got a media event on session " + sessionId);
- Janus$1.debug(json);
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.debug("This handle is not attached to this session");
- return;
- }
- pluginHandle.mediaState(json["type"], json["receiving"]);
- } else if (json["rtcgw"] === "slowlink") {
- Janus$1.debug("Got a slowlink event on session " + sessionId);
- Janus$1.debug(json);
- // Trouble uplink or downlink
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.debug("This handle is not attached to this session");
- return;
- }
- pluginHandle.slowLink(json["uplink"], json["lost"]);
- } else if (json["rtcgw"] === "error") {
- // Oops, something wrong happened
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- Janus$1.debug(json);
- var transaction = json["transaction"];
- if (transaction !== null && transaction !== undefined) {
- var reportSuccess = transactions[transaction];
- if (reportSuccess !== null && reportSuccess !== undefined) {
- reportSuccess(json);
- }
- delete transactions[transaction];
- }
- return;
- } else if (json["rtcgw"] === "event") {
- Janus$1.debug("Got a plugin event on session " + sessionId);
- Janus$1.debug(json);
- var sender = json["sender"];
- if (sender === undefined || sender === null) {
- Janus$1.warn("Missing sender...");
- return;
- }
- var plugindata = json["plugindata"];
- if (plugindata === undefined || plugindata === null) {
- Janus$1.warn("Missing plugindata...");
- return;
- }
- Janus$1.debug(" -- Event is coming from " + sender + " (" + plugindata["plugin"] + ")");
- var data = plugindata["data"];
- Janus$1.debug(data);
- var pluginHandle = pluginHandles[sender];
- if (pluginHandle === undefined || pluginHandle === null) {
- Janus$1.warn("This handle is not attached to this session");
- return;
- }
- var jsep = json["jsep"];
- if (jsep !== undefined && jsep !== null) {
- Janus$1.debug("Handling SDP as well...");
- Janus$1.debug(jsep);
- }
- var callback = pluginHandle.onmessage;
- if (callback !== null && callback !== undefined) {
- Janus$1.debug("Notifying application...");
- // Send to callback specified when attaching plugin handle
- callback(data, jsep);
- } else {
- // Send to generic callback (?)
- Janus$1.debug("No provided notification callback");
- }
- } else if (json["rtcgw"] === "timeout") {
- Janus$1.error("Timeout on session " + sessionId);
- Janus$1.debug(json);
- if (websockets) {
- ws.close(3504, "Gateway timeout");
- }
- return;
- } else {
- Janus$1.warn("Unknown message/event '" + json["rtcgw"] + "' on session " + sessionId);
- Janus$1.debug(json);
- }
- }
- // Private helper to send keep-alive messages on WebSockets
- function keepAlive() {
- if (server === null || !websockets || !connected) return;
- wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
- var request = {
- "rtcgw": "keepalive",
- "session_id": sessionId,
- "transaction": Janus$1.randomString(12)
- };
- if (token !== null && token !== undefined) request["token"] = token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- ws.send(JSON.stringify(request));
- }
- // Private method to create a session
- function createSession(callbacks) {
- var transaction = Janus$1.randomString(12);
- // console.log("jannus create_token",stream);
- var request = {
- "rtcgw": "create",
- "transaction": transaction,
- "token": window.EZUIKit.opt.stream,
- "device": window.EZUIKit.opt.deviceSerial,
- "channel": window.EZUIKit.opt.channelNo
- };
- if (callbacks["reconnect"]) {
- // We're reconnecting, claim the session
- connected = false;
- request["rtcgw"] = "claim";
- request["session_id"] = sessionId;
- // If we were using websockets, ignore the old connection
- if (ws) {
- ws.onopen = null;
- ws.onerror = null;
- ws.onclose = null;
- if (wsKeepaliveTimeoutId) {
- clearTimeout(wsKeepaliveTimeoutId);
- wsKeepaliveTimeoutId = null;
- }
- }
- }
- if (token !== null && token !== undefined) request["token"] = token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- if (server === null && Janus$1.isArray(servers)) {
- // We still need to find a working server from the list we were given
- server = servers[serversIndex];
- if (server.indexOf("ws") === 0) {
- websockets = true;
- Janus$1.log("Server #" + (serversIndex + 1) + ": trying WebSockets to contact Janus (" + server + ")");
- } else {
- websockets = false;
- Janus$1.log("Server #" + (serversIndex + 1) + ": trying REST API to contact Janus (" + server + ")");
- }
- }
- if (websockets) {
- ws = Janus$1.newWebSocket(server, 'rtcgw-protocol');
- wsHandlers = {
- 'error': function error() {
- Janus$1.error("Error connecting to the Janus WebSockets server... " + server);
- if (Janus$1.isArray(servers) && !callbacks["reconnect"]) {
- serversIndex++;
- if (serversIndex == servers.length) {
- // We tried all the servers the user gave us and they all failed
- callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
- return;
- }
- // Let's try the next server
- server = null;
- setTimeout(function () {
- createSession(callbacks);
- }, 200);
- return;
- }
- callbacks.error("Error connecting to the Janus WebSockets server: Is the server down?");
- },
- 'open': function open() {
- // We need to be notified about the success
- transactions[transaction] = function (json) {
- Janus$1.debug(json);
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error(json["error"].reason);
- return;
- }
- wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
- connected = true;
- sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
- if (callbacks["reconnect"]) {
- Janus$1.log("Claimed session: " + sessionId);
- } else {
- Janus$1.log("Created session: " + sessionId);
- }
- Janus$1.sessions[sessionId] = that;
- callbacks.success();
- };
- ws.send(JSON.stringify(request));
- },
- 'message': function message(event) {
- handleEvent(JSON.parse(event.data));
- },
- 'close': function close() {
- if (server === null || !connected) {
- return;
- }
- connected = false;
- // FIXME What if this is called when the page is closed?
- gatewayCallbacks.error("Lost connection to the server (is it down?)");
- }
- };
- for (var eventName in wsHandlers) {
- ws.addEventListener(eventName, wsHandlers[eventName]);
- }
- return;
- }
- Janus$1.httpAPICall(server, {
- verb: 'POST',
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.debug(json);
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error(json["error"].reason);
- return;
- }
- connected = true;
- sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
- if (callbacks["reconnect"]) {
- Janus$1.log("Claimed session: " + sessionId);
- } else {
- Janus$1.log("Created session: " + sessionId);
- }
- Janus$1.sessions[sessionId] = that;
- eventHandler();
- callbacks.success();
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- if (Janus$1.isArray(servers) && !callbacks["reconnect"]) {
- serversIndex++;
- if (serversIndex == servers.length) {
- // We tried all the servers the user gave us and they all failed
- callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
- return;
- }
- // Let's try the next server
- server = null;
- setTimeout(function () {
- createSession(callbacks);
- }, 200);
- return;
- }
- if (errorThrown === "") callbacks.error(textStatus + ": Is the server down?");else callbacks.error(textStatus + ": " + errorThrown);
- }
- });
- }
- // Private method to destroy a session
- function destroySession(callbacks) {
- callbacks = callbacks || {};
- // FIXME This method triggers a success even when we fail
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- var asyncRequest = true;
- if (callbacks.asyncRequest !== undefined && callbacks.asyncRequest !== null) asyncRequest = callbacks.asyncRequest === true;
- var notifyDestroyed = true;
- if (callbacks.notifyDestroyed !== undefined && callbacks.notifyDestroyed !== null) notifyDestroyed = callbacks.notifyDestroyed === true;
- var cleanupHandles = false;
- if (callbacks.cleanupHandles !== undefined && callbacks.cleanupHandles !== null) cleanupHandles = callbacks.cleanupHandles === true;
- Janus$1.log("Destroying session " + sessionId + " (async=" + asyncRequest + ")");
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- callbacks.success();
- return;
- }
- if (sessionId === undefined || sessionId === null) {
- Janus$1.warn("No session to destroy");
- callbacks.success();
- if (notifyDestroyed) gatewayCallbacks.destroyed();
- return;
- }
- if (cleanupHandles) {
- for (var handleId in pluginHandles) {
- destroyHandle(handleId, {
- noRequest: true
- });
- }
- }
- // No need to destroy all handles first, Janus will do that itself
- var request = {
- "rtcgw": "destroy",
- "transaction": Janus$1.randomString(12)
- };
- if (token !== null && token !== undefined) request["token"] = token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- if (websockets) {
- request["session_id"] = sessionId;
- var unbindWebSocket = function unbindWebSocket() {
- for (var eventName in wsHandlers) {
- ws.removeEventListener(eventName, wsHandlers[eventName]);
- }
- ws.removeEventListener('message', onUnbindMessage);
- ws.removeEventListener('error', onUnbindError);
- if (wsKeepaliveTimeoutId) {
- clearTimeout(wsKeepaliveTimeoutId);
- }
- ws.close();
- };
- var onUnbindMessage = function onUnbindMessage(event) {
- var data = JSON.parse(event.data);
- if (data.session_id == request.session_id && data.transaction == request.transaction) {
- unbindWebSocket();
- callbacks.success();
- if (notifyDestroyed) gatewayCallbacks.destroyed();
- }
- };
- var onUnbindError = function onUnbindError(event) {
- unbindWebSocket();
- callbacks.error("Failed to destroy the server: Is the server down?");
- if (notifyDestroyed) gatewayCallbacks.destroyed();
- };
- ws.addEventListener('message', onUnbindMessage);
- ws.addEventListener('error', onUnbindError);
- ws.send(JSON.stringify(request));
- return;
- }
- Janus$1.httpAPICall(server + "/" + sessionId, {
- verb: 'POST',
- async: asyncRequest,
- // Sometimes we need false here, or destroying in onbeforeunload won't work
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.log("Destroyed session:");
- Janus$1.debug(json);
- sessionId = null;
- connected = false;
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- }
- callbacks.success();
- if (notifyDestroyed) gatewayCallbacks.destroyed();
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- // Reset everything anyway
- sessionId = null;
- connected = false;
- callbacks.success();
- if (notifyDestroyed) gatewayCallbacks.destroyed();
- }
- });
- }
- // Private method to create a plugin handle
- function createHandle(callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- callbacks.consentDialog = typeof callbacks.consentDialog == "function" ? callbacks.consentDialog : Janus$1.noop;
- callbacks.iceState = typeof callbacks.iceState == "function" ? callbacks.iceState : Janus$1.noop;
- callbacks.mediaState = typeof callbacks.mediaState == "function" ? callbacks.mediaState : Janus$1.noop;
- callbacks.webrtcState = typeof callbacks.webrtcState == "function" ? callbacks.webrtcState : Janus$1.noop;
- callbacks.slowLink = typeof callbacks.slowLink == "function" ? callbacks.slowLink : Janus$1.noop;
- callbacks.onmessage = typeof callbacks.onmessage == "function" ? callbacks.onmessage : Janus$1.noop;
- callbacks.onlocalstream = typeof callbacks.onlocalstream == "function" ? callbacks.onlocalstream : Janus$1.noop;
- callbacks.onremotestream = typeof callbacks.onremotestream == "function" ? callbacks.onremotestream : Janus$1.noop;
- callbacks.ondata = typeof callbacks.ondata == "function" ? callbacks.ondata : Janus$1.noop;
- callbacks.ondataopen = typeof callbacks.ondataopen == "function" ? callbacks.ondataopen : Janus$1.noop;
- callbacks.oncleanup = typeof callbacks.oncleanup == "function" ? callbacks.oncleanup : Janus$1.noop;
- callbacks.ondetached = typeof callbacks.ondetached == "function" ? callbacks.ondetached : Janus$1.noop;
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- callbacks.error("Is the server down? (connected=false)");
- return;
- }
- var plugin = callbacks.plugin;
- if (plugin === undefined || plugin === null) {
- Janus$1.error("Invalid plugin");
- callbacks.error("Invalid plugin");
- return;
- }
- var opaqueId = callbacks.opaqueId;
- var handleToken = callbacks.token ? callbacks.token : token;
- var transaction = Janus$1.randomString(12);
- var request = {
- "rtcgw": "attach",
- "plugin": plugin,
- "opaque_id": opaqueId,
- "transaction": transaction
- };
- if (handleToken !== null && handleToken !== undefined) request["token"] = handleToken;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- if (websockets) {
- transactions[transaction] = function (json) {
- Janus$1.debug(json);
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
- return;
- }
- var handleId = json.data["id"];
- Janus$1.log("Created handle: " + handleId);
- var pluginHandle = {
- session: that,
- plugin: plugin,
- id: handleId,
- token: handleToken,
- detached: false,
- webrtcStuff: {
- started: false,
- myStream: null,
- streamExternal: false,
- remoteStream: null,
- mySdp: null,
- mediaConstraints: null,
- pc: null,
- dataChannel: {},
- dtmfSender: null,
- trickle: true,
- iceDone: false,
- volume: {
- value: null,
- timer: null
- },
- bitrate: {
- value: null,
- bsnow: null,
- bsbefore: null,
- tsnow: null,
- tsbefore: null,
- timer: null
- }
- },
- getId: function getId() {
- return handleId;
- },
- getPlugin: function getPlugin() {
- return plugin;
- },
- getVolume: function getVolume() {
- return _getVolume(handleId, true);
- },
- getRemoteVolume: function getRemoteVolume() {
- return _getVolume(handleId, true);
- },
- getLocalVolume: function getLocalVolume() {
- return _getVolume(handleId, false);
- },
- isAudioMuted: function isAudioMuted() {
- return isMuted(handleId, false);
- },
- muteAudio: function muteAudio() {
- return mute(handleId, false, true);
- },
- unmuteAudio: function unmuteAudio() {
- return mute(handleId, false, false);
- },
- isVideoMuted: function isVideoMuted() {
- return isMuted(handleId, true);
- },
- muteVideo: function muteVideo() {
- return mute(handleId, true, true);
- },
- unmuteVideo: function unmuteVideo() {
- return mute(handleId, true, false);
- },
- getBitrate: function getBitrate() {
- return _getBitrate(handleId);
- },
- send: function send(callbacks) {
- sendMessage(handleId, callbacks);
- },
- data: function data(callbacks) {
- sendData(handleId, callbacks);
- },
- dtmf: function dtmf(callbacks) {
- sendDtmf(handleId, callbacks);
- },
- consentDialog: callbacks.consentDialog,
- iceState: callbacks.iceState,
- mediaState: callbacks.mediaState,
- webrtcState: callbacks.webrtcState,
- slowLink: callbacks.slowLink,
- onmessage: callbacks.onmessage,
- createOffer: function createOffer(callbacks) {
- prepareWebrtc(handleId, true, callbacks);
- },
- createAnswer: function createAnswer(callbacks) {
- prepareWebrtc(handleId, false, callbacks);
- },
- handleRemoteJsep: function handleRemoteJsep(callbacks) {
- prepareWebrtcPeer(handleId, callbacks);
- },
- onlocalstream: callbacks.onlocalstream,
- onremotestream: callbacks.onremotestream,
- ondata: callbacks.ondata,
- ondataopen: callbacks.ondataopen,
- oncleanup: callbacks.oncleanup,
- ondetached: callbacks.ondetached,
- hangup: function hangup(sendRequest) {
- cleanupWebrtc(handleId, sendRequest === true);
- },
- detach: function detach(callbacks) {
- destroyHandle(handleId, callbacks);
- }
- };
- pluginHandles[handleId] = pluginHandle;
- callbacks.success(pluginHandle);
- };
- request["session_id"] = sessionId;
- ws.send(JSON.stringify(request));
- return;
- }
- Janus$1.httpAPICall(server + "/" + sessionId, {
- verb: 'POST',
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.debug(json);
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
- return;
- }
- var handleId = json.data["id"];
- Janus$1.log("Created handle: " + handleId);
- var pluginHandle = {
- session: that,
- plugin: plugin,
- id: handleId,
- token: handleToken,
- detached: false,
- webrtcStuff: {
- started: false,
- myStream: null,
- streamExternal: false,
- remoteStream: null,
- mySdp: null,
- mediaConstraints: null,
- pc: null,
- dataChannel: {},
- dtmfSender: null,
- trickle: true,
- iceDone: false,
- volume: {
- value: null,
- timer: null
- },
- bitrate: {
- value: null,
- bsnow: null,
- bsbefore: null,
- tsnow: null,
- tsbefore: null,
- timer: null
- }
- },
- getId: function getId() {
- return handleId;
- },
- getPlugin: function getPlugin() {
- return plugin;
- },
- getVolume: function getVolume() {
- return _getVolume(handleId, true);
- },
- getRemoteVolume: function getRemoteVolume() {
- return _getVolume(handleId, true);
- },
- getLocalVolume: function getLocalVolume() {
- return _getVolume(handleId, false);
- },
- isAudioMuted: function isAudioMuted() {
- return isMuted(handleId, false);
- },
- muteAudio: function muteAudio() {
- return mute(handleId, false, true);
- },
- unmuteAudio: function unmuteAudio() {
- return mute(handleId, false, false);
- },
- isVideoMuted: function isVideoMuted() {
- return isMuted(handleId, true);
- },
- muteVideo: function muteVideo() {
- return mute(handleId, true, true);
- },
- unmuteVideo: function unmuteVideo() {
- return mute(handleId, true, false);
- },
- getBitrate: function getBitrate() {
- return _getBitrate(handleId);
- },
- send: function send(callbacks) {
- sendMessage(handleId, callbacks);
- },
- data: function data(callbacks) {
- sendData(handleId, callbacks);
- },
- dtmf: function dtmf(callbacks) {
- sendDtmf(handleId, callbacks);
- },
- consentDialog: callbacks.consentDialog,
- iceState: callbacks.iceState,
- mediaState: callbacks.mediaState,
- webrtcState: callbacks.webrtcState,
- slowLink: callbacks.slowLink,
- onmessage: callbacks.onmessage,
- createOffer: function createOffer(callbacks) {
- prepareWebrtc(handleId, true, callbacks);
- },
- createAnswer: function createAnswer(callbacks) {
- prepareWebrtc(handleId, false, callbacks);
- },
- handleRemoteJsep: function handleRemoteJsep(callbacks) {
- prepareWebrtcPeer(handleId, callbacks);
- },
- onlocalstream: callbacks.onlocalstream,
- onremotestream: callbacks.onremotestream,
- ondata: callbacks.ondata,
- ondataopen: callbacks.ondataopen,
- oncleanup: callbacks.oncleanup,
- ondetached: callbacks.ondetached,
- hangup: function hangup(sendRequest) {
- cleanupWebrtc(handleId, sendRequest === true);
- },
- detach: function detach(callbacks) {
- destroyHandle(handleId, callbacks);
- }
- };
- pluginHandles[handleId] = pluginHandle;
- callbacks.success(pluginHandle);
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- }
- });
- }
- // Private method to send a message
- function sendMessage(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- callbacks.error("Is the server down? (connected=false)");
- return;
- }
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var message = callbacks.message;
- var jsep = callbacks.jsep;
- var transaction = Janus$1.randomString(12);
- var request = {
- "rtcgw": "message",
- "body": message,
- "transaction": transaction
- };
- if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- if (jsep !== null && jsep !== undefined) request.jsep = jsep;
- Janus$1.debug("Sending message to plugin (handle=" + handleId + "):");
- Janus$1.debug(request);
- if (websockets) {
- request["session_id"] = sessionId;
- request["handle_id"] = handleId;
- transactions[transaction] = function (json) {
- Janus$1.debug("Message sent!");
- Janus$1.debug(json);
- if (json["rtcgw"] === "success") {
- // We got a success, must have been a synchronous transaction
- var plugindata = json["plugindata"];
- if (plugindata === undefined || plugindata === null) {
- Janus$1.warn("Request succeeded, but missing plugindata...");
- callbacks.success();
- return;
- }
- Janus$1.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
- var data = plugindata["data"];
- Janus$1.debug(data);
- callbacks.success(data);
- return;
- } else if (json["rtcgw"] !== "ack") {
- // Not a success and not an ack, must be an error
- if (json["error"] !== undefined && json["error"] !== null) {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error(json["error"].code + " " + json["error"].reason);
- } else {
- Janus$1.error("Unknown error"); // FIXME
- callbacks.error("Unknown error");
- }
- return;
- }
- // If we got here, the plugin decided to handle the request asynchronously
- callbacks.success();
- };
- ws.send(JSON.stringify(request));
- return;
- }
- Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
- verb: 'POST',
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.debug("Message sent!");
- Janus$1.debug(json);
- if (json["rtcgw"] === "success") {
- // We got a success, must have been a synchronous transaction
- var plugindata = json["plugindata"];
- if (plugindata === undefined || plugindata === null) {
- Janus$1.warn("Request succeeded, but missing plugindata...");
- callbacks.success();
- return;
- }
- Janus$1.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
- var data = plugindata["data"];
- Janus$1.debug(data);
- callbacks.success(data);
- return;
- } else if (json["rtcgw"] !== "ack") {
- // Not a success and not an ack, must be an error
- if (json["error"] !== undefined && json["error"] !== null) {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- callbacks.error(json["error"].code + " " + json["error"].reason);
- } else {
- Janus$1.error("Unknown error"); // FIXME
- callbacks.error("Unknown error");
- }
- return;
- }
- // If we got here, the plugin decided to handle the request asynchronously
- callbacks.success();
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- callbacks.error(textStatus + ": " + errorThrown);
- }
- });
- }
- // Private method to send a trickle candidate
- function sendTrickleCandidate(handleId, candidate) {
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- return;
- }
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return;
- }
- var request = {
- "rtcgw": "trickle",
- "candidate": candidate,
- "transaction": Janus$1.randomString(12)
- };
- if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- Janus$1.vdebug("Sending trickle candidate (handle=" + handleId + "):");
- Janus$1.vdebug(request);
- if (websockets) {
- request["session_id"] = sessionId;
- request["handle_id"] = handleId;
- ws.send(JSON.stringify(request));
- return;
- }
- Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
- verb: 'POST',
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.vdebug("Candidate sent!");
- Janus$1.vdebug(json);
- if (json["rtcgw"] !== "ack") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- return;
- }
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- }
- });
- }
- // Private method to create a data channel
- function createDataChannel(handleId, dclabel, incoming, pendingText) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- var onDataChannelMessage = function onDataChannelMessage(event) {
- Janus$1.log('Received message on data channel:', event);
- var label = event.target.label;
- pluginHandle.ondata(event.data, label);
- };
- var onDataChannelStateChange = function onDataChannelStateChange(event) {
- Janus$1.log('Received state change on data channel:', event);
- var label = event.target.label;
- var dcState = config.dataChannel[label] ? config.dataChannel[label].readyState : "null";
- Janus$1.log('State change on <' + label + '> data channel: ' + dcState);
- if (dcState === 'open') {
- // Any pending messages to send?
- if (config.dataChannel[label].pending && config.dataChannel[label].pending.length > 0) {
- Janus$1.log("Sending pending messages on <" + label + ">:", config.dataChannel[label].pending.length);
- for (var i in config.dataChannel[label].pending) {
- var text = config.dataChannel[label].pending[i];
- Janus$1.log("Sending string on data channel <" + label + ">: " + text);
- config.dataChannel[label].send(text);
- }
- config.dataChannel[label].pending = [];
- }
- // Notify the open data channel
- pluginHandle.ondataopen(label);
- }
- };
- var onDataChannelError = function onDataChannelError(error) {
- Janus$1.error('Got error on data channel:', error);
- // TODO
- };
- if (!incoming) {
- // FIXME Add options (ordered, maxRetransmits, etc.)
- config.dataChannel[dclabel] = config.pc.createDataChannel(dclabel, {
- ordered: false
- });
- } else {
- // The channel was created by Janus
- config.dataChannel[dclabel] = incoming;
- }
- config.dataChannel[dclabel].onmessage = onDataChannelMessage;
- config.dataChannel[dclabel].onopen = onDataChannelStateChange;
- config.dataChannel[dclabel].onclose = onDataChannelStateChange;
- config.dataChannel[dclabel].onerror = onDataChannelError;
- config.dataChannel[dclabel].pending = [];
- if (pendingText) config.dataChannel[dclabel].pending.push(pendingText);
- }
- // Private method to send a data channel message
- function sendData(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- var text = callbacks.text;
- if (text === null || text === undefined) {
- Janus$1.warn("Invalid text");
- callbacks.error("Invalid text");
- return;
- }
- var label = callbacks.label ? callbacks.label : Janus$1.dataChanDefaultLabel;
- if (!config.dataChannel[label]) {
- // Create new data channel and wait for it to open
- createDataChannel(handleId, label, false, text);
- callbacks.success();
- return;
- }
- if (config.dataChannel[label].readyState !== "open") {
- config.dataChannel[label].pending.push(text);
- callbacks.success();
- return;
- }
- Janus$1.log("Sending string on data channel <" + label + ">: " + text);
- config.dataChannel[label].send(text);
- callbacks.success();
- }
- // Private method to send a DTMF tone
- function sendDtmf(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- if (config.dtmfSender === null || config.dtmfSender === undefined) {
- // Create the DTMF sender the proper way, if possible
- if (config.pc !== undefined && config.pc !== null) {
- var senders = config.pc.getSenders();
- var audioSender = senders.find(function (sender) {
- return sender.track && sender.track.kind === 'audio';
- });
- if (!audioSender) {
- Janus$1.warn("Invalid DTMF configuration (no audio track)");
- callbacks.error("Invalid DTMF configuration (no audio track)");
- return;
- }
- config.dtmfSender = audioSender.dtmf;
- if (config.dtmfSender) {
- Janus$1.log("Created DTMF Sender");
- config.dtmfSender.ontonechange = function (tone) {
- Janus$1.debug("Sent DTMF tone: " + tone.tone);
- };
- }
- }
- if (config.dtmfSender === null || config.dtmfSender === undefined) {
- Janus$1.warn("Invalid DTMF configuration");
- callbacks.error("Invalid DTMF configuration");
- return;
- }
- }
- var dtmf = callbacks.dtmf;
- if (dtmf === null || dtmf === undefined) {
- Janus$1.warn("Invalid DTMF parameters");
- callbacks.error("Invalid DTMF parameters");
- return;
- }
- var tones = dtmf.tones;
- if (tones === null || tones === undefined) {
- Janus$1.warn("Invalid DTMF string");
- callbacks.error("Invalid DTMF string");
- return;
- }
- var duration = dtmf.duration;
- if (duration === null || duration === undefined) duration = 500; // We choose 500ms as the default duration for a tone
- var gap = dtmf.gap;
- if (gap === null || gap === undefined) gap = 50; // We choose 50ms as the default gap between tones
- Janus$1.debug("Sending DTMF string " + tones + " (duration " + duration + "ms, gap " + gap + "ms)");
- config.dtmfSender.insertDTMF(tones, duration, gap);
- callbacks.success();
- }
- // Private method to destroy a plugin handle
- function destroyHandle(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- var asyncRequest = true;
- if (callbacks.asyncRequest !== undefined && callbacks.asyncRequest !== null) asyncRequest = callbacks.asyncRequest === true;
- var noRequest = true;
- if (callbacks.noRequest !== undefined && callbacks.noRequest !== null) noRequest = callbacks.noRequest === true;
- Janus$1.log("Destroying handle " + handleId + " (async=" + asyncRequest + ")");
- cleanupWebrtc(handleId);
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.detached) {
- // Plugin was already detached by Janus, calling detach again will return a handle not found error, so just exit here
- delete pluginHandles[handleId];
- callbacks.success();
- return;
- }
- if (noRequest) {
- // We're only removing the handle locally
- delete pluginHandles[handleId];
- callbacks.success();
- return;
- }
- if (!connected) {
- Janus$1.warn("Is the server down? (connected=false)");
- callbacks.error("Is the server down? (connected=false)");
- return;
- }
- var request = {
- "rtcgw": "detach",
- "transaction": Janus$1.randomString(12)
- };
- if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- if (websockets) {
- request["session_id"] = sessionId;
- request["handle_id"] = handleId;
- ws.send(JSON.stringify(request));
- delete pluginHandles[handleId];
- callbacks.success();
- return;
- }
- Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
- verb: 'POST',
- async: asyncRequest,
- // Sometimes we need false here, or destroying in onbeforeunload won't work
- withCredentials: withCredentials,
- body: request,
- success: function success(json) {
- Janus$1.log("Destroyed handle:");
- Janus$1.debug(json);
- if (json["rtcgw"] !== "success") {
- Janus$1.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
- }
- delete pluginHandles[handleId];
- callbacks.success();
- },
- error: function error(textStatus, errorThrown) {
- Janus$1.error(textStatus + ":", errorThrown); // FIXME
- // We cleanup anyway
- delete pluginHandles[handleId];
- callbacks.success();
- }
- });
- }
- // WebRTC stuff
- function streamsDone(handleId, jsep, media, callbacks, stream) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- Janus$1.debug("streamsDone:", stream);
- if (stream) {
- Janus$1.debug(" -- Audio tracks:", stream.getAudioTracks());
- Janus$1.debug(" -- Video tracks:", stream.getVideoTracks());
- }
- // We're now capturing the new stream: check if we're updating or if it's a new thing
- var addTracks = false;
- if (!config.myStream || !media.update || config.streamExternal) {
- config.myStream = stream;
- addTracks = true;
- } else {
- // We only need to update the existing stream
- if ((!media.update && isAudioSendEnabled(media) || media.update && (media.addAudio || media.replaceAudio)) && stream.getAudioTracks() && stream.getAudioTracks().length) {
- config.myStream.addTrack(stream.getAudioTracks()[0]);
- if (Janus$1.unifiedPlan) {
- // Use Transceivers
- Janus$1.log((media.replaceAudio ? "Replacing" : "Adding") + " audio track:", stream.getAudioTracks()[0]);
- var audioTransceiver = null;
- var transceivers = config.pc.getTransceivers();
- if (transceivers && transceivers.length > 0) {
- for (var i in transceivers) {
- var t = transceivers[i];
- if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
- audioTransceiver = t;
- break;
- }
- }
- }
- if (audioTransceiver && audioTransceiver.sender) {
- audioTransceiver.sender.replaceTrack(stream.getAudioTracks()[0]);
- } else {
- config.pc.addTrack(stream.getAudioTracks()[0], stream);
- }
- } else {
- Janus$1.log((media.replaceAudio ? "Replacing" : "Adding") + " audio track:", stream.getAudioTracks()[0]);
- config.pc.addTrack(stream.getAudioTracks()[0], stream);
- }
- }
- if ((!media.update && isVideoSendEnabled(media) || media.update && (media.addVideo || media.replaceVideo)) && stream.getVideoTracks() && stream.getVideoTracks().length) {
- config.myStream.addTrack(stream.getVideoTracks()[0]);
- if (Janus$1.unifiedPlan) {
- // Use Transceivers
- Janus$1.log((media.replaceVideo ? "Replacing" : "Adding") + " video track:", stream.getVideoTracks()[0]);
- var videoTransceiver = null;
- var transceivers = config.pc.getTransceivers();
- if (transceivers && transceivers.length > 0) {
- for (var i in transceivers) {
- var t = transceivers[i];
- if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
- videoTransceiver = t;
- break;
- }
- }
- }
- if (videoTransceiver && videoTransceiver.sender) {
- videoTransceiver.sender.replaceTrack(stream.getVideoTracks()[0]);
- } else {
- config.pc.addTrack(stream.getVideoTracks()[0], stream);
- }
- } else {
- Janus$1.log((media.replaceVideo ? "Replacing" : "Adding") + " video track:", stream.getVideoTracks()[0]);
- config.pc.addTrack(stream.getVideoTracks()[0], stream);
- }
- }
- }
- // If we still need to create a PeerConnection, let's do that
- if (!config.pc) {
- var pc_config = {
- "iceServers": iceServers,
- "iceTransportPolicy": iceTransportPolicy,
- "bundlePolicy": bundlePolicy
- };
- if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
- // For Chrome versions before 72, we force a plan-b semantic, and unified-plan otherwise
- pc_config["sdpSemantics"] = Janus$1.webRTCAdapter.browserDetails.version < 72 ? "plan-b" : "unified-plan";
- }
- var pc_constraints = {
- "optional": [{
- "DtlsSrtpKeyAgreement": true
- }]
- };
- if (ipv6Support === true) {
- pc_constraints.optional.push({
- "googIPv6": true
- });
- }
- // Any custom constraint to add?
- if (callbacks.rtcConstraints && _typeof(callbacks.rtcConstraints) === 'object') {
- Janus$1.debug("Adding custom PeerConnection constraints:", callbacks.rtcConstraints);
- for (var i in callbacks.rtcConstraints) {
- pc_constraints.optional.push(callbacks.rtcConstraints[i]);
- }
- }
- if (Janus$1.webRTCAdapter.browserDetails.browser === "edge") {
- // This is Edge, enable BUNDLE explicitly
- pc_config.bundlePolicy = "max-bundle";
- }
- Janus$1.log("Creating PeerConnection");
- Janus$1.debug(pc_constraints);
- config.pc = new RTCPeerConnection(pc_config, pc_constraints);
- Janus$1.debug(config.pc);
- if (config.pc.getStats) {
- // FIXME
- config.volume = {};
- config.bitrate.value = "0 kbits/sec";
- }
- Janus$1.log("Preparing local SDP and gathering candidates (trickle=" + config.trickle + ")");
- config.pc.oniceconnectionstatechange = function (e) {
- if (config.pc) pluginHandle.iceState(config.pc.iceConnectionState);
- };
- config.pc.onicecandidate = function (event) {
- if (event.candidate == null || Janus$1.webRTCAdapter.browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {
- Janus$1.log("End of candidates.");
- config.iceDone = true;
- if (config.trickle === true) {
- // Notify end of candidates
- sendTrickleCandidate(handleId, {
- "completed": true
- });
- } else {
- // No trickle, time to send the complete SDP (including all candidates)
- sendSDP(handleId, callbacks);
- }
- } else {
- // JSON.stringify doesn't work on some WebRTC objects anymore
- // See https://code.google.com/p/chromium/issues/detail?id=467366
- var candidate = {
- "candidate": event.candidate.candidate,
- "sdpMid": event.candidate.sdpMid,
- "sdpMLineIndex": event.candidate.sdpMLineIndex
- };
- if (config.trickle === true) {
- // Send candidate
- sendTrickleCandidate(handleId, candidate);
- }
- }
- };
- config.pc.ontrack = function (event) {
- Janus$1.log("Handling Remote Track");
- Janus$1.debug(event);
- if (!event.streams) return;
- config.remoteStream = event.streams[0];
- pluginHandle.onremotestream(config.remoteStream);
- if (event.track.onended) return;
- Janus$1.log("Adding onended callback to track:", event.track);
- event.track.onended = function (ev) {
- Janus$1.log("Remote track muted/removed:", ev);
- if (config.remoteStream) {
- config.remoteStream.removeTrack(ev.target);
- pluginHandle.onremotestream(config.remoteStream);
- }
- };
- event.track.onmute = event.track.onended;
- event.track.onunmute = function (ev) {
- Janus$1.log("Remote track flowing again:", ev);
- try {
- config.remoteStream.addTrack(ev.target);
- pluginHandle.onremotestream(config.remoteStream);
- } catch (e) {
- Janus$1.error(e);
- }
- };
- };
- }
- if (addTracks && stream !== null && stream !== undefined) {
- Janus$1.log('Adding local stream');
- var simulcast2 = callbacks.simulcast2 === true ? true : false;
- stream.getTracks().forEach(function (track) {
- Janus$1.log('Adding local track:', track);
- if (!simulcast2) {
- config.pc.addTrack(track, stream);
- } else {
- if (track.kind === "audio") {
- config.pc.addTrack(track, stream);
- } else {
- Janus$1.log('Enabling rid-based simulcasting:', track);
- var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
- config.pc.addTransceiver(track, {
- direction: "sendrecv",
- streams: [stream],
- sendEncodings: [{
- rid: "h",
- active: true,
- maxBitrate: maxBitrates.high
- }, {
- rid: "m",
- active: true,
- maxBitrate: maxBitrates.medium,
- scaleResolutionDownBy: 2
- }, {
- rid: "l",
- active: true,
- maxBitrate: maxBitrates.low,
- scaleResolutionDownBy: 4
- }]
- });
- }
- }
- });
- }
- // Any data channel to create?
- if (isDataEnabled(media) && !config.dataChannel[Janus$1.dataChanDefaultLabel]) {
- Janus$1.log("Creating data channel");
- createDataChannel(handleId, Janus$1.dataChanDefaultLabel, false);
- config.pc.ondatachannel = function (event) {
- Janus$1.log("Data channel created by Janus:", event);
- createDataChannel(handleId, event.channel.label, event.channel);
- };
- }
- // If there's a new local stream, let's notify the application
- if (config.myStream) pluginHandle.onlocalstream(config.myStream);
- // Create offer/answer now
- if (jsep === null || jsep === undefined) {
- createOffer(handleId, media, callbacks);
- } else {
- config.pc.setRemoteDescription(jsep).then(function () {
- Janus$1.log("Remote description accepted!");
- config.remoteSdp = jsep.sdp;
- // Any trickle candidate we cached?
- if (config.candidates && config.candidates.length > 0) {
- for (var i = 0; i < config.candidates.length; i++) {
- var candidate = config.candidates[i];
- Janus$1.debug("Adding remote candidate:", candidate);
- if (!candidate || candidate.completed === true) {
- // end-of-candidates
- config.pc.addIceCandidate(Janus$1.endOfCandidates);
- } else {
- // New candidate
- config.pc.addIceCandidate(candidate);
- }
- }
- config.candidates = [];
- }
- // Create the answer now
- createAnswer(handleId, media, callbacks);
- }, callbacks.error);
- }
- }
- function prepareWebrtc(handleId, offer, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
- var jsep = callbacks.jsep;
- if (offer && jsep) {
- Janus$1.error("Provided a JSEP to a createOffer");
- callbacks.error("Provided a JSEP to a createOffer");
- return;
- } else if (!offer && (!jsep || !jsep.type || !jsep.sdp)) {
- Janus$1.error("A valid JSEP is required for createAnswer");
- callbacks.error("A valid JSEP is required for createAnswer");
- return;
- }
- callbacks.media = callbacks.media || {
- audio: true,
- video: true
- };
- var media = callbacks.media;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- config.trickle = isTrickleEnabled(callbacks.trickle);
- // Are we updating a session?
- if (config.pc === undefined || config.pc === null) {
- // Nope, new PeerConnection
- media.update = false;
- media.keepAudio = false;
- media.keepVideo = false;
- } else if (config.pc !== undefined && config.pc !== null) {
- Janus$1.log("Updating existing media session");
- media.update = true;
- // Check if there's anything to add/remove/replace, or if we
- // can go directly to preparing the new SDP offer or answer
- if (callbacks.stream !== null && callbacks.stream !== undefined) {
- // External stream: is this the same as the one we were using before?
- if (callbacks.stream !== config.myStream) {
- Janus$1.log("Renegotiation involves a new external stream");
- }
- } else {
- // Check if there are changes on audio
- if (media.addAudio) {
- media.keepAudio = false;
- media.replaceAudio = false;
- media.removeAudio = false;
- media.audioSend = true;
- if (config.myStream && config.myStream.getAudioTracks() && config.myStream.getAudioTracks().length) {
- Janus$1.error("Can't add audio stream, there already is one");
- callbacks.error("Can't add audio stream, there already is one");
- return;
- }
- } else if (media.removeAudio) {
- media.keepAudio = false;
- media.replaceAudio = false;
- media.addAudio = false;
- media.audioSend = false;
- } else if (media.replaceAudio) {
- media.keepAudio = false;
- media.addAudio = false;
- media.removeAudio = false;
- media.audioSend = true;
- }
- if (config.myStream === null || config.myStream === undefined) {
- // No media stream: if we were asked to replace, it's actually an "add"
- if (media.replaceAudio) {
- media.keepAudio = false;
- media.replaceAudio = false;
- media.addAudio = true;
- media.audioSend = true;
- }
- if (isAudioSendEnabled(media)) {
- media.keepAudio = false;
- media.addAudio = true;
- }
- } else {
- if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
- // No audio track: if we were asked to replace, it's actually an "add"
- if (media.replaceAudio) {
- media.keepAudio = false;
- media.replaceAudio = false;
- media.addAudio = true;
- media.audioSend = true;
- }
- if (isAudioSendEnabled(media)) {
- media.keepVideo = false;
- media.addAudio = true;
- }
- } else {
- // We have an audio track: should we keep it as it is?
- if (isAudioSendEnabled(media) && !media.removeAudio && !media.replaceAudio) {
- media.keepAudio = true;
- }
- }
- }
- // Check if there are changes on video
- if (media.addVideo) {
- media.keepVideo = false;
- media.replaceVideo = false;
- media.removeVideo = false;
- media.videoSend = true;
- if (config.myStream && config.myStream.getVideoTracks() && config.myStream.getVideoTracks().length) {
- Janus$1.error("Can't add video stream, there already is one");
- callbacks.error("Can't add video stream, there already is one");
- return;
- }
- } else if (media.removeVideo) {
- media.keepVideo = false;
- media.replaceVideo = false;
- media.addVideo = false;
- media.videoSend = false;
- } else if (media.replaceVideo) {
- media.keepVideo = false;
- media.addVideo = false;
- media.removeVideo = false;
- media.videoSend = true;
- }
- if (config.myStream === null || config.myStream === undefined) {
- // No media stream: if we were asked to replace, it's actually an "add"
- if (media.replaceVideo) {
- media.keepVideo = false;
- media.replaceVideo = false;
- media.addVideo = true;
- media.videoSend = true;
- }
- if (isVideoSendEnabled(media)) {
- media.keepVideo = false;
- media.addVideo = true;
- }
- } else {
- if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
- // No video track: if we were asked to replace, it's actually an "add"
- if (media.replaceVideo) {
- media.keepVideo = false;
- media.replaceVideo = false;
- media.addVideo = true;
- media.videoSend = true;
- }
- if (isVideoSendEnabled(media)) {
- media.keepVideo = false;
- media.addVideo = true;
- }
- } else {
- // We have a video track: should we keep it as it is?
- if (isVideoSendEnabled(media) && !media.removeVideo && !media.replaceVideo) {
- media.keepVideo = true;
- }
- }
- }
- // Data channels can only be added
- if (media.addData) media.data = true;
- }
- // If we're updating and keeping all tracks, let's skip the getUserMedia part
- if (isAudioSendEnabled(media) && media.keepAudio && isVideoSendEnabled(media) && media.keepVideo) {
- pluginHandle.consentDialog(false);
- streamsDone(handleId, jsep, media, callbacks, config.myStream);
- return;
- }
- }
- // If we're updating, check if we need to remove/replace one of the tracks
- if (media.update && !config.streamExternal) {
- if (media.removeAudio || media.replaceAudio) {
- if (config.myStream && config.myStream.getAudioTracks() && config.myStream.getAudioTracks().length) {
- var s = config.myStream.getAudioTracks()[0];
- Janus$1.log("Removing audio track:", s);
- config.myStream.removeTrack(s);
- try {
- s.stop();
- } catch (e) {}
- }
- if (config.pc.getSenders() && config.pc.getSenders().length) {
- var ra = true;
- if (media.replaceAudio && Janus$1.unifiedPlan) {
- // We can use replaceTrack
- ra = false;
- }
- if (ra) {
- for (var index in config.pc.getSenders()) {
- var s = config.pc.getSenders()[index];
- if (s && s.track && s.track.kind === "audio") {
- Janus$1.log("Removing audio sender:", s);
- config.pc.removeTrack(s);
- }
- }
- }
- }
- }
- if (media.removeVideo || media.replaceVideo) {
- if (config.myStream && config.myStream.getVideoTracks() && config.myStream.getVideoTracks().length) {
- var s = config.myStream.getVideoTracks()[0];
- Janus$1.log("Removing video track:", s);
- config.myStream.removeTrack(s);
- try {
- s.stop();
- } catch (e) {}
- }
- if (config.pc.getSenders() && config.pc.getSenders().length) {
- var rv = true;
- if (media.replaceVideo && Janus$1.unifiedPlan) {
- // We can use replaceTrack
- rv = false;
- }
- if (rv) {
- for (var index in config.pc.getSenders()) {
- var s = config.pc.getSenders()[index];
- if (s && s.track && s.track.kind === "video") {
- Janus$1.log("Removing video sender:", s);
- config.pc.removeTrack(s);
- }
- }
- }
- }
- }
- }
- // Was a MediaStream object passed, or do we need to take care of that?
- if (callbacks.stream !== null && callbacks.stream !== undefined) {
- var stream = callbacks.stream;
- Janus$1.log("MediaStream provided by the application");
- Janus$1.debug(stream);
- // If this is an update, let's check if we need to release the previous stream
- if (media.update) {
- if (config.myStream && config.myStream !== callbacks.stream && !config.streamExternal) {
- // We're replacing a stream we captured ourselves with an external one
- try {
- // Try a MediaStreamTrack.stop() for each track
- var tracks = config.myStream.getTracks();
- for (var i in tracks) {
- var mst = tracks[i];
- Janus$1.log(mst);
- if (mst !== null && mst !== undefined) mst.stop();
- }
- } catch (e) {
- // Do nothing if this fails
- }
- config.myStream = null;
- }
- }
- // Skip the getUserMedia part
- config.streamExternal = true;
- pluginHandle.consentDialog(false);
- streamsDone(handleId, jsep, media, callbacks, stream);
- return;
- }
- if (isAudioSendEnabled(media) || isVideoSendEnabled(media)) {
- if (!Janus$1.isGetUserMediaAvailable()) {
- callbacks.error("getUserMedia not available");
- return;
- }
- var constraints = {
- mandatory: {},
- optional: []
- };
- pluginHandle.consentDialog(true);
- var audioSupport = isAudioSendEnabled(media);
- if (audioSupport === true && media != undefined && media != null) {
- if (_typeof(media.audio) === 'object') {
- audioSupport = media.audio;
- }
- }
- var videoSupport = isVideoSendEnabled(media);
- if (videoSupport === true && media != undefined && media != null) {
- var simulcast = callbacks.simulcast === true ? true : false;
- var simulcast2 = callbacks.simulcast2 === true ? true : false;
- if ((simulcast || simulcast2) && !jsep && (media.video === undefined || media.video === false)) media.video = "hires";
- if (media.video && media.video != 'screen' && media.video != 'window') {
- if (_typeof(media.video) === 'object') {
- videoSupport = media.video;
- } else {
- var width = 0;
- var height = 0;
- if (media.video === 'lowres') {
- // Small resolution, 4:3
- height = 240;
- width = 320;
- } else if (media.video === 'lowres-16:9') {
- // Small resolution, 16:9
- height = 180;
- width = 320;
- } else if (media.video === 'hires' || media.video === 'hires-16:9' || media.video === 'hdres') {
- // High(HD) resolution is only 16:9
- height = 720;
- width = 1280;
- } else if (media.video === 'fhdres') {
- // Full HD resolution is only 16:9
- height = 1080;
- width = 1920;
- } else if (media.video === '4kres') {
- // 4K resolution is only 16:9
- height = 2160;
- width = 3840;
- } else if (media.video === 'stdres') {
- // Normal resolution, 4:3
- height = 480;
- width = 640;
- } else if (media.video === 'stdres-16:9') {
- // Normal resolution, 16:9
- height = 360;
- width = 640;
- } else {
- Janus$1.log("Default video setting is stdres 4:3");
- height = 480;
- width = 640;
- }
- Janus$1.log("Adding media constraint:", media.video);
- videoSupport = {
- 'height': {
- 'ideal': height
- },
- 'width': {
- 'ideal': width
- }
- };
- Janus$1.log("Adding video constraint:", videoSupport);
- }
- } else if (media.video === 'screen' || media.video === 'window') {
- // We're going to try and use the extension for Chrome 34+, the old approach
- // for older versions of Chrome, or the experimental support in Firefox 33+
- var callbackUserMedia = function callbackUserMedia(error, stream) {
- pluginHandle.consentDialog(false);
- if (error) {
- callbacks.error(error);
- } else {
- streamsDone(handleId, jsep, media, callbacks, stream);
- }
- };
- var getScreenMedia = function getScreenMedia(constraints, gsmCallback, useAudio) {
- Janus$1.log("Adding media constraint (screen capture)");
- Janus$1.debug(constraints);
- navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
- if (useAudio) {
- navigator.mediaDevices.getUserMedia({
- audio: true,
- video: false
- }).then(function (audioStream) {
- stream.addTrack(audioStream.getAudioTracks()[0]);
- gsmCallback(null, stream);
- });
- } else {
- gsmCallback(null, stream);
- }
- })["catch"](function (error) {
- pluginHandle.consentDialog(false);
- gsmCallback(error);
- });
- };
- if (!media.screenshareFrameRate) {
- media.screenshareFrameRate = 3;
- }
- if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
- // The new experimental getDisplayMedia API is available, let's use that
- // https://groups.google.com/forum/#!topic/discuss-webrtc/Uf0SrR4uxzk
- // https://webrtchacks.com/chrome-screensharing-getdisplaymedia/
- navigator.mediaDevices.getDisplayMedia({
- video: true
- }).then(function (stream) {
- pluginHandle.consentDialog(false);
- if (isAudioSendEnabled(media) && !media.keepAudio) {
- navigator.mediaDevices.getUserMedia({
- audio: true,
- video: false
- }).then(function (audioStream) {
- stream.addTrack(audioStream.getAudioTracks()[0]);
- streamsDone(handleId, jsep, media, callbacks, stream);
- });
- } else {
- streamsDone(handleId, jsep, media, callbacks, stream);
- }
- }, function (error) {
- pluginHandle.consentDialog(false);
- callbacks.error(error);
- });
- return;
- }
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome') {
- var chromever = Janus$1.webRTCAdapter.browserDetails.version;
- var maxver = 33;
- if (window.navigator.userAgent.match('Linux')) maxver = 35; // "known" crash in chrome 34 and 35 on linux
- if (chromever >= 26 && chromever <= maxver) {
- // Chrome 26->33 requires some awkward chrome://flags manipulation
- constraints = {
- video: {
- mandatory: {
- googLeakyBucket: true,
- maxWidth: window.screen.width,
- maxHeight: window.screen.height,
- minFrameRate: media.screenshareFrameRate,
- maxFrameRate: media.screenshareFrameRate,
- chromeMediaSource: 'screen'
- }
- },
- audio: isAudioSendEnabled(media) && !media.keepAudio
- };
- getScreenMedia(constraints, callbackUserMedia);
- } else {
- // Chrome 34+ requires an extension
- Janus$1.extension.getScreen(function (error, sourceId) {
- if (error) {
- pluginHandle.consentDialog(false);
- return callbacks.error(error);
- }
- constraints = {
- audio: false,
- video: {
- mandatory: {
- chromeMediaSource: 'desktop',
- maxWidth: window.screen.width,
- maxHeight: window.screen.height,
- minFrameRate: media.screenshareFrameRate,
- maxFrameRate: media.screenshareFrameRate
- },
- optional: [{
- googLeakyBucket: true
- }, {
- googTemporalLayeredScreencast: true
- }]
- }
- };
- constraints.video.mandatory.chromeMediaSourceId = sourceId;
- getScreenMedia(constraints, callbackUserMedia, isAudioSendEnabled(media) && !media.keepAudio);
- });
- }
- } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'firefox') {
- if (Janus$1.webRTCAdapter.browserDetails.version >= 33) {
- // Firefox 33+ has experimental support for screen sharing
- constraints = {
- video: {
- mozMediaSource: media.video,
- mediaSource: media.video
- },
- audio: isAudioSendEnabled(media) && !media.keepAudio
- };
- getScreenMedia(constraints, function (err, stream) {
- callbackUserMedia(err, stream);
- // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1045810
- if (!err) {
- var lastTime = stream.currentTime;
- var polly = window.setInterval(function () {
- if (!stream) window.clearInterval(polly);
- if (stream.currentTime == lastTime) {
- window.clearInterval(polly);
- if (stream.onended) {
- stream.onended();
- }
- }
- lastTime = stream.currentTime;
- }, 500);
- }
- });
- } else {
- var error = new Error('NavigatorUserMediaError');
- error.name = 'Your version of Firefox does not support screen sharing, please install Firefox 33 (or more recent versions)';
- pluginHandle.consentDialog(false);
- callbacks.error(error);
- return;
- }
- }
- return;
- }
- }
- // If we got here, we're not screensharing
- if (media === null || media === undefined || media.video !== 'screen') {
- // Check whether all media sources are actually available or not
- navigator.mediaDevices.enumerateDevices().then(function (devices) {
- var audioExist = devices.some(function (device) {
- return device.kind === 'audioinput';
- }),
- videoExist = isScreenSendEnabled(media) || devices.some(function (device) {
- return device.kind === 'videoinput';
- });
- // Check whether a missing device is really a problem
- var audioSend = isAudioSendEnabled(media);
- var videoSend = isVideoSendEnabled(media);
- var needAudioDevice = isAudioSendRequired(media);
- var needVideoDevice = isVideoSendRequired(media);
- if (audioSend || videoSend || needAudioDevice || needVideoDevice) {
- // We need to send either audio or video
- var haveAudioDevice = audioSend ? audioExist : false;
- var haveVideoDevice = videoSend ? videoExist : false;
- if (!haveAudioDevice && !haveVideoDevice) {
- // FIXME Should we really give up, or just assume recvonly for both?
- pluginHandle.consentDialog(false);
- callbacks.error('No capture device found');
- return false;
- } else if (!haveAudioDevice && needAudioDevice) {
- pluginHandle.consentDialog(false);
- callbacks.error('Audio capture is required, but no capture device found');
- return false;
- } else if (!haveVideoDevice && needVideoDevice) {
- pluginHandle.consentDialog(false);
- callbacks.error('Video capture is required, but no capture device found');
- return false;
- }
- }
- var gumConstraints = {
- audio: audioExist && !media.keepAudio ? audioSupport : false,
- video: videoExist && !media.keepVideo ? videoSupport : false
- };
- Janus$1.debug("getUserMedia constraints", gumConstraints);
- if (!gumConstraints.audio && !gumConstraints.video) {
- pluginHandle.consentDialog(false);
- streamsDone(handleId, jsep, media, callbacks, stream);
- } else {
- navigator.mediaDevices.getUserMedia(gumConstraints).then(function (stream) {
- pluginHandle.consentDialog(false);
- streamsDone(handleId, jsep, media, callbacks, stream);
- })["catch"](function (error) {
- pluginHandle.consentDialog(false);
- callbacks.error({
- code: error.code,
- name: error.name,
- message: error.message
- });
- });
- }
- })["catch"](function (error) {
- pluginHandle.consentDialog(false);
- callbacks.error('enumerateDevices error', error);
- });
- }
- } else {
- // No need to do a getUserMedia, create offer/answer right away
- streamsDone(handleId, jsep, media, callbacks);
- }
- }
- function prepareWebrtcPeer(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
- var jsep = callbacks.jsep;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- if (jsep !== undefined && jsep !== null) {
- if (config.pc === null) {
- Janus$1.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep");
- callbacks.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");
- return;
- }
- config.pc.setRemoteDescription(jsep).then(function () {
- Janus$1.log("Remote description accepted!");
- config.remoteSdp = jsep.sdp;
- // Any trickle candidate we cached?
- if (config.candidates && config.candidates.length > 0) {
- for (var i = 0; i < config.candidates.length; i++) {
- var candidate = config.candidates[i];
- Janus$1.debug("Adding remote candidate:", candidate);
- if (!candidate || candidate.completed === true) {
- // end-of-candidates
- config.pc.addIceCandidate(Janus$1.endOfCandidates);
- } else {
- // New candidate
- config.pc.addIceCandidate(candidate);
- }
- }
- config.candidates = [];
- }
- // Done
- callbacks.success();
- }, callbacks.error);
- } else {
- callbacks.error("Invalid JSEP");
- }
- }
- function createOffer(handleId, media, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus$1.noop;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- var simulcast = callbacks.simulcast === true ? true : false;
- if (!simulcast) {
- Janus$1.log("Creating offer (iceDone=" + config.iceDone + ")");
- } else {
- Janus$1.log("Creating offer (iceDone=" + config.iceDone + ", simulcast=" + simulcast + ")");
- }
- // https://code.google.com/p/webrtc/issues/detail?id=3508
- var mediaConstraints = {};
- if (Janus$1.unifiedPlan) {
- // We can use Transceivers
- var audioTransceiver = null,
- videoTransceiver = null;
- var transceivers = config.pc.getTransceivers();
- if (transceivers && transceivers.length > 0) {
- for (var i in transceivers) {
- var t = transceivers[i];
- if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
- if (!audioTransceiver) audioTransceiver = t;
- continue;
- }
- if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
- if (!videoTransceiver) videoTransceiver = t;
- continue;
- }
- }
- }
- // Handle audio (and related changes, if any)
- var audioSend = isAudioSendEnabled(media);
- var audioRecv = isAudioRecvEnabled(media);
- if (!audioSend && !audioRecv) {
- // Audio disabled: have we removed it?
- if (media.removeAudio && audioTransceiver) {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("inactive");
- } else {
- audioTransceiver.direction = "inactive";
- }
- Janus$1.log("Setting audio transceiver to inactive:", audioTransceiver);
- }
- } else {
- // Take care of audio m-line
- if (audioSend && audioRecv) {
- if (audioTransceiver) {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("sendrecv");
- } else {
- audioTransceiver.direction = "sendrecv";
- }
- Janus$1.log("Setting audio transceiver to sendrecv:", audioTransceiver);
- }
- } else if (audioSend && !audioRecv) {
- if (audioTransceiver) {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("sendonly");
- } else {
- audioTransceiver.direction = "sendonly";
- }
- Janus$1.log("Setting audio transceiver to sendonly:", audioTransceiver);
- }
- } else if (!audioSend && audioRecv) {
- if (audioTransceiver) {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("recvonly");
- } else {
- audioTransceiver.direction = "recvonly";
- }
- Janus$1.log("Setting audio transceiver to recvonly:", audioTransceiver);
- } else {
- // In theory, this is the only case where we might not have a transceiver yet
- audioTransceiver = config.pc.addTransceiver("audio", {
- direction: "recvonly"
- });
- Janus$1.log("Adding recvonly audio transceiver:", audioTransceiver);
- }
- }
- }
- // Handle video (and related changes, if any)
- var videoSend = isVideoSendEnabled(media);
- var videoRecv = isVideoRecvEnabled(media);
- if (!videoSend && !videoRecv) {
- // Video disabled: have we removed it?
- if (media.removeVideo && videoTransceiver) {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("inactive");
- } else {
- videoTransceiver.direction = "inactive";
- }
- Janus$1.log("Setting video transceiver to inactive:", videoTransceiver);
- }
- } else {
- // Take care of video m-line
- if (videoSend && videoRecv) {
- if (videoTransceiver) {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("sendrecv");
- } else {
- videoTransceiver.direction = "sendrecv";
- }
- Janus$1.log("Setting video transceiver to sendrecv:", videoTransceiver);
- }
- } else if (videoSend && !videoRecv) {
- if (videoTransceiver) {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("sendonly");
- } else {
- videoTransceiver.direction = "sendonly";
- }
- Janus$1.log("Setting video transceiver to sendonly:", videoTransceiver);
- }
- } else if (!videoSend && videoRecv) {
- if (videoTransceiver) {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("recvonly");
- } else {
- videoTransceiver.direction = "recvonly";
- }
- Janus$1.log("Setting video transceiver to recvonly:", videoTransceiver);
- } else {
- // In theory, this is the only case where we might not have a transceiver yet
- videoTransceiver = config.pc.addTransceiver("video", {
- direction: "recvonly"
- });
- Janus$1.log("Adding recvonly video transceiver:", videoTransceiver);
- }
- }
- }
- } else {
- mediaConstraints["offerToReceiveAudio"] = isAudioRecvEnabled(media);
- mediaConstraints["offerToReceiveVideo"] = isVideoRecvEnabled(media);
- }
- var iceRestart = callbacks.iceRestart === true ? true : false;
- if (iceRestart) {
- mediaConstraints["iceRestart"] = true;
- }
- Janus$1.debug(mediaConstraints);
- // Check if this is Firefox and we've been asked to do simulcasting
- var sendVideo = isVideoSendEnabled(media);
- if (sendVideo && simulcast && Janus$1.webRTCAdapter.browserDetails.browser === "firefox") {
- // FIXME Based on https://gist.github.com/voluntas/088bc3cc62094730647b
- Janus$1.log("Enabling Simulcasting for Firefox (RID)");
- var sender = config.pc.getSenders().find(function (s) {
- return s.track.kind == "video";
- });
- if (sender) {
- var parameters = sender.getParameters();
- if (!parameters) parameters = {};
- var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
- parameters.encodings = [{
- rid: "h",
- active: true,
- maxBitrate: maxBitrates.high
- }, {
- rid: "m",
- active: true,
- maxBitrate: maxBitrates.medium,
- scaleResolutionDownBy: 2
- }, {
- rid: "l",
- active: true,
- maxBitrate: maxBitrates.low,
- scaleResolutionDownBy: 4
- }];
- sender.setParameters(parameters);
- }
- }
- config.pc.createOffer(mediaConstraints).then(function (offer) {
- Janus$1.debug(offer);
- // JSON.stringify doesn't work on some WebRTC objects anymore
- // See https://code.google.com/p/chromium/issues/detail?id=467366
- var jsep = {
- "type": offer.type,
- "sdp": offer.sdp
- };
- callbacks.customizeSdp(jsep);
- offer.sdp = jsep.sdp;
- Janus$1.log("Setting local description");
- if (sendVideo && simulcast) {
- // This SDP munging only works with Chrome (Safari STP may support it too)
- if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome" || Janus$1.webRTCAdapter.browserDetails.browser === "safari") {
- Janus$1.log("Enabling Simulcasting for Chrome (SDP munging)");
- offer.sdp = mungeSdpForSimulcasting(offer.sdp);
- } else if (Janus$1.webRTCAdapter.browserDetails.browser !== "firefox") {
- Janus$1.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
- }
- }
- config.mySdp = offer.sdp;
- config.pc.setLocalDescription(offer)["catch"](callbacks.error);
- config.mediaConstraints = mediaConstraints;
- if (!config.iceDone && !config.trickle) {
- // Don't do anything until we have all candidates
- Janus$1.log("Waiting for all candidates...");
- return;
- }
- Janus$1.log("Offer ready");
- Janus$1.debug(callbacks);
- callbacks.success(offer);
- }, callbacks.error);
- }
- function createAnswer(handleId, media, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus$1.noop;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- callbacks.error("Invalid handle");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- var simulcast = callbacks.simulcast === true ? true : false;
- if (!simulcast) {
- Janus$1.log("Creating answer (iceDone=" + config.iceDone + ")");
- } else {
- Janus$1.log("Creating answer (iceDone=" + config.iceDone + ", simulcast=" + simulcast + ")");
- }
- var mediaConstraints = null;
- if (Janus$1.unifiedPlan) {
- // We can use Transceivers
- mediaConstraints = {};
- var audioTransceiver = null,
- videoTransceiver = null;
- var transceivers = config.pc.getTransceivers();
- if (transceivers && transceivers.length > 0) {
- for (var i in transceivers) {
- var t = transceivers[i];
- if (t.sender && t.sender.track && t.sender.track.kind === "audio" || t.receiver && t.receiver.track && t.receiver.track.kind === "audio") {
- if (!audioTransceiver) audioTransceiver = t;
- continue;
- }
- if (t.sender && t.sender.track && t.sender.track.kind === "video" || t.receiver && t.receiver.track && t.receiver.track.kind === "video") {
- if (!videoTransceiver) videoTransceiver = t;
- continue;
- }
- }
- }
- // Handle audio (and related changes, if any)
- var audioSend = isAudioSendEnabled(media);
- var audioRecv = isAudioRecvEnabled(media);
- if (!audioSend && !audioRecv) {
- // Audio disabled: have we removed it?
- if (media.removeAudio && audioTransceiver) {
- try {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("inactive");
- } else {
- audioTransceiver.direction = "inactive";
- }
- Janus$1.log("Setting audio transceiver to inactive:", audioTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- }
- } else {
- // Take care of audio m-line
- if (audioSend && audioRecv) {
- if (audioTransceiver) {
- try {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("sendrecv");
- } else {
- audioTransceiver.direction = "sendrecv";
- }
- Janus$1.log("Setting audio transceiver to sendrecv:", audioTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- }
- } else if (audioSend && !audioRecv) {
- try {
- if (audioTransceiver) {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("sendonly");
- } else {
- audioTransceiver.direction = "sendonly";
- }
- Janus$1.log("Setting audio transceiver to sendonly:", audioTransceiver);
- }
- } catch (e) {
- Janus$1.error(e);
- }
- } else if (!audioSend && audioRecv) {
- if (audioTransceiver) {
- try {
- if (audioTransceiver.setDirection) {
- audioTransceiver.setDirection("recvonly");
- } else {
- audioTransceiver.direction = "recvonly";
- }
- Janus$1.log("Setting audio transceiver to recvonly:", audioTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- } else {
- // In theory, this is the only case where we might not have a transceiver yet
- audioTransceiver = config.pc.addTransceiver("audio", {
- direction: "recvonly"
- });
- Janus$1.log("Adding recvonly audio transceiver:", audioTransceiver);
- }
- }
- }
- // Handle video (and related changes, if any)
- var videoSend = isVideoSendEnabled(media);
- var videoRecv = isVideoRecvEnabled(media);
- if (!videoSend && !videoRecv) {
- // Video disabled: have we removed it?
- if (media.removeVideo && videoTransceiver) {
- try {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("inactive");
- } else {
- videoTransceiver.direction = "inactive";
- }
- Janus$1.log("Setting video transceiver to inactive:", videoTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- }
- } else {
- // Take care of video m-line
- if (videoSend && videoRecv) {
- if (videoTransceiver) {
- try {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("sendrecv");
- } else {
- videoTransceiver.direction = "sendrecv";
- }
- Janus$1.log("Setting video transceiver to sendrecv:", videoTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- }
- } else if (videoSend && !videoRecv) {
- if (videoTransceiver) {
- try {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("sendonly");
- } else {
- videoTransceiver.direction = "sendonly";
- }
- Janus$1.log("Setting video transceiver to sendonly:", videoTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- }
- } else if (!videoSend && videoRecv) {
- if (videoTransceiver) {
- try {
- if (videoTransceiver.setDirection) {
- videoTransceiver.setDirection("recvonly");
- } else {
- videoTransceiver.direction = "recvonly";
- }
- Janus$1.log("Setting video transceiver to recvonly:", videoTransceiver);
- } catch (e) {
- Janus$1.error(e);
- }
- } else {
- // In theory, this is the only case where we might not have a transceiver yet
- videoTransceiver = config.pc.addTransceiver("video", {
- direction: "recvonly"
- });
- Janus$1.log("Adding recvonly video transceiver:", videoTransceiver);
- }
- }
- }
- } else {
- if (Janus$1.webRTCAdapter.browserDetails.browser == "firefox" || Janus$1.webRTCAdapter.browserDetails.browser == "edge") {
- mediaConstraints = {
- offerToReceiveAudio: isAudioRecvEnabled(media),
- offerToReceiveVideo: isVideoRecvEnabled(media)
- };
- } else {
- mediaConstraints = {
- mandatory: {
- OfferToReceiveAudio: isAudioRecvEnabled(media),
- OfferToReceiveVideo: isVideoRecvEnabled(media)
- }
- };
- }
- }
- Janus$1.debug(mediaConstraints);
- // Check if this is Firefox and we've been asked to do simulcasting
- var sendVideo = isVideoSendEnabled(media);
- if (sendVideo && simulcast && Janus$1.webRTCAdapter.browserDetails.browser === "firefox") {
- // FIXME Based on https://gist.github.com/voluntas/088bc3cc62094730647b
- Janus$1.log("Enabling Simulcasting for Firefox (RID)");
- var sender = config.pc.getSenders()[1];
- Janus$1.log(sender);
- var parameters = sender.getParameters();
- Janus$1.log(parameters);
- var maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
- sender.setParameters({
- encodings: [{
- rid: "high",
- active: true,
- priority: "high",
- maxBitrate: maxBitrates.high
- }, {
- rid: "medium",
- active: true,
- priority: "medium",
- maxBitrate: maxBitrates.medium
- }, {
- rid: "low",
- active: true,
- priority: "low",
- maxBitrate: maxBitrates.low
- }]
- });
- }
- config.pc.createAnswer(mediaConstraints).then(function (answer) {
- Janus$1.debug(answer);
- // JSON.stringify doesn't work on some WebRTC objects anymore
- // See https://code.google.com/p/chromium/issues/detail?id=467366
- var jsep = {
- "type": answer.type,
- "sdp": answer.sdp
- };
- callbacks.customizeSdp(jsep);
- answer.sdp = jsep.sdp;
- Janus$1.log("Setting local description");
- if (sendVideo && simulcast) {
- // This SDP munging only works with Chrome
- if (Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
- // FIXME Apparently trying to simulcast when answering breaks video in Chrome...
- //~ Janus.log("Enabling Simulcasting for Chrome (SDP munging)");
- //~ answer.sdp = mungeSdpForSimulcasting(answer.sdp);
- Janus$1.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it");
- } else if (Janus$1.webRTCAdapter.browserDetails.browser !== "firefox") {
- Janus$1.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
- }
- }
- config.mySdp = answer.sdp;
- config.pc.setLocalDescription(answer)["catch"](callbacks.error);
- config.mediaConstraints = mediaConstraints;
- if (!config.iceDone && !config.trickle) {
- // Don't do anything until we have all candidates
- Janus$1.log("Waiting for all candidates...");
- return;
- }
- callbacks.success(answer);
- }, callbacks.error);
- }
- function sendSDP(handleId, callbacks) {
- callbacks = callbacks || {};
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus$1.noop;
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus$1.noop;
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle, not sending anything");
- return;
- }
- var config = pluginHandle.webrtcStuff;
- Janus$1.log("Sending offer/answer SDP...");
- if (config.mySdp === null || config.mySdp === undefined) {
- Janus$1.warn("Local SDP instance is invalid, not sending anything...");
- return;
- }
- config.mySdp = {
- "type": config.pc.localDescription.type,
- "sdp": config.pc.localDescription.sdp
- };
- if (config.trickle === false) config.mySdp["trickle"] = false;
- Janus$1.debug(callbacks);
- config.sdpSent = true;
- callbacks.success(config.mySdp);
- }
- function _getVolume(handleId, remote) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return 0;
- }
- var stream = remote ? "remote" : "local";
- var config = pluginHandle.webrtcStuff;
- if (!config.volume[stream]) config.volume[stream] = {
- value: 0
- };
- // Start getting the volume, if getStats is supported
- if (config.pc.getStats && Janus$1.webRTCAdapter.browserDetails.browser === "chrome") {
- if (remote && (config.remoteStream === null || config.remoteStream === undefined)) {
- Janus$1.warn("Remote stream unavailable");
- return 0;
- } else if (!remote && (config.myStream === null || config.myStream === undefined)) {
- Janus$1.warn("Local stream unavailable");
- return 0;
- }
- if (config.volume[stream].timer === null || config.volume[stream].timer === undefined) {
- Janus$1.log("Starting " + stream + " volume monitor");
- config.volume[stream].timer = setInterval(function () {
- config.pc.getStats(function (stats) {
- var results = stats.result();
- for (var i = 0; i < results.length; i++) {
- var res = results[i];
- if (res.type == 'ssrc') {
- 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'));
- }
- }
- });
- }, 200);
- return 0; // We don't have a volume to return yet
- }
- return config.volume[stream].value;
- } else {
- // audioInputLevel and audioOutputLevel seem only available in Chrome? audioLevel
- // seems to be available on Chrome and Firefox, but they don't seem to work
- Janus$1.warn("Getting the " + stream + " volume unsupported by browser");
- return 0;
- }
- }
- function isMuted(handleId, video) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return true;
- }
- var config = pluginHandle.webrtcStuff;
- if (config.pc === null || config.pc === undefined) {
- Janus$1.warn("Invalid PeerConnection");
- return true;
- }
- if (config.myStream === undefined || config.myStream === null) {
- Janus$1.warn("Invalid local MediaStream");
- return true;
- }
- if (video) {
- // Check video track
- if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
- Janus$1.warn("No video track");
- return true;
- }
- return !config.myStream.getVideoTracks()[0].enabled;
- } else {
- // Check audio track
- if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
- Janus$1.warn("No audio track");
- return true;
- }
- return !config.myStream.getAudioTracks()[0].enabled;
- }
- }
- function mute(handleId, video, mute) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return false;
- }
- var config = pluginHandle.webrtcStuff;
- if (config.pc === null || config.pc === undefined) {
- Janus$1.warn("Invalid PeerConnection");
- return false;
- }
- if (config.myStream === undefined || config.myStream === null) {
- Janus$1.warn("Invalid local MediaStream");
- return false;
- }
- if (video) {
- // Mute/unmute video track
- if (config.myStream.getVideoTracks() === null || config.myStream.getVideoTracks() === undefined || config.myStream.getVideoTracks().length === 0) {
- Janus$1.warn("No video track");
- return false;
- }
- config.myStream.getVideoTracks()[0].enabled = mute ? false : true;
- return true;
- } else {
- // Mute/unmute audio track
- if (config.myStream.getAudioTracks() === null || config.myStream.getAudioTracks() === undefined || config.myStream.getAudioTracks().length === 0) {
- Janus$1.warn("No audio track");
- return false;
- }
- config.myStream.getAudioTracks()[0].enabled = mute ? false : true;
- return true;
- }
- }
- function _getBitrate(handleId) {
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined || pluginHandle.webrtcStuff === null || pluginHandle.webrtcStuff === undefined) {
- Janus$1.warn("Invalid handle");
- return "Invalid handle";
- }
- var config = pluginHandle.webrtcStuff;
- if (config.pc === null || config.pc === undefined) return "Invalid PeerConnection";
- // Start getting the bitrate, if getStats is supported
- if (config.pc.getStats) {
- if (config.bitrate.timer === null || config.bitrate.timer === undefined) {
- Janus$1.log("Starting bitrate timer (via getStats)");
- config.bitrate.timer = setInterval(function () {
- config.pc.getStats().then(function (stats) {
- stats.forEach(function (res) {
- if (!res) return;
- var inStats = false;
- // Check if these are statistics on incoming media
- if ((res.mediaType === "video" || res.id.toLowerCase().indexOf("video") > -1) && res.type === "inbound-rtp" && res.id.indexOf("rtcp") < 0) {
- // New stats
- inStats = true;
- } else if (res.type == 'ssrc' && res.bytesReceived && (res.googCodecName === "VP8" || res.googCodecName === "")) {
- // Older Chromer versions
- inStats = true;
- }
- // Parse stats now
- if (inStats) {
- config.bitrate.bsnow = res.bytesReceived;
- config.bitrate.tsnow = res.timestamp;
- if (config.bitrate.bsbefore === null || config.bitrate.tsbefore === null) {
- // Skip this round
- config.bitrate.bsbefore = config.bitrate.bsnow;
- config.bitrate.tsbefore = config.bitrate.tsnow;
- } else {
- // Calculate bitrate
- var timePassed = config.bitrate.tsnow - config.bitrate.tsbefore;
- if (Janus$1.webRTCAdapter.browserDetails.browser == "safari") timePassed = timePassed / 1000; // Apparently the timestamp is in microseconds, in Safari
- var bitRate = Math.round((config.bitrate.bsnow - config.bitrate.bsbefore) * 8 / timePassed);
- if (Janus$1.webRTCAdapter.browserDetails.browser === 'safari') bitRate = parseInt(bitRate / 1000);
- config.bitrate.value = bitRate + ' kbits/sec';
- //~ Janus.log("Estimated bitrate is " + config.bitrate.value);
- config.bitrate.bsbefore = config.bitrate.bsnow;
- config.bitrate.tsbefore = config.bitrate.tsnow;
- }
- }
- });
- });
- }, 1000);
- return "0 kbits/sec"; // We don't have a bitrate value yet
- }
- return config.bitrate.value;
- } else {
- Janus$1.warn("Getting the video bitrate unsupported by browser");
- return "Feature unsupported by browser";
- }
- }
- function webrtcError(error) {
- Janus$1.error("WebRTC error:", error);
- }
- function cleanupWebrtc(handleId, hangupRequest) {
- Janus$1.log("Cleaning WebRTC stuff");
- var pluginHandle = pluginHandles[handleId];
- if (pluginHandle === null || pluginHandle === undefined) {
- // Nothing to clean
- return;
- }
- var config = pluginHandle.webrtcStuff;
- if (config !== null && config !== undefined) {
- if (hangupRequest === true) {
- // Send a hangup request (we don't really care about the response)
- var request = {
- "rtcgw": "hangup",
- "transaction": Janus$1.randomString(12)
- };
- if (pluginHandle.token !== null && pluginHandle.token !== undefined) request["token"] = pluginHandle.token;
- if (apisecret !== null && apisecret !== undefined) request["apisecret"] = apisecret;
- Janus$1.debug("Sending hangup request (handle=" + handleId + "):");
- Janus$1.debug(request);
- if (websockets) {
- request["session_id"] = sessionId;
- request["handle_id"] = handleId;
- ws.send(JSON.stringify(request));
- } else {
- Janus$1.httpAPICall(server + "/" + sessionId + "/" + handleId, {
- verb: 'POST',
- withCredentials: withCredentials,
- body: request
- });
- }
- }
- // Cleanup stack
- config.remoteStream = null;
- if (config.volume) {
- if (config.volume["local"] && config.volume["local"].timer) clearInterval(config.volume["local"].timer);
- if (config.volume["remote"] && config.volume["remote"].timer) clearInterval(config.volume["remote"].timer);
- }
- config.volume = {};
- if (config.bitrate.timer) clearInterval(config.bitrate.timer);
- config.bitrate.timer = null;
- config.bitrate.bsnow = null;
- config.bitrate.bsbefore = null;
- config.bitrate.tsnow = null;
- config.bitrate.tsbefore = null;
- config.bitrate.value = null;
- try {
- // Try a MediaStreamTrack.stop() for each track
- if (!config.streamExternal && config.myStream !== null && config.myStream !== undefined) {
- Janus$1.log("Stopping local stream tracks");
- var tracks = config.myStream.getTracks();
- for (var i in tracks) {
- var mst = tracks[i];
- Janus$1.log(mst);
- if (mst !== null && mst !== undefined) mst.stop();
- }
- }
- } catch (e) {
- // Do nothing if this fails
- }
- config.streamExternal = false;
- config.myStream = null;
- // Close PeerConnection
- try {
- config.pc.close();
- } catch (e) {
- // Do nothing
- }
- config.pc = null;
- config.candidates = null;
- config.mySdp = null;
- config.remoteSdp = null;
- config.iceDone = false;
- config.dataChannel = {};
- config.dtmfSender = null;
- }
- pluginHandle.oncleanup();
- }
- // Helper method to munge an SDP to enable simulcasting (Chrome only)
- function mungeSdpForSimulcasting(sdp) {
- // Let's munge the SDP to add the attributes for enabling simulcasting
- // (based on https://gist.github.com/ggarber/a19b4c33510028b9c657)
- var lines = sdp.split("\r\n");
- var video = false;
- var ssrc = [-1],
- ssrc_fid = [-1];
- var cname = null,
- msid = null,
- mslabel = null,
- label = null;
- var insertAt = -1;
- for (var i = 0; i < lines.length; i++) {
- var mline = lines[i].match(/m=(\w+) */);
- if (mline) {
- var medium = mline[1];
- if (medium === "video") {
- // New video m-line: make sure it's the first one
- if (ssrc[0] < 0) {
- video = true;
- } else {
- // We're done, let's add the new attributes here
- insertAt = i;
- break;
- }
- } else {
- // New non-video m-line: do we have what we were looking for?
- if (ssrc[0] > -1) {
- // We're done, let's add the new attributes here
- insertAt = i;
- break;
- }
- }
- continue;
- }
- if (!video) continue;
- var fid = lines[i].match(/a=ssrc-group:FID (\d+) (\d+)/);
- if (fid) {
- ssrc[0] = fid[1];
- ssrc_fid[0] = fid[2];
- lines.splice(i, 1);
- i--;
- continue;
- }
- if (ssrc[0]) {
- var match = lines[i].match('a=ssrc:' + ssrc[0] + ' cname:(.+)');
- if (match) {
- cname = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' msid:(.+)');
- if (match) {
- msid = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' mslabel:(.+)');
- if (match) {
- mslabel = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' label:(.+)');
- if (match) {
- label = match[1];
- }
- if (lines[i].indexOf('a=ssrc:' + ssrc_fid[0]) === 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- if (lines[i].indexOf('a=ssrc:' + ssrc[0]) === 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- }
- if (lines[i].length == 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- }
- if (ssrc[0] < 0) {
- // Couldn't find a FID attribute, let's just take the first video SSRC we find
- insertAt = -1;
- video = false;
- for (var i = 0; i < lines.length; i++) {
- var mline = lines[i].match(/m=(\w+) */);
- if (mline) {
- var medium = mline[1];
- if (medium === "video") {
- // New video m-line: make sure it's the first one
- if (ssrc[0] < 0) {
- video = true;
- } else {
- // We're done, let's add the new attributes here
- insertAt = i;
- break;
- }
- } else {
- // New non-video m-line: do we have what we were looking for?
- if (ssrc[0] > -1) {
- // We're done, let's add the new attributes here
- insertAt = i;
- break;
- }
- }
- continue;
- }
- if (!video) continue;
- if (ssrc[0] < 0) {
- var value = lines[i].match(/a=ssrc:(\d+)/);
- if (value) {
- ssrc[0] = value[1];
- lines.splice(i, 1);
- i--;
- continue;
- }
- } else {
- var match = lines[i].match('a=ssrc:' + ssrc[0] + ' cname:(.+)');
- if (match) {
- cname = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' msid:(.+)');
- if (match) {
- msid = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' mslabel:(.+)');
- if (match) {
- mslabel = match[1];
- }
- match = lines[i].match('a=ssrc:' + ssrc[0] + ' label:(.+)');
- if (match) {
- label = match[1];
- }
- if (lines[i].indexOf('a=ssrc:' + ssrc_fid[0]) === 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- if (lines[i].indexOf('a=ssrc:' + ssrc[0]) === 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- }
- if (lines[i].length == 0) {
- lines.splice(i, 1);
- i--;
- continue;
- }
- }
- }
- if (ssrc[0] < 0) {
- // Still nothing, let's just return the SDP we were asked to munge
- Janus$1.warn("Couldn't find the video SSRC, simulcasting NOT enabled");
- return sdp;
- }
- if (insertAt < 0) {
- // Append at the end
- insertAt = lines.length;
- }
- // Generate a couple of SSRCs (for retransmissions too)
- // Note: should we check if there are conflicts, here?
- ssrc[1] = Math.floor(Math.random() * 0xFFFFFFFF);
- ssrc[2] = Math.floor(Math.random() * 0xFFFFFFFF);
- ssrc_fid[1] = Math.floor(Math.random() * 0xFFFFFFFF);
- ssrc_fid[2] = Math.floor(Math.random() * 0xFFFFFFFF);
- // Add attributes to the SDP
- for (var i = 0; i < ssrc.length; i++) {
- if (cname) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' cname:' + cname);
- insertAt++;
- }
- if (msid) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' msid:' + msid);
- insertAt++;
- }
- if (mslabel) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' mslabel:' + mslabel);
- insertAt++;
- }
- if (label) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc[i] + ' label:' + label);
- insertAt++;
- }
- // Add the same info for the retransmission SSRC
- if (cname) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' cname:' + cname);
- insertAt++;
- }
- if (msid) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' msid:' + msid);
- insertAt++;
- }
- if (mslabel) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' mslabel:' + mslabel);
- insertAt++;
- }
- if (label) {
- lines.splice(insertAt, 0, 'a=ssrc:' + ssrc_fid[i] + ' label:' + label);
- insertAt++;
- }
- }
- lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[2] + ' ' + ssrc_fid[2]);
- lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[1] + ' ' + ssrc_fid[1]);
- lines.splice(insertAt, 0, 'a=ssrc-group:FID ' + ssrc[0] + ' ' + ssrc_fid[0]);
- lines.splice(insertAt, 0, 'a=ssrc-group:SIM ' + ssrc[0] + ' ' + ssrc[1] + ' ' + ssrc[2]);
- sdp = lines.join("\r\n");
- if (!sdp.endsWith("\r\n")) sdp += "\r\n";
- return sdp;
- }
- // Helper methods to parse a media object
- function isAudioSendEnabled(media) {
- Janus$1.debug("isAudioSendEnabled:", media);
- if (media === undefined || media === null) return true; // Default
- if (media.audio === false) return false; // Generic audio has precedence
- if (media.audioSend === undefined || media.audioSend === null) return true; // Default
- return media.audioSend === true;
- }
- function isAudioSendRequired(media) {
- Janus$1.debug("isAudioSendRequired:", media);
- if (media === undefined || media === null) return false; // Default
- if (media.audio === false || media.audioSend === false) return false; // If we're not asking to capture audio, it's not required
- if (media.failIfNoAudio === undefined || media.failIfNoAudio === null) return false; // Default
- return media.failIfNoAudio === true;
- }
- function isAudioRecvEnabled(media) {
- Janus$1.debug("isAudioRecvEnabled:", media);
- if (media === undefined || media === null) return true; // Default
- if (media.audio === false) return false; // Generic audio has precedence
- if (media.audioRecv === undefined || media.audioRecv === null) return true; // Default
- return media.audioRecv === true;
- }
- function isVideoSendEnabled(media) {
- Janus$1.debug("isVideoSendEnabled:", media);
- if (media === undefined || media === null) return true; // Default
- if (media.video === false) return false; // Generic video has precedence
- if (media.videoSend === undefined || media.videoSend === null) return true; // Default
- return media.videoSend === true;
- }
- function isVideoSendRequired(media) {
- Janus$1.debug("isVideoSendRequired:", media);
- if (media === undefined || media === null) return false; // Default
- if (media.video === false || media.videoSend === false) return false; // If we're not asking to capture video, it's not required
- if (media.failIfNoVideo === undefined || media.failIfNoVideo === null) return false; // Default
- return media.failIfNoVideo === true;
- }
- function isVideoRecvEnabled(media) {
- Janus$1.debug("isVideoRecvEnabled:", media);
- if (media === undefined || media === null) return true; // Default
- if (media.video === false) return false; // Generic video has precedence
- if (media.videoRecv === undefined || media.videoRecv === null) return true; // Default
- return media.videoRecv === true;
- }
- function isScreenSendEnabled(media) {
- Janus$1.debug("isScreenSendEnabled:", media);
- if (media === undefined || media === null) return false;
- if (_typeof(media.video) !== 'object' || _typeof(media.video.mandatory) !== 'object') return false;
- var constraints = media.video.mandatory;
- 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';
- return false;
- }
- function isDataEnabled(media) {
- Janus$1.debug("isDataEnabled:", media);
- if (Janus$1.webRTCAdapter.browserDetails.browser == "edge") {
- Janus$1.warn("Edge doesn't support data channels yet");
- return false;
- }
- if (media === undefined || media === null) return false; // Default
- return media.data === true;
- }
- function isTrickleEnabled(trickle) {
- Janus$1.debug("isTrickleEnabled:", trickle);
- if (trickle === undefined || trickle === null) return true; // Default is true
- return trickle === true;
- }
- }
- window.Janus = Janus$1;
- // We make use of this 'server' variable to provide the address of the
- var janus = null;
- var tts = null;
- var opaqueId = "tts-" + Janus.randomString(12);
- var spinner = null;
- Janus = window.Janus;
- // Initialize the library (all console debuggers enabled)
- Janus.init({
- debug: "all",
- callback: function callback() {
- window.stopTalk = function () {
- janus.destroy();
- };
- // debugger;
- window.startTalk = function () {
- // Make sure the browser supports WebRTC
- if (!Janus.isWebrtcSupported()) {
- bootbox.alert("No WebRTC support... ");
- return;
- }
- // if($('#tts_url').val().length == 0){
- // bootbox.alert("Please input tts url... ");
- // return;
- // }
- // $(this).attr('disabled', true).unbind('click');
- // Create session
- janus = new Janus({
- server: window.EZUIKit.opt.rtcUrl,
- // No "iceServers" is provided, meaning janus.js will use a default STUN server
- // Here are some examples of how an iceServers field may look like to support TURN
- // iceServers: [{urls: "turn:yourturnserver.com:3478", username: "janususer", credential: "januspwd"}],
- // iceServers: [{urls: "turn:yourturnserver.com:443?transport=tcp", username: "janususer", credential: "januspwd"}],
- // iceServers: [{urls: "turns:yourturnserver.com:443?transport=tcp", username: "janususer", credential: "januspwd"}],
- // Should the Janus API require authentication, you can specify either the API secret or user token here too
- // token: "mytoken",
- // or
- // apisecret: "serversecret",
- success: function success() {
- // Attach to tts plugin
- janus.attach({
- plugin: "rtcgw.plugin.tts",
- opaqueId: opaqueId,
- success: function success(pluginHandle) {
- // $('#details').remove();
- tts = pluginHandle;
- Janus.log("Plugin attached! (" + tts.getPlugin() + ", id=" + tts.getId() + ")");
- // Negotiate WebRTC
- //var url = "tts://61.130.6.23:8664/talk://D13781761:0:1:cas.ys7.com:6500?97fbd2a75fa94b7682c994d3d1fac8ca:ut.5porslgu79e9r7ca48z32k8abgl3rp58-77bhb6i7xr-1kmumtg-jkhy7pvfr:0:3"
- //var url = "tts://10.86.15.209:8664/talk://D13781761:0:1:cas.ys7.com:6500?32db2578ba7c4a84be22ecc0bcd0f8db:ut.5lqpkhim5m7cdk2y5w60g7hm9vd7i3v0-3d2pwhxe2t-11wx2ge-sh4yazbll:0:3"
- //var url = "tts://10.86.15.209:8664/talk://D13781761:0:1:cas.ys7.com:6500"
- //test12.ys.com
- //var url = "tts://10.86.15.209:8664/talk://D08197169:0:1:cas.ys7.com:6500"
- //test10.ys.com
- //var url = "tts://10.86.29.210:8664/talk://D08197169:0:1:cas.ys7.com:6500"
- var url = window.EZUIKit.opt.talkLink;
- console.log("ttsUlr", url);
- var body = {
- "request": "start",
- "url": url,
- "codec": "opus",
- "dir": "sendrecv",
- "audio_debug": 1
- };
- if (window.EZUIKit.opt.talkType === 'gb28181') {
- body['devProto'] = 'gb28181';
- }
- //tts.send({"message": body});
- Janus.debug("Trying a createOffer too (audio/video sendrecv)");
- tts.createOffer({
- // No media provided: by default, it's sendrecv for audio and video
- media: {
- audio: true,
- video: false,
- data: false
- },
- // Audio only
- // If you want to test simulcasting (Chrome and Firefox only), then
- // pass a ?simulcast=true when opening this demo page: it will turn
- // the following 'simulcast' property to pass to janus.js to true
- simulcast: false,
- simulcast2: false,
- success: function success(jsep) {
- Janus.debug("Got SDP!");
- Janus.debug(jsep);
- tts.send({
- "message": body,
- "jsep": jsep
- });
- if (typeof window.EZUIKit.handleTalkSuccess !== 'undefined') {
- window.EZUIKit.handleTalkSuccess();
- }
- },
- error: function error(_error) {
- Janus.error("WebRTC error:", _error);
- // bootbox.alert("WebRTC error... " + JSON.stringify(error));
- if (typeof window.EZUIKit.handleTalkError !== 'undefined') {
- window.EZUIKit.handleTalkError(_error);
- }
- }
- });
- // $('#start').removeAttr('disabled').html("Stop")
- // .click(function() {
- // $(this).attr('disabled', true);
- // janus.destroy();
- // });
- },
- error: function error(_error2) {
- console.error(" -- Error attaching plugin...", _error2);
- bootbox.alert("Error attaching plugin... " + _error2);
- if (window.EZUIKit.handleTalkError !== 'undefined') {
- window.EZUIKit.handleTalkError(_error2);
- }
- },
- consentDialog: function consentDialog(on) {
- Janus.debug("Consent dialog should be " + (on ? "on" : "off") + " now");
- },
- iceState: function iceState(state) {
- Janus.log("ICE state changed to " + state);
- },
- mediaState: function mediaState(medium, on) {
- Janus.log("Janus " + (on ? "started" : "stopped") + " receiving our " + medium);
- },
- webrtcState: function webrtcState(on) {
- Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now");
- // $("#audioleft").parent().unblock();
- },
- slowLink: function slowLink(uplink, lost) {
- Janus.warn("Janus reports problems " + (uplink ? "sending" : "receiving") + " packets on this PeerConnection (" + lost + " lost packets)");
- },
- onmessage: function onmessage(msg, jsep) {
- Janus.debug(" ::: Got a message :::");
- Janus.debug(msg);
- if (jsep !== undefined && jsep !== null) {
- Janus.debug("Handling SDP as well...");
- Janus.debug(jsep);
- tts.handleRemoteJsep({
- jsep: jsep
- });
- }
- var result = msg["result"];
- if (result !== null && result !== undefined) {
- if (result === "done") {
- // The plugin closed
- bootbox.alert("The TTS Test is over");
- if (spinner !== null && spinner !== undefined) spinner.stop();
- spinner = null;
- // $('#myaudio').remove();
- //$('#waitingvideo').remove();
- // $('#peeraudio').remove();
- return;
- }
- if (result === "msg") {
- if (typeof window.EZUIKit.handleTalkMessage !== 'undefined') {
- window.EZUIKit.handleTalkMessage(msg);
- }
- }
- // Any loss?
- var status = result["status"];
- if (status === "slow_link") {
- //~ var bitrate = result["bitrate"];
- //~ toastr.warning("The bitrate has been cut to " + (bitrate/1000) + "kbps", "Packet loss?", {timeOut: 2000});
- toastr.warning("Janus apparently missed many packets we sent, maybe we should reduce the bitrate", "Packet loss?", {
- timeOut: 2000
- });
- }
- }
- },
- onlocalstream: function onlocalstream(stream) {
- Janus.debug(" ::: Got a local stream :::");
- Janus.debug(stream);
- // if($('#myaudio').length === 0) {
- // $('#audios').removeClass('hide').show();
- // $('#audioleft').append('<audio id="myaudio" autoplay controls muted>Your browser does not support audio tag</audio>');
- // }
- Janus.attachMediaStream(document.getElementById("myaudio"), stream);
- //$("#myaudio").get(0).muted = "muted";
- if (tts.webrtcStuff.pc.iceConnectionState !== "completed" && tts.webrtcStuff.pc.iceConnectionState !== "connected") {
- // $("#audioleft").parent().block({
- // message: '<b>Publishing...</b>',
- // css: {
- // border: 'none',
- // backgroundColor: 'transparent',
- // color: 'white'
- // }
- // });
- // No remote video yet
- //$('#audioright').append('<video class="rounded centered" id="waitingvideo" width=320 height=240 />');
- if (spinner == null) {
- document.getElementById('audioright');
- //spinner = new Spinner({top:100}).spin(target);
- } else {
- spinner.spin();
- }
- }
- var audioTracks = stream.getAudioTracks();
- if (audioTracks === null || audioTracks === undefined || audioTracks.length === 0) ;
- },
- onremotestream: function onremotestream(stream) {
- Janus.debug(" ::: Got a remote stream :::");
- Janus.debug(stream);
- // if($('#peeraudio').length === 0) {
- // $('#audios').removeClass('hide').show();
- // // $('#audioright').append('<audio id="peeraudio" autoplay controls>Your browser does not support audio tag</audio>');
- // // Show the video, hide the spinner and show the resolution when we get a playing event
- // var audio = $('<audio id="peeraudio" autoplay controls playsinline preload="preload" loop="true"></audio>');
- // audio = audio.get(0);
- // audio.setAttribute("id", 'peeraudio');
- // audio.setAttribute("preload","preload");
- // // 自动播放解决苹果不兼容autoplay属性
- // audio.setAttribute("loop",true);
- // $('#audioright').append(audio);
- // $("#peeraudio").bind("playing", function () {
- // //$('#waitingvideo').remove();
- // $('#peeraudio').removeClass('hide').show();
- // if(spinner !== null && spinner !== undefined)
- // spinner.stop();
- // spinner = null;
- // });
- // }
- Janus.attachMediaStream(document.getElementById("peeraudio"), stream);
- var audioTracks = stream.getAudioTracks();
- if (audioTracks === null || audioTracks === undefined || audioTracks.length === 0) ; else {
- // $('#peeraudio').removeClass('hide').show();
- document.getElementById('peeraudio').play();
- }
- },
- ondataopen: function ondataopen(data) {
- Janus.log("The DataChannel is available!");
- },
- ondata: function ondata(data) {
- Janus.debug("We got data from the DataChannel! " + data);
- },
- oncleanup: function oncleanup() {
- Janus.log(" ::: Got a cleanup notification :::");
- if (spinner !== null && spinner !== undefined) spinner.stop();
- spinner = null;
- // $('#myaudio').remove();
- // //$('#waitingvideo').remove();
- // $("#audioleft").parent().unblock();
- // $('#peeraudio').remove();
- }
- });
- },
- error: function error(_error3) {
- Janus.error(_error3);
- if (window.EZUIKit.handleTalkError !== 'undefined') {
- window.EZUIKit.handleTalkError(_error3);
- }
- },
- destroyed: function destroyed() {
- // window.location.reload();
- }
- });
- };
- }
- });
- window.janus = janus;
- window.tts = tts;
- var Talk = /*#__PURE__*/function () {
- function Talk(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, Talk);
- this.jSPlugin = jSPlugin;
- this.codeHandler = new UikitCode();
- this.pluginStatus = new Status(this, this.jSPlugin.params.id);
- var audioLeft = document.createElement('div');
- audioLeft.id = "audioleft";
- var audioRight = document.createElement('div');
- audioRight.id = "audioright";
- audioRight.style = "display:none;";
- var audioLeftDOM = document.createElement('audio');
- audioLeftDOM.id = "myaudio";
- audioLeftDOM.muted = true;
- audioLeftDOM.setAttribute("autoplay", true);
- audioLeftDOM.setAttribute("controls", true);
- audioLeft.appendChild(audioLeftDOM);
- audioLeft.style = "display:none;";
- var audioRightDOM = document.createElement('audio');
- audioRightDOM.id = "peeraudio";
- audioRightDOM.setAttribute("autoplay", true);
- audioRightDOM.setAttribute("controls", true);
- audioRight.appendChild(audioRightDOM);
- // addJs(`${this.jSPlugin.staticPath}/talk/adapeter.js`, () => {
- // addJs(`${this.jSPlugin.staticPath}/talk/janus.js`, () => {
- // addJs(`${this.jSPlugin.staticPath}/talk/tts-v4.js`, () => {
- // 临时处理
- window.EZUIKit["handleTalkError"] = function (err) {
- console.log("talk err", err);
- if (typeof _this.jSPlugin.handleTalkError !== 'undefined') {
- _this.jSPlugin.handleTalkError(err);
- }
- };
- window.EZUIKit["handleTalkSuccess"] = function (data) {
- console.log("talk success", data);
- if (typeof _this.jSPlugin.handleTalkSuccess !== 'undefined') {
- _this.jSPlugin.handleTalkSuccess(data);
- }
- };
- window.EZUIKit.opt = {
- rtcUrl: "",
- talkLink: "",
- ttsUrl: "",
- stream: "",
- deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial,
- channelNo: matchEzopenUrl(this.jSPlugin.url).channelNo
- };
- document.body.appendChild(audioLeft);
- document.body.appendChild(audioRight);
- // });
- // });
- // });
- }
- _createClass$1(Talk, [{
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "startTalk",
- value: function startTalk() {
- var _this2 = this;
- if (this.jSPlugin.capacity && this.jSPlugin.capacity.support_talk && !(this.jSPlugin.capacity && (this.jSPlugin.capacity.support_talk === '3' || this.jSPlugin.capacity.support_talk === '1'))) {
- if (typeof this.jSPlugin.params.handleError === 'function') {
- this.pluginStatus.loadingSetText({
- text: "设备不支持对讲",
- color: 'red',
- delayClear: 2000
- });
- this.jSPlugin.params.handleError({
- msg: "设备不支持对讲",
- retcode: -1000,
- id: this.jSPlugin.params.id,
- type: "handleError"
- });
- }
- console.log("设备不支持对讲");
- return false;
- }
- var formData = new FormData();
- formData.append("accessToken", this.jSPlugin.accessToken);
- formData.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
- formData.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
- fetch(this.jSPlugin.env.domain + "/api/lapp/live/talk/url", {
- method: "POST",
- // headers: {
- // 'Content-Type': 'application/json'
- // },
- body: formData
- }).then(function (response) {
- return response.json();
- }).then(function (data) {
- if (data.code == 200) {
- var apiResult = data.data;
- if (apiResult) {
- // 临时将https转换为websocket
- var rtcTrunk = apiResult.rtcUrl;
- if (rtcTrunk.indexOf("ws") === -1) {
- rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
- }
- window.EZUIKit.opt.rtcUrl = rtcTrunk;
- window.EZUIKit.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
- window.EZUIKit.opt.deviceSerial = matchEzopenUrl(_this2.jSPlugin.url).deviceSerial;
- window.EZUIKit.opt.channelNo = matchEzopenUrl(_this2.jSPlugin.url).channelNo;
- var urlList = window.EZUIKit.opt.ttsUrl.split("?");
- if (urlList.length === 2) {
- // 国标设备
- var talk = "talk?dev=" + window.EZUIKit.opt.deviceSerial + "&chann=" + window.EZUIKit.opt.channelNo + "&encodetype=2";
- window.EZUIKit.opt.talkLink = window.EZUIKit.opt.ttsUrl.split("?")[0] + "/" + talk;
- window.EZUIKit.opt.talkType = "gb28181";
- } else {
- // 普通设备
- var talk = "talk://" + window.EZUIKit.opt.deviceSerial + ":0:" + window.EZUIKit.opt.channelNo + ":cas.ys7.com:6500";
- window.EZUIKit.opt.talkLink = window.EZUIKit.opt.ttsUrl.split("?")[0] + "/" + talk;
- }
- window.EZUIKit.opt.stream = apiResult.stream;
- window.startTalk();
- }
- } else {
- console.log(data.code, _this2.codeHandler.matchInfo(data.code, 'talk'));
- _this2.pluginStatus.loadingSetText({
- text: _this2.codeHandler.matchInfo(data.code, 'talk').msg || data.msg,
- color: 'red',
- delayClear: 2000
- });
- if (typeof _this2.jSPlugin.params.handleError === 'function') {
- _this2.jSPlugin.params.handleError({
- msg: data.msg,
- retcode: data.code,
- id: _this2.jSPlugin.params.id,
- type: "handleError"
- });
- }
- }
- })["catch"](function (err) {
- console.log("err", err);
- });
- }
- }, {
- key: "stopTalk",
- value: function stopTalk() {
- window.stopTalk();
- if (document.getElementById("myaudio") && document.getElementById("myaudio").srcObject) {
- document.getElementById("myaudio").srcObject.getTracks()[0].stop();
- }
- }
- }]);
- return Talk;
- }();
- var MobilePtz = /*#__PURE__*/function () {
- function MobilePtz(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, MobilePtz);
- this.jSPlugin = jSPlugin;
- var oS = document.createElement('style');
- 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 }";
- document.getElementsByTagName("head")[0].appendChild(oS);
- var mobileContainer = document.createElement('div');
- mobileContainer.className = "mobile-ez-ptz-container";
- mobileContainer.id = "mobile-ez-ptz-container";
- mobileContainer.style = "display:inline-block;width: ".concat(this.jSPlugin.width, "px;text-align:center;");
- var mobileContainerTitle = document.createElement('div');
- mobileContainerTitle.className = "live-ptz-title";
- mobileContainerTitle.id = "live-ptz-title";
- mobileContainerTitle.innerHTML = "云台控制";
- if (!document.getElementById("live-ptz-title")) {
- mobileContainer.appendChild(mobileContainerTitle);
- }
- var mobileContainerIntro = document.createElement('div');
- mobileContainerIntro.className = "live-ptz-intro";
- mobileContainerIntro.id = "live-ptz-intro";
- mobileContainerIntro.innerHTML = "请通过操控云台来调整摄像机视角";
- if (!document.getElementById("live-ptz-intro")) {
- mobileContainer.appendChild(mobileContainerIntro);
- }
- var ptzWrap = document.createElement('div');
- ptzWrap.id = "mobile-ez-ptz-item";
- ptzWrap.className = "mobile-ez-ptz-wrap";
- 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 ";
- if (!document.getElementById("mobile-ez-ptz-item")) {
- mobileContainer.appendChild(ptzWrap);
- }
- //document.getElementById(jSPlugin.id).appendChild(mobileContainer);
- insertAfter$1(mobileContainer, document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
- // 云台控制事件绑定
- // 云台控制
- document.getElementById("mobile-ez-ptz-item").ontouchstart = function (e) {
- e.preventDefault();
- console.log("触摸开始");
- _this._handlePtzTouch(e, 'start');
- };
- document.getElementById("mobile-ez-ptz-item").ontouchend = function (e) {
- e.preventDefault();
- console.log("触摸结束", e);
- _this._handlePtzTouch(e, 'stop');
- };
- // 云台控制
- document.getElementById("mobile-ez-ptz-item").onmousedown = function (e) {
- e.preventDefault();
- console.log("触摸开始");
- _this._handlePtzTouch(e, 'start');
- };
- document.getElementById("mobile-ez-ptz-item").onmouseup = function (e) {
- e.preventDefault();
- console.log("触摸结束", e);
- _this._handlePtzTouch(e, 'stop');
- };
- }
- _createClass$1(MobilePtz, [{
- key: "show",
- value: function show() {
- document.getElementById("mobile-ez-ptz-item").style = "display: inline-block";
- }
- }, {
- key: "hide",
- value: function hide() {
- document.getElementById("mobile-ez-ptz-item").style = "display: none";
- }
- }, {
- key: "_handlePtzTouch",
- value: function _handlePtzTouch(e, type) {
- var container = document.getElementById('mobile-ez-ptz-item').getBoundingClientRect();
- var containerCenterX = container.left + 130;
- var containerCenterY = container.top + 130;
- var eventX = e.x || e.changedTouches[0].clientX;
- var eventY = e.y || e.changedTouches[0].clientY;
- var left = eventX - containerCenterX;
- var top = eventY - containerCenterY;
- var direction = 0; //操作命令:0-上,1-下,2-左,3右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
- var url = this.jSPlugin.env.domain + "/api/lapp/device/ptz/start";
- // var nextPtzImg = ptzNormalImg;
- // var nextPtzImgFailed = ptzNormalImg;
- // 判读方位
- if (Math.abs(left) > Math.abs(top)) {
- if (left > 0) {
- direction = 3;
- document.getElementsByClassName("mobile-ez-ptz-icon")[3].className = document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("default", "active");
- } else {
- direction = 2;
- document.getElementsByClassName("mobile-ez-ptz-icon")[1].className = document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("default", "active");
- }
- } else {
- if (top > 0) {
- direction = 1;
- document.getElementsByClassName("mobile-ez-ptz-icon")[2].className = document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("default", "active");
- } else {
- direction = 0;
- document.getElementsByClassName("mobile-ez-ptz-icon")[0].className = document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("default", "active");
- }
- }
- 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%)");
- if (type === 'stop') {
- url = this.jSPlugin.env.domain + '/api/lapp/device/ptz/stop';
- document.getElementById("mobile-ez-ptz-item").style = "";
- document.getElementsByClassName("mobile-ez-ptz-icon")[3].className = document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("active", "default");
- document.getElementsByClassName("mobile-ez-ptz-icon")[1].className = document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("active", "default");
- document.getElementsByClassName("mobile-ez-ptz-icon")[2].className = document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("active", "default");
- document.getElementsByClassName("mobile-ez-ptz-icon")[0].className = document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("active", "default");
- }
- var data = new FormData();
- data.append("deviceSerial", matchEzopenUrl(this.jSPlugin.url).deviceSerial);
- data.append("channelNo", matchEzopenUrl(this.jSPlugin.url).channelNo);
- data.append("speed", 1);
- data.append("direction", direction);
- data.append("accessToken", this.jSPlugin.accessToken);
- fetch(url, {
- method: "POST",
- body: data
- }).then(function (response) {
- return response.json();
- }).then(function (rt) {
- if (rt.code == 200) ; else {
- //document.getElementById('ptz-img-container').childNodes[0].src = nextPtzImgFailed;
- // layer.msg(data.msg);
- if (rt.code == 60005 || rt.code == 60002 || rt.code == 60003 || rt.code == 60004) {
- 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%)");
- }
- }
- })["catch"](function (err) {
- console.log("云台调用异常", err);
- });
- }
- }]);
- return MobilePtz;
- }();
- var retcode = 0;
- var msg = "成功";
- var data$7 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "rgb(0 0 0 / 0%)",
- activeColor: "#1890FF",
- btnList: [
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-0",
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-1",
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-2",
- iconId: "sound",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-3",
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-4",
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-5",
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-6",
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-7",
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-8",
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 0,
- themeId: "f7896c8942c9476fb439370dd974f1c0"
- }
- ]
- }
- };
- var emptyData = {
- retcode: retcode,
- msg: msg,
- data: data$7
- };
- var data$6 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var mobileLiveFullData = {
- data: data$6
- };
- var data$5 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "speed",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var mobileRecFullData = {
- data: data$5
- };
- var data$4 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "speed",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var pcLiveFullData = {
- data: data$4
- };
- var data$3 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- btnKey: "c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var pcLiveSecurityData = {
- data: data$3
- };
- var data$2 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 0
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 0
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- }
- };
- var pcLiveSimpleData = {
- data: data$2
- };
- var data$1 = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 0
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "talk",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var pcLiveVoiceData = {
- data: data$1
- };
- var data = {
- header: {
- color: "#FFFFFF",
- backgroundColor: "#000000",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "deviceID",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "deviceName",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "cloudRec",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "rec",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- },
- footer: {
- color: "#FFFFFF",
- backgroundColor: "#00000080",
- activeColor: "#1890FF",
- btnList: [
- {
- iconId: "play",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "capturePicture",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "sound",
- part: "left",
- defaultActive: 1,
- isrender: 1
- },
- {
- iconId: "pantile",
- part: "left",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "recordvideo",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "zoom",
- part: "left",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "speed",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "hd",
- part: "right",
- defaultActive: 0,
- isrender: 0
- },
- {
- iconId: "webExpend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- },
- {
- iconId: "expend",
- part: "right",
- defaultActive: 0,
- isrender: 1
- }
- ]
- }
- };
- var pcRecFullDataData = {
- data: data
- };
- var officeTemplateList = [{
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'pcLive',
- themeIntro: 'PC直播全量版',
- themeName: 'PC直播全量版',
- themeType: 'webLive',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: pcLiveFullData.data.header,
- footer: pcLiveFullData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'security',
- themeIntro: 'PC直播安防版',
- themeName: 'PC直播安防版',
- themeType: 'webLive',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: pcLiveSecurityData.data.header,
- footer: pcLiveSecurityData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'voice',
- themeIntro: 'PC直播语音版',
- themeName: 'PC直播语音版',
- themeType: 'webLive',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: pcLiveVoiceData.data.header,
- footer: pcLiveVoiceData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'simple',
- themeIntro: 'PC直播极简版',
- themeName: 'PC直播极简版',
- themeType: 'webLive',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
- poster: "",
- header: pcLiveSimpleData.data.header,
- footer: pcLiveSimpleData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'pcRec',
- themeIntro: 'PC回放全量版',
- themeName: 'PC回放全量版',
- themeType: 'webRec',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: pcRecFullDataData.data.header,
- footer: pcRecFullDataData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'mobileLive',
- themeIntro: 'Mobile直播全量版',
- themeName: 'Mobile直播全量版',
- themeType: 'mobileLive',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: mobileLiveFullData.data.header,
- footer: mobileLiveFullData.data.footer
- }, {
- autoFocus: 5,
- createTime: '2021-06-14T08:04:37.000Z',
- themeId: 'mobileRec',
- themeIntro: 'Mobile回放全量版',
- themeName: 'Mobile回放全量版',
- themeType: 'mobileRec',
- updateTime: '2021-06-14T08:04:37.000Z',
- label: '官方',
- labelPic: "https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",
- poster: "https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",
- header: mobileRecFullData.data.header,
- footer: mobileRecFullData.data.footer
- }];
- var Zoom = /*#__PURE__*/function () {
- function Zoom(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, Zoom);
- this.jSPlugin = jSPlugin;
- this.enableZoom = false;
- this.isMouseDown = false, this.videoWidth = 1920;
- this.videoHeight = 1080;
- this.currentScale = 1;
- this.currentPosition = {
- x: 0,
- //操作点 -x
- y: 0,
- //
- xPercent: 0.10,
- // 百分比 -x
- yPercent: 0.10,
- // 百分比
- xCurrentVideo: 0,
- // 当前放大后可视视频左上角起点
- yCurrentVideo: 0,
- left: 0,
- top: 0,
- right: 1920,
- bottom: 1080
- };
- this.DOM = document.getElementById(jSPlugin.id);
- this.clientRect = document.getElementById(jSPlugin.id).getBoundingClientRect();
- //audioControls-left
- var scaleDOMContainer = document.createElement('div');
- scaleDOMContainer.id = "".concat(jSPlugin.id, "-zoom-container");
- scaleDOMContainer.style = "position: absolute;\n display:none;\n left: 12px;\n bottom: 80px;";
- 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 ");
- scaleDOMContainer.innerHTML = scaleDOMHTML;
- document.getElementById("".concat(jSPlugin.id, "-audioControls-left")).parentNode.appendChild(scaleDOMContainer);
- document.getElementById("".concat(jSPlugin.id, "-addScale")).onclick = function () {
- _this.addScale();
- };
- document.getElementById("".concat(jSPlugin.id, "-subScale")).onclick = function () {
- _this.subScale();
- };
- // document.getElementById("video-container").addEventListener("mouseenter",(event)=> {
- // console.log("鼠标进入", event);
- // });
- }
- _createClass$1(Zoom, [{
- key: "onMouseDown",
- value: function onMouseDown(event) {
- this.currentPosition;
- this.currentScale;
- var enableZoom = this.enableZoom;
- if (!enableZoom) {
- return false;
- }
- this.moveX = event.clientX;
- this.moveY = event.clientY;
- this.isMouseDown = true;
- }
- }, {
- key: "onMouseUp",
- value: function onMouseUp(event) {
- var currentPosition = this.currentPosition,
- enableZoom = this.enableZoom;
- if (!enableZoom) {
- return false;
- }
- this.isMouseDown = false;
- currentPosition.left = currentPosition.left - (event.clientX - this.moveX);
- currentPosition.top = currentPosition.top - (event.clientY - this.moveY);
- this.doScale();
- }
- }, {
- key: "onMouseOut",
- value: function onMouseOut(event) {
- var enableZoom = this.enableZoom;
- if (!enableZoom) {
- return false;
- }
- if (this.isMouseDown) {
- console.log("鼠标按上", event);
- this.isMouseDown = false;
- }
- this.isMouseDown = false;
- }
- }, {
- key: "renderDot",
- value: function renderDot() {
- var currentScale = this.currentScale;
- document.getElementById("".concat(this.jSPlugin.id, "-scale-value")).innerHTML = "".concat(currentScale, ".0X");
- document.getElementById("".concat(this.jSPlugin.id, "-line-dot")).style.height = "".concat((currentScale - 1) / 7 * 100, "%");
- document.getElementById("".concat(this.jSPlugin.id, "-scale-body-line-dot")).style.bottom = "calc(".concat((currentScale - 1) / 7 * 100, "% - 6px)");
- }
- }, {
- key: "startZoom",
- value: function startZoom() {
- var _this2 = this;
- var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
- this.videoWidth = info.width;
- this.videoHeight = info.height;
- this.currentPosition.right = info.width;
- this.currentPosition.bottom = info.height;
- this.currentScale = 1;
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "block";
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
- this.renderDot();
- this.enableZoom = true;
- if (document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0"))) {
- document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mousedown", function (event) {
- return _this2.onMouseDown(event);
- });
- document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mouseup", function (event) {
- return _this2.onMouseUp(event);
- });
- document.getElementById("".concat(this.jSPlugin.id, "canvas_draw0")).addEventListener("mouseout", function (event) {
- return _this2.onMouseOut(event);
- });
- } else if (document.getElementById("".concat(this.jSPlugin.id, "-player"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mousedown", function (event) {
- return _this2.onMouseDown(event);
- });
- document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mouseup", function (event) {
- return _this2.onMouseUp(event);
- });
- document.getElementById("".concat(this.jSPlugin.id, "-player")).addEventListener("mouseout", function (event) {
- return _this2.onMouseOut(event);
- });
- }
- }
- }, {
- key: "stopZoom",
- value: function stopZoom() {
- var _this3 = this;
- this.currentScale = 1;
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
- this.renderDot();
- this.enableZoom = false;
- document.getElementById(this.jSPlugin.id).removeEventListener("mousedown", function (event) {
- return _this3.onMouseDown(event);
- });
- document.getElementById(this.jSPlugin.id).removeEventListener("mouseup", function (event) {
- return _this3.onMouseUp(event);
- });
- document.getElementById(this.jSPlugin.id).removeEventListener("mouseout", function (event) {
- return _this3.onMouseOut(event);
- });
- }
- // scrollFunc(e) {
- // e = e || window.event;
- // if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件
- // if (e.wheelDelta > 0) { //当滑轮向上滚动时
- // this.isScrollOverVideo(e, 'up');
- // }
- // if (e.wheelDelta < 0) { //当滑轮向下滚动时
- // this.isScrollOverVideo(e, 'down');
- // }
- // } else if (e.detail) { //Firefox滑轮事件
- // if (e.detail > 0) { //当滑轮向下滚动时
- // this.isScrollOverVideo(e, 'down');
- // }
- // if (e.detail < 0) { //当滑轮向上滚动时
- // this.isScrollOverVideo(e, 'up');
- // }
- // }
- // }
- // isScrollOverVideo(e, type) {
- // const { clientRect } = this;
- // if (e.clientX > clientRect.x && e.clientX < (clientRect.x + clientRect.width)) {
- // if (e.clientY > clientRect.y && e.clientY < (clientRect.y + clientRect.height)) {
- // if (type == 'up' && currentScale < 8) {
- // this.currentScale++;
- // console.log("当前放大尺度", currentScale)
- // this.calCurrentPosition(e);
- // }
- // if (type == 'down' && currentScale > 1) {
- // this.currentScale--;
- // console.log("当前放大尺度", currentScale)
- // this.calCurrentPosition(e);
- // }
- // return;
- // }
- // }
- // return false
- // }
- }, {
- key: "doScale",
- value: function doScale() {
- console.log("执行放大");
- var currentPosition = this.currentPosition,
- currentScale = this.currentScale;
- currentPosition.left = currentPosition.left + currentPosition.xPercent * (currentPosition.right - currentPosition.left) - 1 / 2 * (this.videoWidth / currentScale);
- if (currentPosition.left < 0) {
- currentPosition.left = 0;
- } else if (currentPosition.left > this.videoWidth - this.videoWidth / currentScale) {
- currentPosition.left = this.videoWidth - this.videoWidth / currentScale;
- }
- currentPosition.right = currentPosition.left + this.videoWidth / currentScale;
- currentPosition.top = currentPosition.top + currentPosition.yPercent * (currentPosition.bottom - currentPosition.top) - 1 / 2 * (this.videoHeight / currentScale);
- if (currentPosition.top < 0) {
- currentPosition.top = 0;
- } else if (currentPosition.top > this.videoHeight - this.videoHeight / currentScale) {
- currentPosition.top = this.videoHeight - this.videoHeight / currentScale;
- }
- currentPosition.bottom = currentPosition.top + this.videoHeight / currentScale;
- //整数化
- currentPosition.left = parseInt(currentPosition.left, 10);
- currentPosition.right = parseInt(currentPosition.right, 10);
- currentPosition.top = parseInt(currentPosition.top, 10);
- currentPosition.bottom = parseInt(currentPosition.bottom, 10);
- console.log("计算后,", this.jSPlugin.jSPlugin, currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom, currentPosition.xPercent, currentPosition.yPercent);
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom);
- this.renderDot();
- }
- }, {
- key: "calCurrentPosition",
- value: function calCurrentPosition(e) {
- var currentPosition = this.currentPosition,
- clientRect = this.clientRect;
- currentPosition.x = e.clientX;
- currentPosition.y = e.clientY;
- currentPosition.xPercent = (e.clientX - clientRect.x) / clientRect.width;
- currentPosition.yPercent = (e.clientY - clientRect.y) / clientRect.height;
- this.doScale();
- return;
- }
- }, {
- key: "addScale",
- value: function addScale() {
- var currentScale = this.currentScale,
- currentPosition = this.currentPosition;
- if (currentScale >= 8) {
- console.log("达到最大倍率了");
- if (this.jSPlugin.Message) {
- this.jSPlugin.Message["default"]("已经放大到最大倍数8.0X");
- }
- return false;
- }
- this.currentScale++;
- currentPosition.xPercent = 0.5;
- currentPosition.yPercent = 0.5;
- this.doScale();
- }
- }, {
- key: "subScale",
- value: function subScale() {
- var currentScale = this.currentScale,
- currentPosition = this.currentPosition;
- if (currentScale <= 1) {
- console.log("达到最小倍率了");
- return false;
- }
- this.currentScale--;
- currentPosition.xPercent = 0.5;
- currentPosition.yPercent = 0.5;
- this.doScale();
- }
- }]);
- return Zoom;
- }();
- function lineLength(point1, point2) {
- 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);
- }
- var MobileZoom = /*#__PURE__*/function () {
- function MobileZoom(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, MobileZoom);
- this.jSPlugin = jSPlugin;
- this.enableZoom = false;
- this.isDubboTouch = false, this.videoWidth = 0;
- this.videoHeight = 0;
- this.currentScale = 1;
- this.currentPosition = {
- x: 0,
- //操作点 -x
- y: 0,
- //
- xPercent: 0.10,
- // 百分比 -x
- yPercent: 0.10,
- // 百分比
- xCurrentVideo: 0,
- // 当前放大后可视视频左上角起点
- yCurrentVideo: 0,
- left: 0,
- top: 0,
- right: 1920,
- bottom: 1080
- };
- this.DOM = document.getElementById(jSPlugin.id);
- this.clientRect = document.getElementById(jSPlugin.id).getBoundingClientRect();
- this.point1 = {
- clientX: 0,
- clientY: 0
- };
- this.point2 = {
- clientX: 0,
- clientY: 0
- };
- this.touchLineLength = 0;
- this.inited = false;
- var scaleDOMContainer = document.createElement('div');
- scaleDOMContainer.id = "".concat(jSPlugin.id, "-zoom-container");
- 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;";
- var scaleDOMHTML = "1X";
- scaleDOMContainer.innerHTML = scaleDOMHTML;
- document.getElementById("".concat(jSPlugin.id, "-audioControls-left")).parentNode.appendChild(scaleDOMContainer);
- // document.getElementById(this.jSPlugin.id).addEventListener("mousedown",(event)=>this.onMouseDown(event));
- // document.getElementById(this.jSPlugin.id).addEventListener("mouseup",(event)=>this.onMouseUp(event));
- // document.getElementById(this.jSPlugin.id).addEventListener("mouseout",(event)=>this.onMouseOut(event));
- document.getElementById(this.jSPlugin.id).addEventListener("touchstart", function (event) {
- return _this.onTouchstart(event);
- });
- document.getElementById(this.jSPlugin.id).addEventListener("touchmove", function (event) {
- return _this.onTouchmove(event);
- });
- // var info = jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
- // this.videoWidth = info.width;
- // this.videoHeight = info.height;
- // this.currentPosition.right = info.width;
- // this.currentPosition.bottom = info.height;
- }
- _createClass$1(MobileZoom, [{
- key: "onTouchstart",
- value: function onTouchstart(event) {
- //xuehb 开始手机端电子放大前校验回调状态
- var verifyStatus = this.jSPlugin.beforeMobileZoomVerify();
- if (!verifyStatus) {
- return false;
- }
- if (!this.inited) {
- var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
- this.videoWidth = info.width;
- this.videoHeight = info.height;
- this.currentPosition.right = info.width;
- this.currentPosition.bottom = info.height;
- this.inited = true;
- }
- var currentPosition = this.currentPosition;
- this.currentScale;
- console.log("双指按下", currentPosition);
- var touches = event.touches;
- var events = touches[0];
- var events2 = touches[1];
- if (events) {
- this.point1.clientX = events.clientX;
- this.point1.clientY = events.clientY;
- }
- if (events2) {
- this.point2.clientX = events2.clientX;
- this.point2.clientY = events2.clientY;
- this.touchLineLength = lineLength(this.point1, this.point2);
- this.isDubboTouch = true;
- this.moveX = events.clientX;
- this.moveY = events.clientY;
- }
- console.log("双指按下2", currentPosition);
- }
- }, {
- key: "onTouchmove",
- value: function onTouchmove(event) {
- var isDubboTouch = this.isDubboTouch,
- currentPosition = this.currentPosition,
- clientRect = this.clientRect;
- //xuehb 开始手机端电子放大前校验回调状态
- var verifyStatus = this.jSPlugin.beforeMobileZoomVerify();
- if (!verifyStatus) {
- return false;
- }
- // console.log("event.touches.lenght",event.touches.length);
- if (event.touches.length === 1) {
- var events = event.touches[0];
- //console.log("currentPosition.xPercent",event.touches)
- currentPosition.xPercent = currentPosition.xPercent + (this.point1.clientX - events.clientX) / clientRect.width / this.currentScale;
- currentPosition.yPercent = currentPosition.yPercent + (this.point1.clientY - events.clientY) / clientRect.height / this.currentScale;
- this.doScale();
- this.point1.clientX = events.clientX;
- this.point1.clientY = events.clientY;
- return false;
- }
- if (!isDubboTouch) {
- return false;
- }
- var touches = event.touches;
- var events = touches[0];
- var events2 = touches[1];
- if (events) {
- this.point1.clientX = events.clientX;
- this.point1.clientY = events.clientY;
- }
- if (events2) {
- this.point2.clientX = events2.clientX;
- this.point2.clientY = events2.clientY;
- var newtTouchLineLength = lineLength(this.point1, this.point2);
- if (newtTouchLineLength !== this.touchLineLength) {
- if (newtTouchLineLength > this.touchLineLength) {
- if (this.currentScale < 8) {
- ++this.currentScale;
- currentPosition.xPercent = (this.point1.clientX + this.point2.clientX) / 2 / clientRect.width;
- currentPosition.yPercent = (this.point1.clientY + this.point2.clientY) / 2 / clientRect.height;
- this.doScale();
- } else {
- console.log("已经是最大8倍率了");
- }
- } else {
- if (this.currentScale > 1) {
- --this.currentScale;
- currentPosition.xPercent = (this.point1.clientX + this.point2.clientX) / 2 / clientRect.width;
- currentPosition.yPercent = (this.point1.clientY + this.point2.clientY) / 2 / clientRect.height;
- this.doScale();
- } else {
- console.log("已经是最小1倍率了");
- }
- }
- this.isDubboTouch = false;
- }
- }
- }
- }, {
- key: "startZoom",
- value: function startZoom() {
- var info = this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);
- this.videoWidth = info.width;
- this.videoHeight = info.height;
- this.currentPosition.right = info.width;
- this.currentPosition.bottom = info.height;
- this.currentScale = 1;
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "block";
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
- this.renderDot();
- }
- }, {
- key: "stopZoom",
- value: function stopZoom() {
- this.currentScale = 1;
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(0, this.videoWidth, 0, this.videoHeight);
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
- this.renderDot();
- }
- //xuehb 重置放大
- }, {
- key: "resetZoom",
- value: function resetZoom() {
- this.currentScale = 1;
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = "none";
- }
- }, {
- key: "doScale",
- value: function doScale() {
- var currentPosition = this.currentPosition,
- currentScale = this.currentScale;
- currentPosition.left = currentPosition.left + currentPosition.xPercent * (currentPosition.right - currentPosition.left) - 1 / 2 * (this.videoWidth / currentScale);
- if (currentPosition.left < 0) {
- currentPosition.left = 0;
- } else if (currentPosition.left > this.videoWidth - this.videoWidth / currentScale) {
- currentPosition.left = this.videoWidth - this.videoWidth / currentScale;
- }
- currentPosition.right = currentPosition.left + this.videoWidth / currentScale;
- currentPosition.top = currentPosition.top + currentPosition.yPercent * (currentPosition.bottom - currentPosition.top) - 1 / 2 * (this.videoHeight / currentScale);
- if (currentPosition.top < 0) {
- currentPosition.top = 0;
- } else if (currentPosition.top > this.videoHeight - this.videoHeight / currentScale) {
- currentPosition.top = this.videoHeight - this.videoHeight / currentScale;
- }
- currentPosition.bottom = currentPosition.top + this.videoHeight / currentScale;
- //整数化
- currentPosition.left = parseInt(currentPosition.left, 10);
- currentPosition.right = parseInt(currentPosition.right, 10);
- currentPosition.top = parseInt(currentPosition.top, 10);
- currentPosition.bottom = parseInt(currentPosition.bottom, 10);
- console.log("视频宽高", this.videoWidth, this.videoHeight);
- console.log("计算后,", currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom, currentPosition.xPercent, currentPosition.yPercent);
- // 注意,和PC
- if (currentPosition.left < currentPosition.right && currentPosition.top < currentPosition.bottom && currentPosition.bottom <= this.videoHeight && currentPosition.right <= this.videoWidth) {
- this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(currentPosition.left, currentPosition.right, currentPosition.top, currentPosition.bottom);
- }
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).innerHTML = "".concat(currentScale, ".0X");
- document.getElementById("".concat(this.jSPlugin.id, "-zoom-container")).style.display = currentScale === 1 ? "none" : "inline-block";
- }
- }, {
- key: "calCurrentPosition",
- value: function calCurrentPosition(e) {
- var currentPosition = this.currentPosition,
- clientRect = this.clientRect;
- currentPosition.x = e.clientX;
- currentPosition.y = e.clientY;
- currentPosition.xPercent = (e.clientX - clientRect.x) / clientRect.width;
- currentPosition.yPercent = (e.clientY - clientRect.y) / clientRect.height;
- this.doScale();
- return;
- }
- }]);
- return MobileZoom;
- }();
- var styleToString = function styleToString(obj) {
- var styleString = "";
- Object.keys(obj).map(function (item, index) {
- styleString += "".concat(item, ":").concat(obj[item]).concat(index < Object.keys(obj).length - 1 ? ';' : "");
- });
- return styleString;
- };
- var MEDIAWIDTH = 500;
- var Theme = /*#__PURE__*/function () {
- function Theme(jSPlugin) {
- var _this = this;
- _classCallCheck$1(this, Theme);
- this.jSPlugin = jSPlugin;
- this.isNeedRenderHeader = false;
- this.isNeedRenderFooter = false;
- this.autoFocus = 0;
- this.autoFocusTimer = null;
- this.recordTimer = null;
- this.nextRate = 1;
- this.showHD = false;
- this.themeInited = false;
- this.decoderState = {
- state: {
- isEditing: false,
- play: false,
- sound: false,
- recordvideo: false,
- recordCount: "00:00",
- talk: false,
- zoom: false,
- pantile: false,
- hd: false,
- speed: false,
- expend: false,
- webExpend: false,
- cloudRec: matchEzopenUrl(jSPlugin.url).type === 'cloud.rec',
- rec: matchEzopenUrl(jSPlugin.url).type === 'rec',
- type: matchEzopenUrl(jSPlugin.url).type
- }
- };
- this.pluginStatus = new Status(this, this.jSPlugin.params.id);
- console.log(" matchEzopenUrl(jSPlugin.url)", matchEzopenUrl(jSPlugin.url), this.decoderState.state);
- this.inited = false;
- 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);
- if (typeof jSPlugin.isMobile !== 'undefined') {
- this.isMobile = jSPlugin.isMobile;
- }
- // 默认主题 - 按钮全部展示
- this.themeData = emptyData.data;
- // 自适应主题数据
- /*
- 移动端 & 直播 =》 mobileLive
- 移动端 & 回放地址 => mobileRec
- PC端 & 直播 =》 pcLive
- PC端 & 回放地址 => pcRec
- */
- if (this.jSPlugin.themeId) {
- switch (this.jSPlugin.themeId) {
- case 'pcLive':
- case 'pcRec':
- case 'mobileLive':
- case 'mobileRec':
- case 'security':
- case 'voice':
- case 'simple':
- var ezuikitTemplateDetail = lodash.find(officeTemplateList, function (item) {
- return item.themeId === _this.jSPlugin.themeId;
- });
- if (ezuikitTemplateDetail) {
- this.themeData = ezuikitTemplateDetail;
- }
- this.initThemeData();
- this.renderThemeData();
- break;
- case 'themeData':
- this.themeData = this.jSPlugin.params.themeData;
- this.initThemeData();
- this.renderThemeData();
- break;
- default:
- this.fetchThemeData(this.jSPlugin.themeId);
- break;
- }
- }
- if (!this.jSPlugin.Talk) {
- this.jSPlugin.Talk = new Talk(this.jSPlugin);
- }
- addCss("".concat(this.jSPlugin.staticPath, "/speed/speed.css"));
- addCss("".concat(this.jSPlugin.staticPath, "/css/theme.css"));
- }
- _createClass$1(Theme, [{
- key: "fetchThemeData",
- value: function fetchThemeData(themeId) {
- var _this2 = this;
- var url = "".concat(this.jSPlugin.env.domain, "/console/jssdk/ezopen/template/getDetail?accessToken=").concat(this.jSPlugin.accessToken, "&id=").concat(themeId);
- if (window.location.hostname === "test11open.ys7.com" || window.location.hostname === "127.0.0.1" || window.location.hostname === "jianboyu.top") {
- url = url.replace("test12open.ys7.com/console/jssdk", "test11open.ys7.com/console/jssdk");
- }
- fetch(url, {
- method: 'GET'
- }).then(function (response) {
- return response.json();
- }).then(function (data) {
- console.log("get theme data", data);
- if (data.meta.code === 0 && data.data) {
- _this2.themeData = data.data;
- if (data.data.header) {
- _this2.themeData.header = data.data.header;
- _this2.themeData.header.btnList = _this2.themeData.header.btnList.sort(function (a, b) {
- return a.btnKey.split("-")[3] - b.btnKey.split("-")[3];
- });
- }
- if (data.data.footer) {
- _this2.themeData.footer = data.data.footer;
- _this2.themeData.footer.btnList = _this2.themeData.footer.btnList.sort(function (a, b) {
- return a.btnKey.split("-")[3] - b.btnKey.split("-")[3];
- });
- }
- _this2.initThemeData();
- _this2.renderThemeData();
- }
- })["catch"](function (error) {
- _this2.renderThemeData();
- });
- }
- }, {
- key: "changeTheme",
- value: function changeTheme(options) {
- var _this3 = this;
- if (typeof options === 'string') {
- this.jSPlugin.themeId = options;
- switch (this.jSPlugin.themeId) {
- case 'pcLive':
- case 'pcRec':
- case 'mobileLive':
- case 'mobileRec':
- case 'security':
- case 'voice':
- case 'simple':
- var ezuikitTemplateDetail = lodash.find(officeTemplateList, function (item) {
- return item.themeId === _this3.jSPlugin.themeId;
- });
- if (ezuikitTemplateDetail) {
- this.themeData = ezuikitTemplateDetail;
- }
- this.initThemeData();
- this.renderThemeData();
- break;
- default:
- this.fetchThemeData(options);
- break;
- }
- } else if (_typeof(options) === 'object') {
- this.themeData = options;
- this.initThemeData();
- this.renderThemeData();
- if (this.decoderState.state.isEditing) {
- this.editStart();
- }
- }
- if (this.jSPlugin && this.jSPlugin.handleThemeChange) {
- this.jSPlugin.handleThemeChange(options);
- }
- }
- }, {
- key: "renderThemeData",
- value: function renderThemeData() {
- var _this4 = this;
- var _this$themeData = this.themeData,
- header = _this$themeData.header,
- footer = _this$themeData.footer;
- if (this.isNeedRenderHeader && header) {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.background = header.backgroundColor.replace("-diy", "");
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.color = header.color.replace("-diy", "");
- header.btnList.map(function (item, index) {
- if (item.isrender) {
- _this4.setDecoderState(_defineProperty({}, item.iconId, _this4.decoderState.state[item.iconId]));
- }
- });
- }
- if (this.isNeedRenderFooter && footer) {
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.background = footer.backgroundColor.replace("-diy", "");
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.color = footer.color.replace("-diy", "");
- footer.btnList.map(function (item, index) {
- if (item.isrender) {
- _this4.setDecoderState(_defineProperty({}, item.iconId, _this4.decoderState.state[item.iconId]));
- }
- if (item.iconId === "play" && item.defaultActive && !_this4.themeInited) {
- var checkTimer = setInterval(function () {
- if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(checkTimer);
- _this4.jSPlugin.play();
- _this4.themeInited = true;
- }
- }, 50);
- }
- });
- // 判断标清高清
- if (this.jSPlugin.url.indexOf("hd.live") !== -1) {
- this.setDecoderState({
- hd: true
- });
- }
- // 判断是否自动隐藏控件
- if (this.themeData.autoFocus > 0) {
- this.autoFocus = parseInt(this.themeData.autoFocus);
- this.startAutoFocus();
- document.getElementById("".concat(this.jSPlugin.id, "-wrap")).addEventListener("click", function () {
- _this4.stopAutoFocus();
- });
- // document.getElementById(`${this.jSPlugin.id}-wrap`).addEventListener("mouseout", ()=>{
- // console.log("开启自动隐藏")
- // this.startAutoFocus();
- // })
- }
- // 设置当前播放类型
- this.setDecoderState({
- cloudRec: matchEzopenUrl(this.jSPlugin.url).type === 'cloud.rec',
- rec: matchEzopenUrl(this.jSPlugin.url).type === 'rec',
- type: matchEzopenUrl(this.jSPlugin.url).type
- });
- } else {
- if (!this.themeInited) {
- var _checkTimer = setInterval(function () {
- if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(_checkTimer);
- _this4.jSPlugin.play();
- _this4.themeInited = true;
- }
- }, 50);
- }
- }
- var isNeedRoom = lodash.findIndex(this.themeData.footer.btnList, function (v) {
- return v.iconId === 'zoom' && v.isrender > 0;
- }) >= 0;
- if (isNeedRoom) {
- if (this.isMobile) {
- //xuehb 开始手机端电子放大前校验回调,真正可以阻止放大的方法
- this.jSPlugin.beforeMobileZoomVerify = function () {
- //xuehb 播放状态才可以电子放大
- var play = _this4.decoderState.state.play;
- console.log('手机端电子放大前校验回调play------------', play);
- if (!play) {
- return false;
- } else {
- return true;
- }
- };
- this.jSPlugin.Zoom = new MobileZoom(this.jSPlugin);
- } else {
- this.jSPlugin.Zoom = new Zoom(this.jSPlugin);
- }
- }
- var checkTimer = setInterval(function () {
- if (window.EZUIKit[_this4.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(checkTimer);
- // 执行一次reSize
- _this4.jSPlugin.reSize(_this4.jSPlugin.params.width, _this4.jSPlugin.params.height);
- }
- }, 50);
- }
- }, {
- key: "setDecoderState",
- value: function setDecoderState(options) {
- var _this5 = this;
- var _this$themeData2 = this.themeData,
- header = _this$themeData2.header,
- footer = _this$themeData2.footer;
- Object.keys(options).map(function (item, index) {
- var color = "#FFFFFF";
- var activeColor = "#FFFFFF";
- var _index = header.btnList.findIndex(function (i) {
- return i.iconId === item;
- });
- if (_index === -1) {
- color = footer.color.replace("-diy", "");
- activeColor = footer.activeColor.replace("-diy", "");
- } else {
- color = header.color.replace("-diy", "");
- // 按钮相关的激活颜色统一使用底部的
- activeColor = footer.activeColor.replace("-diy", "");
- }
- switch (item) {
- case 'play':
- if (options[item]) {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-play"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[0].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[1].style = "display:none";
- document.getElementById("".concat(_this5.jSPlugin.id, "-play")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).childNodes[0].children[0].style.fill = options[item] ? activeColor : color;
- }
- } else {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-play"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[1].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).children[0].children[0].style = "display:none";
- document.getElementById("".concat(_this5.jSPlugin.id, "-play")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-play-content")).childNodes[0].children[1].style.fill = options[item] ? activeColor : color;
- }
- }
- break;
- case 'sound':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-sound"))) {
- if (options[item]) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[1].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[0].style = "display:none";
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).childNodes[0].children[1].style.fill = options[item] ? activeColor : color;
- } else {
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[0].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).children[0].children[1].style = "display:none";
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-sound-content")).childNodes[0].children[0].style.fill = options[item] ? activeColor : color;
- }
- }
- break;
- case 'recordvideo':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-recordvideo-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
- // 定时器处理
- if (options[item]) {
- _this5.countTime('add', 0);
- // this.recordTimer = setInterval(() => {
- // }, 1000);
- } else {
- _this5.countTime('destroy', 0);
- // clearInterval(this.recordTimer);
- }
- }
- break;
- case 'talk':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-talk"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-talk")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-talk-content")).childNodes[1].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'zoom':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-zoom"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-zoom")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-zoom-content")).childNodes[1].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'pantile':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-pantile"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-pantile")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-pantile-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'webExpend':
- if (options[item]) {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[1].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[0].style = "display:none";
- }
- // 全屏置灰
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = "disabled";
- }
- } else {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[0].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).children[0].children[1].style = "display:none";
- }
- // 全屏置灰
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = "";
- }
- }
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).childNodes[0].childNodes[0].style.fill = options[item] ? activeColor : color;
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend-content")).childNodes[0].childNodes[1].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'capturePicture':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-capturePicture-content")).childNodes[0].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'expend':
- if (options[item]) {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[1].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[0].style = "display:none";
- }
- // 网站全屏置灰
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = "disabled";
- }
- } else {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[0].style = "display:inline-block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).children[0].children[1].style = "display:none";
- }
- // 网站全屏置灰
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-webExpend")).className = "";
- }
- }
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-expend"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).childNodes[0].childNodes[0].style.fill = options[item] ? activeColor : color;
- document.getElementById("".concat(_this5.jSPlugin.id, "-expend-content")).childNodes[0].childNodes[1].style.fill = options[item] ? activeColor : color;
- }
- break;
- case 'hd':
- if (options[item]) {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-hd"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[0].style = "display:block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[1].style = "display:none";
- }
- } else {
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-hd"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[1].style = "display:block";
- document.getElementById("".concat(_this5.jSPlugin.id, "-hd-content")).children[1].children[0].style = "display:none";
- }
- }
- break;
- case 'speed':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-speed"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-speed-content")).children[1].children[0].style.color = options[item] ? activeColor : color;
- document.getElementById("".concat(_this5.jSPlugin.id, "-speed-content")).children[1].children[0].style.borderColor = options[item] ? activeColor : color;
- }
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask"))) {
- if (_this5.isMobile && options[item]) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask")).style.display = "block";
- } else {
- document.getElementById("".concat(_this5.jSPlugin.id, "-select-mask")).style.display = "none";
- }
- }
- break;
- case 'cloudRec':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec"))) {
- console.log("document.getElementById(`${this.jSPlugin.id}-cloudRec-content`)", document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")));
- document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec-content")).children[0].children[0].style.fill = options[item] ? activeColor : color;
- }
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-rec"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-rec")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-rec-content")).children[0].children[0].style.fill = options[item] ? color : activeColor;
- }
- break;
- case 'rec':
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-cloudRec-content")).children[0].children[0].style.fill = options[item] ? color : activeColor;
- }
- if (document.getElementById("".concat(_this5.jSPlugin.id, "-rec"))) {
- document.getElementById("".concat(_this5.jSPlugin.id, "-rec")).className = options[item] ? 'active' : '';
- document.getElementById("".concat(_this5.jSPlugin.id, "-rec-content")).children[0].children[0].style.fill = options[item] ? activeColor : color;
- }
- break;
- }
- _this5.decoderState.state = Object.assign(_this5.decoderState.state, options);
- });
- }
- }, {
- key: "startAutoFocus",
- value: function startAutoFocus() {
- var _this6 = this;
- //console.log("开始自动隐藏",this.autoFocus);
- var autoFocus = this.autoFocus;
- // if(document.getElementById(`${this.jSPlugin.id}-audioControls`)) {
- if (this.autoFocusTimer) {
- clearTimeout(this.autoFocusTimer);
- }
- this.autoFocusTimer = setTimeout(function () {
- if (document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls"))) {
- document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls")).style.opacity = 0;
- document.getElementById("".concat(_this6.jSPlugin.id, "-audioControls")).style.pointerEvents = 'none';
- }
- }, autoFocus * 1000);
- }
- }, {
- key: "stopAutoFocus",
- value: function stopAutoFocus() {
- //console.log("结束自动隐藏")
- if (document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.opacity = 1;
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.pointerEvents = 'all';
- }
- if (this.autoFocusTimer) {
- clearTimeout(this.autoFocusTimer);
- }
- this.startAutoFocus();
- }
- }, {
- key: "toString",
- value: function toString() {
- return "".concat(this.coreX, "-").concat(this.coreY);
- }
- }, {
- key: "renderFooter",
- value: function renderFooter(id, part) {
- var _this7 = this;
- // 播放停止
- var objItem = this.matchBtn(id);
- // 移动端不展示电子放大
- if (this.isMobile && objItem.id === "zoom") {
- return false;
- }
- var objDOM = document.createElement('div');
- objDOM.className = "theme-icon-item";
- 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>`
- + "<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>`
- + '</span>';
- objDOM.onclick = function (e) {
- if (_this7.decoderState.state.isEditing) {
- return false;
- }
- objItem.onclick(e);
- };
- if (objItem.onmouseenter) {
- objDOM.onmouseenter = function (e) {
- if (_this7.decoderState.state.isEditing) {
- return false;
- }
- objItem.onmouseenter(e);
- };
- }
- if (objItem.onmouseleave) {
- objDOM.onmouseleave = function (e) {
- if (_this7.decoderState.state.isEditing) {
- return false;
- }
- objItem.onmouseleave(e);
- };
- }
- var toLeft = document.createElement('span');
- toLeft.className = "icon-move left";
- 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>");
- toLeft.onclick = function () {
- _this7.editIcon(objItem.id, 'left', 'footer');
- };
- objDOM.appendChild(toLeft);
- var toRight = document.createElement('span');
- toRight.className = "icon-move right";
- 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>");
- toRight.onclick = function () {
- _this7.editIcon(objItem.id, 'right', 'footer');
- };
- objDOM.appendChild(toRight);
- var toClose = document.createElement('span');
- toClose.className = "icon-move close";
- 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>';
- toClose.onclick = function () {
- _this7.editIcon(objItem.id, 'delete', 'footer');
- };
- objDOM.appendChild(toClose);
- if (part === 'left') {
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).childNodes[0].appendChild(objDOM);
- } else {
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).childNodes[1].appendChild(objDOM);
- }
- // 截图
- }
- }, {
- key: "editIcon",
- value: function editIcon(id, type, area) {
- console.log("编辑组件", id, type, area);
- var newThemeData = this.themeData;
- console.log("themeData", this.themeData);
- var btnList = this.themeData[area].btnList;
- var _index = lodash.findIndex(btnList, function (item) {
- return item.iconId === id;
- });
- var tmp = btnList[_index];
- switch (type) {
- case 'delete':
- // btnList.splice(_index, 1);
- // 限制回放必须选中一种介质
- if (id === "rec") {
- if (lodash.findIndex(btnList, function (item) {
- return item.iconId === "cloudRec" && item.isrender == 1;
- }) === -1) {
- if (this.jSPlugin.Message) {
- this.jSPlugin.Message["default"]("必须选中一种存储介质");
- }
- return false;
- }
- } else if (id === "cloudRec") {
- if (lodash.findIndex(btnList, function (item) {
- return item.iconId === "rec" && item.isrender == 1;
- }) === -1) {
- if (this.jSPlugin.Message) {
- this.jSPlugin.Message["default"]("必须选中一种存储介质");
- }
- return false;
- }
- }
- btnList[_index].isrender = 0;
- break;
- case 'right':
- var nextRightBtnIndex = -1;
- for (var i = _index + 1; i < btnList.length; i++) {
- if (btnList[i].part === btnList[_index].part && btnList[i].isrender == 1) {
- nextRightBtnIndex = i;
- break;
- }
- }
- if (nextRightBtnIndex !== -1) {
- btnList[_index] = btnList[nextRightBtnIndex];
- btnList[nextRightBtnIndex] = tmp;
- }
- break;
- case 'left':
- var nextLeftBtnIndex = -1;
- for (var _i = _index - 1; _i >= 0; _i--) {
- if (btnList[_i].part === btnList[_index].part && btnList[_i].isrender == 1) {
- nextLeftBtnIndex = _i;
- break;
- }
- }
- if (nextLeftBtnIndex !== -1) {
- btnList[_index] = btnList[nextLeftBtnIndex];
- btnList[nextLeftBtnIndex] = tmp;
- }
- break;
- }
- console.log("new btnList", btnList);
- newThemeData[area].btnList = btnList;
- //this.renderThemeData();
- this.changeTheme(newThemeData);
- }
- }, {
- key: "renderHeader",
- value: function renderHeader(id, part) {
- var _this8 = this;
- // 播放停止
- var objItem = this.matchBtn(id);
- var objDOM = document.createElement('div');
- objDOM.className = "theme-icon-item";
- objDOM.style = "max-width:50%;";
- 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>`
- + "<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>`
- + "<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>';
- // var toLeft = document.createElement('span');
- // 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>`;
- // toLeft.onclick = () => {console.log("左移动")};
- objDOM.onclick = function (e) {
- if (_this8.decoderState.state.isEditing) {
- return false;
- }
- objItem.onclick(e);
- };
- // var toLeft = document.createElement('span');
- // toLeft.className = "icon-move left";
- // 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>`;
- // toLeft.onclick = () => {this.editIcon(objItem.id,'left','header')};
- // objDOM.appendChild(toLeft);
- // var toRight = document.createElement('span');
- // toRight.className = "icon-move right";
- // 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>`;
- // toRight.onclick = () => {this.editIcon(objItem.id,'right','header')};
- // objDOM.appendChild(toRight);
- var toClose = document.createElement('span');
- toClose.className = "icon-move close";
- 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>';
- toClose.onclick = function () {
- _this8.editIcon(objItem.id, 'delete', 'header');
- };
- objDOM.appendChild(toClose);
- // objDOM.appendChild(toLeft);
- if (part === 'left') {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).childNodes[0].appendChild(objDOM);
- } else {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).childNodes[1].appendChild(objDOM);
- }
- }
- }, {
- key: "countTime",
- value: function countTime(type) {
- var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- var that = this;
- if (!document.getElementById(this.jSPlugin.id + "time-area")) {
- var recordDOM = document.createElement("div");
- recordDOM.id = this.jSPlugin.id + "time-area";
- recordDOM.className = "time-area";
- recordDOM.innerHTML = "<span class=\"dot\"></span><span class=\"value\">00:00</span>";
- if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).appendChild(recordDOM);
- }
- }
- if (this.countTimer) {
- clearInterval(this.countTimer);
- }
- if (type === 'add') {
- var i = start;
- document.getElementById(that.jSPlugin.id + "time-area").style.display = 'flex';
- this.countTimer = setInterval(function () {
- ++i;
- document.getElementById(that.jSPlugin.id + "time-area").children[1].innerHTML = formatSeconds(i);
- }, 1000);
- } else if (type === 'destroy') {
- if (this.countTimer) {
- clearInterval(this.countTimer);
- }
- this.countTimer = undefined;
- if (document.getElementById(that.jSPlugin.id + "time-area")) {
- document.getElementById(that.jSPlugin.id + "time-area").children[1].innerHTML = '00:00';
- document.getElementById(that.jSPlugin.id + "time-area").style.display = 'none';
- }
- }
- //将秒数转换为时分秒格式
- function formatSeconds(value) {
- var theTime = parseInt(value); // 秒
- var middle = 0; // 分
- var hour = 0; // 小时
- var secondV = '00';
- var minV = '00';
- var hourV = '00';
- if (theTime > 59) {
- middle = parseInt(theTime / 60);
- theTime = parseInt(theTime % 60);
- if (middle > 59) {
- hour = parseInt(middle / 60);
- middle = parseInt(middle % 60);
- }
- }
- secondV = parseInt(theTime) > 9 ? parseInt(theTime) : '0' + parseInt(theTime);
- minV = parseInt(middle) > 9 ? parseInt(middle) : '0' + parseInt(middle);
- hourV = parseInt(hour) > 9 ? parseInt(hour) : '0' + parseInt(hour);
- if (hour > 0) {
- return hourV + ':' + minV + ':' + secondV;
- } else if (middle > 0) {
- return minV + ':' + secondV;
- } else {
- return '00:' + secondV;
- }
- }
- }
- }, {
- key: "setDisabled",
- value: function setDisabled(status) {
- var _this$decoderState$st = this.decoderState.state,
- sound = _this$decoderState$st.sound,
- hd = _this$decoderState$st.hd;
- //设置按钮禁止点击状态
- 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');
- 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');
- 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');
- 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');
- 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');
- 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');
- // document.getElementById(`${this.jSPlugin.id}-expend-icon`).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
- // document.getElementById(`${this.jSPlugin.id}-webExpend-icon`).setAttribute('style', status ? 'cursor: not-allowed;fill: gray' : 'cursor: default');
- 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');
- 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;'));
- }
- }, {
- key: "matchBtn",
- value: function matchBtn(btnId) {
- var _this9 = this;
- var _this$themeData3 = this.themeData,
- header = _this$themeData3.header,
- footer = _this$themeData3.footer;
- var btnItem = {
- title: "",
- id: "",
- domString: "",
- color: "#FFFFFF",
- activeColor: "#FFFFFF",
- onclick: function onclick() {},
- onmoveleft: function onmoveleft() {},
- onmoveright: function onmoveright() {},
- onremove: function onremove() {}
- };
- var _index = header.btnList.findIndex(function (item) {
- return item.iconId === btnId;
- });
- if (_index === -1) {
- btnItem.color = footer.color;
- btnItem.backgroundColor = footer.backgroundColor;
- btnItem.activeColor = footer.activeColor;
- } else {
- btnItem.color = header.color;
- btnItem.backgroundColor = header.backgroundColor;
- btnItem.activeColor = header.activeColor;
- }
- switch (btnId) {
- case 'play':
- btnItem.title = "播放/结束播放";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s = _this9.decoderState.state,
- play = _this9$decoderState$s.play,
- isEditing = _this9$decoderState$s.isEditing,
- rec = _this9$decoderState$s.rec,
- cloudRec = _this9$decoderState$s.cloudRec,
- recordvideo = _this9$decoderState$s.recordvideo;
- if (isEditing) {
- return false;
- }
- if (play) {
- if (rec || cloudRec) {
- //回放时调用暂停,而不是结束播放
- _this9.jSPlugin.pause();
- } else {
- _this9.jSPlugin.stop();
- }
- //停止录像并关闭录像计时
- if (recordvideo) {
- // this.jSPlugin.stopSave();
- _this9.setDecoderState({
- recordvideo: false
- });
- }
- _this9.jSPlugin.Zoom.stopZoom();
- } else {
- if (rec || cloudRec) {
- //回放时调用恢复播放状态
- _this9.jSPlugin.resume();
- } else {
- _this9.jSPlugin.play();
- }
- //xuehb 重置手机端电子放大状态
- _this9.resetMobileZoomStatus();
- }
- _this9.setDecoderState({
- zoom: false,
- play: !play
- });
- _this9.setDisabled(play);
- };
- return btnItem;
- case 'sound':
- btnItem.title = "声音";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s2 = _this9.decoderState.state,
- play = _this9$decoderState$s2.play,
- sound = _this9$decoderState$s2.sound,
- talk = _this9$decoderState$s2.talk;
- if (play) {
- if (sound) {
- _this9.jSPlugin.closeSound();
- _this9.setDecoderState({
- sound: false
- });
- } else {
- //xuehb 判断是否打开对讲了,对讲情况下不可以打开声音
- if (!talk) {
- _this9.jSPlugin.openSound();
- _this9.setDecoderState({
- sound: true
- });
- }
- }
- }
- };
- return btnItem;
- case 'recordvideo':
- btnItem.title = "录屏";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s3 = _this9.decoderState.state,
- play = _this9$decoderState$s3.play,
- recordvideo = _this9$decoderState$s3.recordvideo;
- if (play) {
- if (recordvideo) {
- _this9.jSPlugin.stopSave();
- _this9.setDecoderState({
- recordvideo: false
- });
- } else {
- _this9.jSPlugin.startSave("".concat(new Date().getTime()));
- _this9.setDecoderState({
- recordvideo: true
- });
- }
- }
- };
- return btnItem;
- case 'capturePicture':
- btnItem.title = "截图";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var play = _this9.decoderState.state.play;
- if (play) {
- _this9.jSPlugin.capturePicture("".concat(new Date().getTime()));
- } else {
- console.log("视频未播放,无法截图");
- }
- };
- return btnItem;
- case 'talk':
- btnItem.title = "对讲";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s4 = _this9.decoderState.state,
- talk = _this9$decoderState$s4.talk,
- sound = _this9$decoderState$s4.sound,
- play = _this9$decoderState$s4.play;
- if (play) {
- if (talk) {
- console.log('结束对讲');
- _this9.setDecoderState({
- talk: false
- });
- _this9.jSPlugin.Talk.stopTalk();
- var isReOpenSound = lodash.findIndex(_this9.themeData.footer.btnList, function (v) {
- return v.iconId === 'sound' && v.isrender === 1 && v.defaultActive === 1;
- }) > -1;
- if (_this9.themeData && isReOpenSound) {
- _this9.jSPlugin.openSound();
- _this9.setDecoderState({
- sound: true
- });
- }
- } else {
- console.log('开始对讲');
- _this9.setDecoderState({
- talk: true
- });
- if (sound) {
- _this9.jSPlugin.closeSound();
- _this9.setDecoderState({
- sound: false
- });
- }
- _this9.jSPlugin.Talk.startTalk();
- }
- }
- };
- return btnItem;
- case 'zoom':
- btnItem.title = "电子放大";
- btnItem.id = btnId;
- 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>");
- btnItem.onclick = function () {
- var _this9$decoderState$s5 = _this9.decoderState.state,
- zoom = _this9$decoderState$s5.zoom,
- play = _this9$decoderState$s5.play;
- if (!play) {
- return false;
- }
- if (zoom) {
- console.log('结束电子放大');
- _this9.setDecoderState({
- zoom: false
- });
- _this9.jSPlugin.Zoom.stopZoom();
- } else {
- console.log('开始电子放大');
- _this9.jSPlugin.Zoom.startZoom();
- _this9.setDecoderState({
- zoom: true
- });
- }
- };
- return btnItem;
- case 'pantile':
- btnItem.title = "云台控制";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s6 = _this9.decoderState.state,
- play = _this9$decoderState$s6.play,
- pantile = _this9$decoderState$s6.pantile,
- expend = _this9$decoderState$s6.expend;
- if (play) {
- if (!pantile) {
- console.log('显示云台');
- if (_this9.isMobile && !expend) {
- console.log("移动端,非全屏状态不展示云台");
- // 移动端,非全屏状态不展示云台
- return false;
- }
- _this9.Ptz.show();
- _this9.setDecoderState({
- pantile: true
- });
- } else {
- console.log('隐藏云台');
- _this9.Ptz.hide();
- _this9.setDecoderState({
- pantile: false
- });
- }
- }
- };
- return btnItem;
- case 'expend':
- btnItem.title = "全局全屏";
- btnItem.id = btnId;
- 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>");
- btnItem.onclick = function () {
- var _this9$decoderState$s7 = _this9.decoderState.state,
- webExpend = _this9$decoderState$s7.webExpend,
- expend = _this9$decoderState$s7.expend;
- _this9$decoderState$s7.play;
- var pantile = _this9$decoderState$s7.pantile;
- // if (!play) {
- // return false;
- // }
- if (webExpend) {
- console.log("正在网站全屏");
- return false;
- }
- if (!expend) {
- console.log("执行全局全屏");
- if (_this9.isMobile) {
- var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(_this9.jSPlugin.id)).height, 10);
- requestMobileFullScreen(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")));
- setTimeout(function () {
- var width = document.documentElement.clientWidth;
- var height = document.documentElement.clientHeight;
- // 兼容微信浏览器footer被隐藏
- // document.getElementById(`${this.jSPlugin.id}-ez-iframe-footer-container`).style.marginTop = "0px";
- // document.getElementById(`${this.jSPlugin.id}-headControl`).style.position = "absolute";
- document.getElementById("".concat(_this9.jSPlugin.id)).style["backface-visibility"] = "hidden";
- _this9.jSPlugin.jSPlugin.JS_Resize(height, width - heightIntercept);
- }, 100);
- } else {
- var width = window.screen.width;
- var height = window.screen.height;
- var promise = requestFullScreenPromise(document.getElementById("".concat(_this9.jSPlugin.id)));
- promise.then(function (data) {
- _this9.jSPlugin.jSPlugin.JS_Resize(width, height);
- })["catch"](function (err) {
- console.log(err);
- });
- }
- } else {
- if (_this9.isMobile) {
- var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(_this9.jSPlugin.id)).height, 10);
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-ez-iframe-footer-container"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-ez-iframe-footer-container")).style.marginTop = "-32px";
- }
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-headControl")).style.position = "relative";
- }
- cancelMobileFullScreen(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")), _this9.jSPlugin.width, _this9.jSPlugin.height + heightIntercept);
- _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
- // 移动端取消全屏,如果开启了云台,取消云台
- if (pantile) {
- _this9.Ptz.hide();
- _this9.setDecoderState({
- pantile: false
- });
- }
- } else {
- console.log("取消全局全屏");
- var cancelPromise = cancelFullScreenPromise();
- cancelPromise.then(function (data) {
- console.log("取消全屏", data, _this9.jSPlugin);
- _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
- });
- }
- }
- _this9.setDecoderState({
- expend: !expend
- });
- };
- return btnItem;
- case 'webExpend':
- btnItem.title = "网页全屏";
- btnItem.id = btnId;
- 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>';
- btnItem.onclick = function () {
- var _this9$decoderState$s8 = _this9.decoderState.state,
- webExpend = _this9$decoderState$s8.webExpend,
- expend = _this9$decoderState$s8.expend;
- _this9$decoderState$s8.play;
- // if (!play) {
- // return false;
- // }
- if (expend) {
- console.log("正在全局全屏");
- return false;
- }
- if (_this9.jSPlugin.recTimer) {
- clearInterval(_this9.jSPlugin.recTimer);
- }
- if (!webExpend) {
- console.log("执行网页全屏");
- var footerDOMHeight = 0;
- var headerDOMHeight = 0;
- var that = _this9;
- ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
- // 监听全屏事件触发
- window.addEventListener(item, function fullscreenchange(e) {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (isFullScreen) {
- if (document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0"))) {
- 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';
- }
- } else {
- if (document.getElementById("".concat(that.jSPlugin.id, "-loading-item-0"))) {
- 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';
- }
- }
- return isFullScreen;
- });
- });
- var width = window.screen.width;
- var height = window.screen.height;
- var promise = requestFullScreenPromise(document.getElementById("".concat(_this9.jSPlugin.id, "-wrap")));
- promise.then(function (data) {
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-canvas-container"))) {
- footerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-canvas-container"))).height, 10);
- }
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))) {
- headerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this9.jSPlugin.id, "-headControl"))).height, 10);
- }
- _this9.jSPlugin.jSPlugin.JS_Resize(width, height - footerDOMHeight - headerDOMHeight);
- if (_this9.jSPlugin.Theme.Rec) {
- _this9.jSPlugin.Theme.Rec.recAutoSize();
- }
- })["catch"](function (err) {
- console.log(err);
- });
- } else {
- console.log("取消网页全屏");
- var cancelPromise = cancelFullScreenPromise();
- cancelPromise.then(function (data) {
- _this9.jSPlugin.jSPlugin.JS_Resize(_this9.jSPlugin.width, _this9.jSPlugin.height);
- if (_this9.jSPlugin.Theme.Rec) {
- _this9.jSPlugin.Theme.Rec.recAutoSize();
- }
- });
- }
- _this9.setDecoderState({
- webExpend: !webExpend
- });
- };
- return btnItem;
- case 'hd':
- btnItem.title = "画面清晰度";
- btnItem.id = btnId;
- 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>`
- // + `<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>`
- + "<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>';
- btnItem.onclick = function (e) {
- var _this9$decoderState$s9 = _this9.decoderState.state,
- hd = _this9$decoderState$s9.hd,
- expend = _this9$decoderState$s9.expend,
- recordvideo = _this9$decoderState$s9.recordvideo,
- play = _this9$decoderState$s9.play;
- if (play) {
- // 选择清晰度选项时才触发事件
- if (hd && e.target.id === "".concat(_this9.jSPlugin.id, "-select-sd")) {
- //decoder.changePlayUrl({ hd: false });
- console.log("切换到标清");
- _this9.jSPlugin.changeVideoLevel(0);
- _this9.setDecoderState({
- hd: false
- });
- //xuehb 重置手机端电子放大状态
- _this9.resetMobileZoomStatus();
- //切换清晰度时停止录像并关闭录像计时
- if (recordvideo) {
- // this.jSPlugin.stopSave();
- _this9.setDecoderState({
- recordvideo: false
- });
- }
- _this9.setDecoderState({
- zoom: false
- });
- _this9.jSPlugin.Zoom.stopZoom();
- } else if (!hd && e.target.id === "".concat(_this9.jSPlugin.id, "-select-hd")) {
- _this9.jSPlugin.changeVideoLevel(1);
- _this9.setDecoderState({
- hd: true
- });
- //xuehb 重置手机端电子放大状态
- _this9.resetMobileZoomStatus();
- //切换清晰度时停止录像并关闭录像计时
- if (recordvideo) {
- // this.jSPlugin.stopSave();
- _this9.setDecoderState({
- recordvideo: false
- });
- }
- _this9.setDecoderState({
- zoom: false
- });
- _this9.jSPlugin.Zoom.stopZoom();
- }
- _this9.showHD = !_this9.showHD;
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).style.display = document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).style.display === 'none' ? 'block' : 'none';
- if (_this9.isMobile) {
- 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';
- }
- }
- if (_this9.isMobile && expend && _this9.showHD) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).className = "hd speed-select mobile expend";
- } else {
- document.getElementById("".concat(_this9.jSPlugin.id, "-hdSelect")).className = _this9.isMobile ? "hd speed-select mobile" : "speed-select";
- }
- }
- };
- return btnItem;
- case 'speed':
- btnItem.title = "回放倍速";
- btnItem.id = btnId;
- 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>';
- if (!this.isMobile) {
- btnItem.onmouseenter = function (e) {
- var play = _this9.decoderState.state.play;
- if (!play) {
- return false;
- }
- console.log("鼠标移入", e);
- _this9.setDecoderState({
- speed: true
- });
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'block';
- }
- };
- btnItem.onmouseleave = function (e) {
- var play = _this9.decoderState.state.play;
- if (!play) {
- return false;
- }
- console.log("鼠标移出", e);
- _this9.setDecoderState({
- speed: false
- });
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'none';
- }
- };
- }
- btnItem.onclick = function (e) {
- var _this9$decoderState$s10 = _this9.decoderState.state,
- speed = _this9$decoderState$s10.speed,
- expend = _this9$decoderState$s10.expend,
- play = _this9$decoderState$s10.play;
- //xuehb 播放状态才可以设置倍数
- if (!play) {
- return false;
- }
- if (!speed && _this9.isMobile) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).className = expend ? "speed speed-select mobile expend" : "speed speed-select mobile";
- }
- _this9.nextRate = 1;
- // 选择清晰度选项时才触发事件
- // if(this.isMobile) {
- // console.log("请执行移动端倍速");
- // return false;
- // }
- if (e.target.id) {
- switch (e.target.id) {
- case "".concat(_this9.jSPlugin.id, "-select-speed1"):
- // case `${this.jSPlugin.id}-select-speed`:
- console.log("倍速1");
- _this9.nextRate = 1;
- _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
- _this9.changeRecSpeed(1);
- _this9.jSPlugin.speed = 1;
- _this9.setDecoderState({
- speed: !speed
- });
- break;
- case "".concat(_this9.jSPlugin.id, "-select-speed2"):
- console.log("倍速2");
- _this9.nextRate = 2;
- _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
- _this9.changeRecSpeed(2);
- _this9.jSPlugin.speed = 2;
- _this9.setDecoderState({
- speed: !speed
- });
- break;
- case "".concat(_this9.jSPlugin.id, "-select-speed4"):
- console.log("倍速4");
- _this9.nextRate = 4;
- _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
- _this9.changeRecSpeed(4);
- _this9.jSPlugin.speed = 4;
- _this9.setDecoderState({
- speed: !speed
- });
- break;
- case "".concat(_this9.jSPlugin.id, "-select-speed05"):
- console.log("倍速05");
- _this9.nextRate = 3;
- _this9.jSPlugin.jSPlugin.JS_Speed(_this9.nextRate);
- _this9.changeRecSpeed(0.5);
- _this9.jSPlugin.speed = 0.5;
- _this9.setDecoderState({
- speed: !speed
- });
- break;
- default:
- // if(document.getElementById(`${this.jSPlugin.id}-speed-text`)){
- // document.getElementById(`${this.jSPlugin.id}-speed-text`).innerHTML = this.nextRate +"倍";
- // }
- // pc 端点击不再隐藏,只通过移出隐藏
- if (!_this9.isMobile) {
- _this9.setDecoderState({
- speed: true
- });
- } else {
- _this9.setDecoderState({
- speed: !speed
- });
- }
- break;
- }
- }
- // pc 端点击不再隐藏,只通过移出隐藏
- if (!_this9.isMobile && e.target.id === "".concat(_this9.jSPlugin.id, "-speed-text")) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = 'block';
- } else {
- if (document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect"))) {
- document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display = document.getElementById("".concat(_this9.jSPlugin.id, "-speedSelect")).style.display === 'none' ? 'block' : 'none';
- }
- }
- };
- return btnItem;
- case 'deviceName':
- btnItem.title = "设备名称";
- btnItem.id = btnId;
- btnItem.domString = '<span>设备名称</span>';
- btnItem.onclick = function () {};
- return btnItem;
- case 'deviceID':
- btnItem.title = "设备序列号";
- btnItem.id = btnId;
- btnItem.domString = '<span>设备序列号</span>';
- btnItem.onclick = function () {};
- return btnItem;
- case 'cloudRec':
- btnItem.title = "云存储回放";
- btnItem.id = btnId;
- 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 ");
- btnItem.onclick = function () {
- console.log("点击云回放");
- _this9.setDecoderState({
- type: 'cloud.rec',
- cloudRec: true,
- rec: false
- });
- _this9.jSPlugin.changePlayUrl({
- type: 'cloud.rec'
- }, function () {
- //xuehb changePlayUrl这个方法异步的,要在成功修改URL后再获取回放时间段
- console.log(_this9.jSPlugin);
- var initDate = getQueryString("begin", _this9.jSPlugin.url) || new Date().Format('yyyyMMdd');
- _this9.Rec.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
- //xuehb 重置放大倍数
- var zoom = _this9.decoderState.state.zoom;
- if (zoom) {
- _this9.setDecoderState({
- zoom: false
- });
- _this9.jSPlugin.Zoom.stopZoom();
- }
- });
- console.log(_this9.jSPlugin);
- // var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
- // this.Rec.renderRec(`${initDate.slice(0, 4)}-${initDate.slice(4, 6)}-${initDate.slice(6, 8)}`);
- };
- return btnItem;
- case 'rec':
- btnItem.title = "本地存储";
- btnItem.id = btnId;
- 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 ");
- btnItem.onclick = function () {
- console.log("点击本地回放");
- _this9.setDecoderState({
- type: 'rec',
- cloudRec: false,
- rec: true
- });
- _this9.jSPlugin.changePlayUrl({
- type: 'rec'
- }, function () {
- //xuehb 这个方法异步的,要在成功修改URL后再获取回放时间段
- console.log('---------本地回放');
- console.log(_this9.jSPlugin);
- var initDate = getQueryString("begin", _this9.jSPlugin.url) || new Date().Format('yyyyMMdd');
- _this9.Rec.renderRec("".concat(initDate.slice(0, 4), "-").concat(initDate.slice(4, 6), "-").concat(initDate.slice(6, 8)));
- //xuehb 重置放大倍数
- var zoom = _this9.decoderState.state.zoom;
- if (zoom) {
- _this9.setDecoderState({
- zoom: false
- });
- _this9.jSPlugin.Zoom.stopZoom();
- }
- });
- console.log(_this9.jSPlugin);
- // var initDate = getQueryString("begin", this.jSPlugin.url) || new Date().Format('yyyyMMdd');
- // this.Rec.renderRec(`${initDate.slice(0, 4)}-${initDate.slice(4, 6)}-${initDate.slice(6, 8)}`);
- };
- return btnItem;
- default:
- return btnItem;
- }
- }
- }, {
- key: "changeRecSpeed",
- value: function changeRecSpeed(speed) {
- var _this10 = this;
- var setLiActive = function setLiActive(index) {
- console.log("setLiActive", index);
- if (!document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect"))) {
- return false;
- }
- document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[0].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[0].className.replace("active", "default");
- document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[1].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[1].className.replace("active", "default");
- document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[2].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[2].className.replace("active", "default");
- document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[3].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[3].className.replace("active", "default");
- document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[index].className = document.getElementById("".concat(_this10.jSPlugin.id, "-speedSelect")).childNodes[index].className.replace("default", "active");
- };
- var speedText = "1";
- switch (speed) {
- case 1:
- setLiActive(2);
- speedText = "倍速";
- break;
- case 2:
- setLiActive(1);
- speedText = "".concat(speed, "\u500D");
- break;
- case 4:
- setLiActive(0);
- speedText = "".concat(speed, "\u500D");
- break;
- case 0.5:
- setLiActive(3);
- speedText = "".concat(speed, "\u500D");
- break;
- default:
- setLiActive(2);
- speedText = "".concat(speed, "\u500D");
- break;
- }
- if (document.getElementById("".concat(this.jSPlugin.id, "-speed-text"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-speed-text")).innerHTML = speedText;
- }
- }
- }, {
- key: "initThemeData",
- value: function initThemeData() {
- var _this11 = this;
- var _this$themeData4 = this.themeData,
- header = _this$themeData4.header,
- footer = _this$themeData4.footer;
- var videoId = this.jSPlugin.id;
- this.header = defaultTheme.header;
- this.footer = defaultTheme.footer;
- this.isNeedRenderHeader = lodash.findIndex(header.btnList, function (v) {
- return v.isrender > 0;
- }) >= 0;
- if (this.isMobile) {
- // 移动端回放,需要判断设备序列号,设备名称
- this.isNeedRenderHeader = lodash.findIndex(header.btnList, function (v) {
- return v.isrender > 0 && v.iconId === "deviceID" || v.isrender > 0 && v.iconId === "deviceName";
- }) >= 0;
- }
- this.isNeedRenderFooter = lodash.findIndex(footer.btnList, function (v) {
- return v.isrender > 0;
- }) >= 0;
- this.isNeedRenderTimeLine = lodash.findIndex(header.btnList, function (v) {
- return v.iconId === 'cloudRec' && v.isrender === 1 || v.iconId === 'rec' && v.isrender === 1;
- }) >= 0 && !this.jSPlugin.disabledTimeLine;
- ["date-switch-container-wrap", "rec-type-container-wrap", "mobile-rec-wrap", "mobile-ez-ptz-container"].forEach(function (item, index) {
- if (document.getElementById(item)) {
- document.getElementById(item).parentElement.removeChild(document.getElementById(item));
- }
- });
- if (this.isNeedRenderHeader) {
- if (!document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
- var headerContainer = document.createElement('div');
- headerContainer.setAttribute('id', "".concat(this.jSPlugin.id, "-headControl"));
- headerContainer.setAttribute('class', 'header-controls');
- 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>");
- var headerStyle = {
- height: this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
- "line-height": this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
- display: "flex",
- "justify-content": "space-between",
- top: 0,
- "z-index": 1,
- background: "#000000",
- color: "#FFFFFF",
- width: "100%"
- };
- headerContainer.style = styleToString(headerStyle);
- document.getElementById("".concat(videoId, "-wrap")).insertBefore(headerContainer, document.getElementById(videoId));
- // 头部预留x像素空间
- var _checkTimer2 = setInterval(function () {
- if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(_checkTimer2);
- // 检测到渲染头部,执行一次reSize
- // this.jSPlugin.reSize(this.jSPlugin.params.width,this.jSPlugin.params.height);
- }
- }, 50);
- } else {
- 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>");
- }
- } else {
- if (document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id, "-headControl")));
- }
- // this.jSPlugin.reSize(this.jSPlugin.params.width,this.jSPlugin.params.height);
- }
- if (this.isNeedRenderFooter) {
- if (!document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
- var footerContainer = document.createElement('div');
- footerContainer.setAttribute('id', "".concat(this.jSPlugin.id, "-ez-iframe-footer-container"));
- footerContainer.setAttribute('class', 'ez-iframe-footer-container');
- var footerStyle = {
- "min-height": this.jSPlugin.width > MEDIAWIDTH ? "48px" : "32px",
- "max-height": this.jSPlugin.width > MEDIAWIDTH ? "96px" : "80px",
- "position": "relative",
- "margin-top": this.jSPlugin.width > MEDIAWIDTH ? "-48px" : "-32px",
- display: "flex",
- "flex-wrap": "wrap",
- "justify-content": "space-between",
- "z-index": 999,
- top: 0,
- color: "#FFFFFF",
- width: "100%"
- };
- footerContainer.style = styleToString(footerStyle);
- 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>");
- insertAfter$1(footerContainer, document.getElementById(videoId));
- } else {
- if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).style.marginTop = "-".concat(this.jSPlugin.width > MEDIAWIDTH ? 48 : 32, "px");
- 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>");
- }
- }
- } else {
- if (document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id, "-ez-iframe-footer-container")));
- }
- }
- if (this.isNeedRenderHeader && document.getElementById("".concat(this.jSPlugin.id, "-headControl"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.background = header.backgroundColor;
- document.getElementById("".concat(this.jSPlugin.id, "-headControl")).style.color = header.color;
- header.btnList.map(function (item, index) {
- if (item.isrender) {
- _this11.renderHeader(item.iconId, item.part);
- }
- });
- }
- if (this.isNeedRenderFooter && document.getElementById("".concat(this.jSPlugin.id, "-audioControls"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.background = footer.backgroundColor;
- document.getElementById("".concat(this.jSPlugin.id, "-audioControls")).style.color = footer.color;
- footer.btnList.map(function (item, index) {
- if (item.isrender) {
- _this11.renderFooter(item.iconId, item.part);
- }
- });
- }
- if (this.isNeedRenderTimeLine) {
- if (this.isMobile) {
- if (document.getElementById("".concat(this.jSPlugin.id, "-headControl-right"))) {
- document.getElementById("".concat(this.jSPlugin.id, "-headControl-right")).style.display = "none";
- }
- //xuehb changeRecSpeed传入,用来重置播放速度 resetMobileZoomStatus 重置手机放大状态方法
- this.Rec = new MobileRec(this.jSPlugin, this.changeRecSpeed, this.resetMobileZoomStatus);
- } else {
- if (this.Rec) {
- // 如果回放已经定义,只需要初始化渲染
- this.Rec.unSyncTimeLine();
- this.Rec.recInit();
- } else {
- this.jSPlugin.decoderState = this.decoderState;
- this.jSPlugin.setDecoderState = this.setDecoderState;
- this.Rec = new Rec(this.jSPlugin);
- }
- // 回放时间轴预留48像素空间
- var _checkTimer3 = setInterval(function () {
- if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(_checkTimer3);
- // 检测到渲染回放时间轴,执行一次reSize
- // this.jSPlugin.reSize(this.jSPlugin.params.width, this.jSPlugin.params.height);
- }
- }, 50);
- }
- }
- var isNeedRenderPTZ = lodash.findIndex(this.themeData.footer.btnList, function (v) {
- return v.iconId === 'pantile' && v.isrender === 1;
- }) >= 0 && !this.jSPlugin.disabledPTZ;
- if (isNeedRenderPTZ) {
- if (this.isMobile) {
- this.MobilePtz = new MobilePtz(this.jSPlugin);
- }
- this.Ptz = new Ptz(this.jSPlugin);
- }
- // 监听全屏事件触发
- var fullscreenchange = function fullscreenchange() {
- var _this11$decoderState$ = _this11.decoderState.state,
- expend = _this11$decoderState$.expend,
- webExpend = _this11$decoderState$.webExpend;
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (!isFullScreen) {
- _this11.jSPlugin.jSPlugin.JS_Resize(_this11.jSPlugin.width, _this11.jSPlugin.height);
- if (expend) {
- _this11.setDecoderState({
- expend: false
- });
- }
- if (webExpend) {
- _this11.setDecoderState({
- webExpend: false
- });
- }
- }
- if (_this11.jSPlugin.Theme.Rec) {
- _this11.jSPlugin.Theme.Rec.recAutoSize();
- }
- };
- ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
- window.addEventListener(item, function (data) {
- return fullscreenchange();
- });
- });
- // // 判断是否配置封面
- if (this.themeData.poster) {
- this.jSPlugin.poster = this.themeData.poster;
- var checkTimer = setInterval(function () {
- if (window.EZUIKit[_this11.jSPlugin.id].state.EZUIKitPlayer.init) {
- clearInterval(checkTimer);
- _this11.jSPlugin.setPoster(_this11.themeData.poster);
- }
- }, 50);
- }
- this.inited = true;
- //设备信息
- this.getDeviceInfo();
- }
- //xuehb 重置手机端电子放大状态
- }, {
- key: "resetMobileZoomStatus",
- value: function resetMobileZoomStatus() {
- if (this.isMobile) {
- var zoomidDom = document.getElementById("".concat(this.jSPlugin.id, "-zoom-container"));
- if (zoomidDom && zoomidDom.style && zoomidDom.style.display != 'none') {
- console.log('结束电子放大');
- zoomidDom.style.display = "none";
- }
- //xuehb 重置放大倍数
- this.jSPlugin.Zoom.resetZoom();
- }
- }
- }, {
- key: "getDeviceInfo",
- value: function getDeviceInfo() {
- var _this12 = this;
- var deviceAPISuccess = function deviceAPISuccess(data) {
- if (data.code == 200 && data.data) {
- if (data.data.isEncrypt) {
- setTimeout(function () {
- _this12.pluginStatus.loadingClear();
- _this12.pluginStatus.loadingSetText({
- text: "设备已加密",
- color: 'red'
- });
- }, 1500);
- }
- // 设备序列号
- if (document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content"))) {
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.maxWidth = "100%";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.overflow = "hidden";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.textOverflow = "ellipsis";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).style.whiteSpace = "nowrap";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceName-content")).innerHTML = data.data.deviceName;
- }
- // 设备序列号
- if (document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content"))) {
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.maxWidth = "100%";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.overflow = "hidden";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.textOverflow = "ellipsis";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).style.whiteSpace = "nowrap";
- document.getElementById("".concat(_this12.jSPlugin.id, "-deviceID-content")).innerHTML = matchEzopenUrl(_this12.jSPlugin.url).deviceSerial;
- }
- }
- };
- request(this.jSPlugin.env.domain + '/api/lapp/device/info', 'POST', {
- accessToken: this.jSPlugin.accessToken,
- deviceSerial: matchEzopenUrl(this.jSPlugin.url).deviceSerial
- }, '', deviceAPISuccess);
- }
- }, {
- key: "editStart",
- value: function editStart(callback) {
- var audioControlsDOM = document.getElementById("".concat(this.jSPlugin.id, "-audioControls"));
- var headerMessageDOM = document.getElementById("".concat(this.jSPlugin.id, "-headControl"));
- if (headerMessageDOM) {
- headerMessageDOM.setAttribute('class', 'header-controls themeEditing');
- }
- if (audioControlsDOM) {
- audioControlsDOM.setAttribute('class', 'footer-controls themeEditing');
- }
- this.setDecoderState({
- isEditing: true
- });
- }
- }, {
- key: "editEnd",
- value: function editEnd(callback) {
- var audioControlsDOM = document.getElementById("".concat(this.jSPlugin.id, "-audioControls"));
- var headerMessageDOM = document.getElementById("".concat(this.jSPlugin.id, "-headControl"));
- if (headerMessageDOM) {
- headerMessageDOM.setAttribute('class', 'header-controls');
- }
- if (audioControlsDOM) {
- audioControlsDOM.setAttribute('class', 'footer-controls');
- }
- this.setDecoderState({
- isEditing: false
- });
- }
- }, {
- key: "webExpend",
- value: function webExpend() {
- var _this13 = this;
- var _this$decoderState$st2 = this.decoderState.state;
- _this$decoderState$st2.webExpend;
- var expend = _this$decoderState$st2.expend,
- play = _this$decoderState$st2.play;
- if (!play) {
- return false;
- }
- if (expend) {
- console.log("正在全局全屏");
- return false;
- }
- console.log("执行网页全屏");
- var footerDOMHeight = 0;
- var headerDOMHeight = 0;
- // ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach((item) => {
- // window.addEventListener(item, (data) => fullscreenchange("fullscreenchange", data));
- // });
- // // 监听全屏事件触发
- // function fullscreenchange() {
- // let isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- // return isFullScreen;
- // }
- var promise = requestFullScreenPromise(document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
- promise.then(function (data) {
- console.log("全屏promise", window.screen.width);
- if (document.getElementById("".concat(_this13.jSPlugin.id, "-canvas-container"))) {
- footerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this13.jSPlugin.id, "-canvas-container"))).height, 10);
- }
- if (document.getElementById("".concat(_this13.jSPlugin.id, "-headControl"))) {
- headerDOMHeight = parseInt(window.getComputedStyle(document.getElementById("".concat(_this13.jSPlugin.id, "-headControl"))).height, 10);
- }
- console.log("this.jSPlugin.JS_Resiz", footerDOMHeight, headerDOMHeight, document.body.clientWidth);
- _this13.jSPlugin.jSPlugin.JS_Resize(window.screen.width, window.screen.height - footerDOMHeight - headerDOMHeight);
- })["catch"](function (err) {
- console.log(err);
- });
- }
- }, {
- key: "expend",
- value: function expend() {
- var _this14 = this;
- var _this$decoderState$st3 = this.decoderState.state,
- webExpend = _this$decoderState$st3.webExpend;
- _this$decoderState$st3.expend;
- var play = _this$decoderState$st3.play;
- _this$decoderState$st3.pantile;
- if (!play) {
- return false;
- }
- if (webExpend) {
- console.log("正在网站全屏");
- return false;
- }
- console.log("执行全局全屏");
- if (this.isMobile) {
- var heightIntercept = parseInt(getComputedStyle(document.getElementById("".concat(this.jSPlugin.id, "-wrap"))).height, 10) - parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).height, 10);
- requestMobileFullScreen(document.getElementById("".concat(this.jSPlugin.id, "-wrap")));
- setTimeout(function () {
- var width = document.documentElement.clientWidth;
- var height = document.documentElement.clientHeight;
- // 兼容微信浏览器footer被隐藏
- // document.getElementById(`${this.jSPlugin.id}-ez-iframe-footer-container`).style.marginTop = "0px";
- // document.getElementById(`${this.jSPlugin.id}-headControl`).style.position = "absolute";
- document.getElementById("".concat(_this14.jSPlugin.id)).style["backface-visibility"] = "hidden";
- _this14.jSPlugin.jSPlugin.JS_Resize(height, width - heightIntercept);
- }, 100);
- } else {
- var promise = requestFullScreenPromise(document.getElementById("".concat(this.jSPlugin.id)));
- promise.then(function (data) {
- _this14.jSPlugin.jSPlugin.JS_Resize(window.screen.width, window.screen.height);
- })["catch"](function (err) {
- console.log(err);
- });
- }
- }
- }]);
- return Theme;
- }();
- Date.prototype.Format = function (fmt) {
- //author: meizz
- var o = {
- "M+": this.getMonth() + 1,
- //月份
- "d+": this.getDate(),
- //日
- "h+": this.getHours(),
- //小时
- "m+": this.getMinutes(),
- //分
- "s+": this.getSeconds(),
- //秒
- "q+": Math.floor((this.getMonth() + 3) / 3),
- //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
- }
- return fmt;
- };
- var Monitor = /*#__PURE__*/function () {
- function Monitor(params, jsPlugin) {
- _classCallCheck$1(this, Monitor);
- this.params = params;
- this.state = {};
- this.jsPlugin = jsPlugin;
- this.url = "https://log.ys7.com/statistics.do?";
- if (params.env) {
- switch (params.env) {
- case 'test12':
- this.url = "https://test12dclog.ys7.com/statistics.do?";
- break;
- case 'online':
- break;
- default:
- this.url = params.env;
- break;
- }
- }
- }
- /** 生成uuid */
- _createClass$1(Monitor, [{
- key: "uuid",
- value: function uuid() {
- var s = [];
- var hexDigits = "0123456789abcdef";
- for (var i = 0; i < 36; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
- }
- s[14] = "4";
- s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
- s[8] = s[13] = s[18] = s[23] = "-";
- var uuid = s.join("");
- return uuid;
- }
- }, {
- key: "dclog",
- value: function dclog(dclogObj) {
- var imgUrl = this.url;
- var obj = Object.assign({}, {
- systemName: "open_website_monitor"
- }, {
- bn: "ezuikit-js"
- }, dclogObj, {
- un: dclogObj.url
- }, {
- st: new Date().getTime(),
- h: window.location.pathname
- }); // usr_name 更改为un,兼容旧
- Object.keys(obj).forEach(function (item, index) {
- var value = obj[item];
- if (typeof obj[item] === 'string') {
- value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
- }
- if (typeof obj[item] === 'undefined') {
- return;
- }
- imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
- });
- var img = new Image();
- img.src = imgUrl;
- }
- }, {
- key: "localInfoLog",
- value: function localInfoLog(dclogObj) {
- var imgUrl = this.url;
- // var obj = Object.assign({}, { systemName: "open_netstream_localinfo" }, dclogObj, {un:dclogObj.url}, { st: new Date().getTime(), h: window.location.pathname }); // usr_name 更改为un,兼容旧
- var domain = window.location.protocol + '//' + window.location.host;
- var obj = {
- systemName: "open_netstream_localinfo",
- Ver: 'v6.0.0',
- PlatAddr: domain,
- ExterVer: 'v6.0.0',
- OpId: this.uuid(),
- CltType: 102,
- AppId: "",
- playurl: encodeURIComponent(this.jsPlugin.url),
- StartTime: new Date().Format('yyyy-MM-dd hh:mm:ss.S'),
- // 每个日志包含当前的时间
- OS: navigator.platform
- };
- obj = Object.assign(obj, dclogObj);
- Object.keys(obj).forEach(function (item, index) {
- var value = obj[item];
- if (typeof obj[item] === 'string') {
- value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
- }
- if (typeof obj[item] === 'undefined') {
- return;
- }
- imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
- });
- var img = new Image();
- img.src = imgUrl;
- }
- }, {
- key: "playLog",
- value: function playLog(dclogObj) {
- var url = this.url;
- var imgUrl = url;
- var obj = {
- systemName: "open_netstream_play_main",
- playurl: encodeURIComponent(this.jsPlugin.url),
- Time: new Date().Format('yyyy-MM-dd hh:mm:ss.S'),
- //Enc: 0, // 0 不加密 1 加密
- //PlTp: PlTp, // 1 直播 2 回放
- Via: 2,
- // 2 服务端取流
- //ErrCd: 0,
- OpId: this.uuid()
- //Cost: (new Date()).getTime() - _this.initTime, // 毫秒数
- //Serial: getQueryString('dev', item),
- //Channel: getQueryString('chn', item),
- };
- obj = Object.assign(obj, dclogObj);
- Object.keys(obj).forEach(function (item, index) {
- var value = obj[item];
- if (typeof obj[item] === 'string') {
- value = obj[item].replace('%', '%25'); // decodeURIComponent 无法解析%
- }
- if (typeof obj[item] === 'undefined') {
- return;
- }
- imgUrl += "".concat(index === 0 ? '' : '&').concat(item, "=").concat(encodeURIComponent(value));
- });
- var img = new Image();
- img.src = imgUrl;
- }
- }]);
- return Monitor;
- }();
- (function (global, factory) {
- if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
- module.exports = global.document ? factory(global, true) : function (w) {
- if (!w.document) {
- throw new Error("EZUIPlayer requires a window with a document");
- }
- return factory(w);
- };
- } else {
- factory(global);
- } // Pass this if window is not defined yet
- })(typeof window !== "undefined" ? window : void 0, function (window, noGlobal) {
- var _state;
- // 加载js
- function addJs(filepath, callback) {
- var headerScript = document.getElementsByTagName('head')[0].getElementsByTagName("script");
- var isReady = false;
- for (var i = 0; i < headerScript.length; i++) {
- if (headerScript[i].getAttribute("src") == filepath) {
- isReady = true;
- callback();
- }
- }
- if (!isReady) {
- var oJs = document.createElement("script");
- oJs.setAttribute("src", filepath);
- oJs.onload = callback;
- document.getElementsByTagName("head")[0].appendChild(oJs);
- }
- } // 加载css
- function addCss(filepath, callback) {
- var headerLink = document.getElementsByTagName('head')[0].getElementsByTagName("link");
- var isReady = false;
- for (var i = 0; i < headerLink.length; i++) {
- if (headerLink[i].getAttribute("href") == filepath) {
- isReady = true;
- callback();
- }
- }
- if (!isReady) {
- var oJs = document.createElement('link');
- oJs.rel = 'stylesheet';
- oJs.type = 'text/css';
- oJs.href = filepath;
- oJs.onload = callback;
- document.getElementsByTagName("head")[0].appendChild(oJs);
- }
- } // 通用请求方法
- function request(url, method, params, header, success, error) {
- var _url = url;
- var http_request = new XMLHttpRequest();
- http_request.onreadystatechange = function () {
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
- var _data = JSON.parse(http_request.responseText);
- success(_data);
- }
- }
- };
- http_request.open(method, _url, true); // http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- var data = new FormData();
- for (var i in params) {
- data.append(i, params[i]);
- }
- http_request.send(data);
- }
- var EZUIKit = {
- EZUIKitPlayer: undefined,
- EZUIKitTalk: undefined,
- opt: {
- apiDomain: 'https://open.ys7.com/api/lapp/live/talk/url',
- filePath: 'https://open.ys7.com/assets/ezuikit_v2.6.4',
- accessToken: '',
- url: '',
- deviceSerial: '',
- channelNo: '',
- id: '',
- talkLink: '',
- rtcUrl: '',
- ttsUrl: '',
- stream: '',
- // 对讲插件依赖
- isReliesReady: false,
- template: 'simple',
- plugin: [],
- // 加载插件,talk-对讲
- audio: 1,
- // 声音id 0-不开启 1-开启
- autoplay: 1,
- videoLoading: false
- },
- state: (_state = {
- countTimer: undefined,
- // countTime 计时器
- recodeTime: 0,
- // 录音时间
- recodeTimer: undefined
- }, _defineProperty(_state, "recodeTime", 0), _defineProperty(_state, "fetchDefaultList", false), _defineProperty(_state, "page", 0), _defineProperty(_state, "pageSize", 5), _state),
- handleTalkSuccess: function handleTalkSuccess() {},
- handleTalkError: function handleTalkError() {}
- };
- /**
- * 视频播放器-开始
- */
- var domain = "https://open.ys7.com";
- var filePathDomain = domain;
- var EZUIKitPlayer = function EZUIKitPlayer(params) {
- var _this = this;
- this.opt = {
- id: params.id,
- apiDomain: domain + '/api/lapp/live/talk/url',
- filePath: filePathDomain + '/assets/ezuikit_v2.6.4',
- decoderVersion: '',
- accessToken: '',
- url: '',
- deviceSerial: '',
- channelNo: '',
- talkLink: '',
- rtcUrl: '',
- ttsUrl: '',
- stream: '',
- // 对讲插件依赖
- isReliesReady: false,
- template: 'simple',
- plugin: [],
- // 加载插件,talk-对讲
- audio: 1,
- // 声音id 0-不开启 1-开启
- autoplay: 1,
- fullScreenStatus: 0,
- bSupporDoubleClickFull: true,
- videoLoading: false
- };
- this.params = params;
- if (params.id) {
- this.opt.id = params.id;
- }
- if (params.accessToken) {
- this.opt.accessToken = params.accessToken;
- }
- if (typeof params.audio !== 'undefined') {
- this.opt.audio = params.audio;
- }
- if (typeof params.decoderVersion !== 'undefined') {
- this.opt.decoderVersion = params.decoderVersion;
- }
- if (typeof params.env !== 'undefined') {
- if (typeof params.env.domain !== 'undefined') {
- domain = params.env.domain;
- this.opt.apiDomain = domain + '/api/lapp/live/talk/url';
- }
- if (typeof params.env.filePathDomain !== 'undefined') {
- filePathDomain = params.env.filePathDomain;
- this.opt.filePathDomain = params.env.filePathDomain;
- }
- }
- // if(typeof params.domain !== 'undefined'){
- // this.opt.apiDomain = params.domain + '/api/lapp/live/talk/url';
- // }
- if (params.url) {
- this.opt.url = params.url;
- this.opt.deviceSerial = params.url.split("/")[3];
- this.opt.channelNo = params.url.split("/")[4].split(".")[0];
- }
- if (typeof params.template !== 'undefined') {
- this.opt.template = params.template;
- }
- if (params.plugin) {
- this.opt.plugin = params.plugin;
- }
- if (typeof params.autoplay !== 'undefined') {
- this.opt.autoplay = params.autoplay ? 1 : 0;
- }
- if (typeof params.bSupporDoubleClickFull !== 'undefined') {
- this.opt.bSupporDoubleClickFull = params.bSupporDoubleClickFull;
- }
- if (typeof params.handleTalkSuccess !== 'undefined') {
- window.EZUIKit.handleTalkSuccess = params.handleTalkSuccess;
- }
- if (typeof params.handleTalkError !== 'undefined') {
- window.EZUIKit.handleTalkError = params.handleTalkError;
- }
- var id = this.opt.id;
- var domElement = document.getElementById(id); // 间隙
- domElement.style.fontSize = 0;
- domElement.style.overflowY = 'auto';
- domElement.style.position = 'relative';
- /**
- * 渲染iframe视频框
- */
- var iframe = document.createElement('iframe');
- function matchIframeUrl() {
- switch (_this.opt.template) {
- case 'simple':
- 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;
- var controlsValue = "";
- if (typeof params.controls !== 'undefined' && params.controls) {
- console.log("typeof", _typeof(params.controls));
- controlsValue = "play,voice,hd,fullScreen";
- if (params.controls.length > 0) {
- controlsValue = params.controls.join(",");
- iframeUrl += '&controls=' + controlsValue;
- }
- }
- if (params.websocketParams) {
- iframeUrl += '&websocketParams=' + JSON.stringify(params.websocketParams);
- }
- return iframeUrl;
- case 'standard':
- 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;
- case 'security':
- 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;
- case 'theme':
- iframeUrl = domain + "/jssdk/theme.html?url=".concat(params.url, "&accessToken=").concat(params.accessToken, "&id=").concat(id, "&isMobile=").concat(params.isMobile);
- if (typeof params.isMobile !== 'undefined') {
- iframeUrl += '&isMobile=' + params.isMobile;
- }
- if (typeof params.autoplay !== 'undefined') {
- iframeUrl += '&autoplay=' + params.autoplay;
- }
- if (typeof params.domain !== 'undefined') {
- if (params.domain == 'https://test12open.ys7.com') iframeUrl += '&env=' + 'test12';
- }
- if (typeof params.env !== 'undefined') {
- if (typeof params.env.domain !== 'undefined') {
- if (params.env.domain == 'https://test12open.ys7.com') {
- iframeUrl += '&env=' + 'test12';
- }
- }
- }
- if (typeof params.header !== 'undefined') {
- iframeUrl += '&header=' + params.header;
- }
- return iframeUrl;
- default:
- 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;
- }
- }
- iframe.src = matchIframeUrl(); // 默认取容器宽高
- var iframeHeight = document.getElementById(id).offsetHeight;
- var iframeWidth = document.getElementById(id).offsetWidth;
- if (params.height) {
- iframeHeight = parseInt(params.height);
- if (/\%$/.test(params.height)) {
- iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.height) / 100);
- }
- }
- if (params.width) {
- iframeWidth = parseInt(params.width);
- if (/\%$/.test(params.width)) {
- iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.width) / 100);
- }
- }
- iframe.width = iframeWidth;
- iframe.height = iframeHeight;
- iframe.id = 'EZUIKitPlayer-' + id; // 部分iframe属性
- iframe.setAttribute("allowfullscreen", true);
- iframe.setAttribute("allow", "autoplay");
- iframe.setAttribute("frameborder", 0);
- domElement.appendChild(iframe);
- var jqueryJS = _this.opt.filePath + '/js/jquery.js';
- var layerJs = 'https://open.ys7.com/assets/layer/layer.js';
- addJs(jqueryJS, function () {
- addJs(layerJs, function () {
- // });
- // });
- /**
- * 渲染header
- */
- if (matchHeaderOpt().headerContainer) {
- // if (params.header && params.header instanceof Array) {
- var headerContainer = document.createElement('div');
- headerContainer.setAttribute('class', 'panel-top');
- var controsDOM = document.createElement('div');
- controsDOM.setAttribute('class', 'contros');
- headerContainer.appendChild(controsDOM);
- domElement.insertBefore(headerContainer, iframe);
- if (matchHeaderOpt().capturePictureModule) {
- // 截图
- var capturePictureDOM = document.createElement('span');
- 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>';
- capturePictureDOM.onclick = function () {
- _this.capturePicture();
- };
- controsDOM.appendChild(capturePictureDOM);
- }
- console.log("matchHeaderOpt().saveModule", matchHeaderOpt().saveModule);
- if (matchHeaderOpt().saveModule) {
- var startSaveDOM = document.createElement('span');
- 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>';
- startSaveDOM.onclick = function () {
- _this.startSave();
- document.getElementById('startSave').setAttribute('class', 'icon hide');
- document.getElementById('stopSave').setAttribute('class', 'icon');
- };
- controsDOM.appendChild(startSaveDOM);
- var stopSaveDOM = document.createElement('span');
- 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>';
- stopSaveDOM.onclick = function () {
- _this.stopSave();
- document.getElementById('stopSave').setAttribute('class', 'icon hide');
- document.getElementById('startSave').setAttribute('class', 'icon');
- };
- controsDOM.appendChild(stopSaveDOM);
- }
- if (matchHeaderOpt().zoomModule) {
- var enableZoomDOM = document.createElement('span');
- 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>';
- enableZoomDOM.onclick = function () {
- _this.enableZoom();
- document.getElementById('enableZoom').setAttribute('class', 'icon hide');
- document.getElementById('closeZoom').setAttribute('class', 'icon');
- };
- controsDOM.appendChild(enableZoomDOM);
- var closeZoomDOM = document.createElement('span');
- 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>';
- closeZoomDOM.onclick = function () {
- _this.closeZoom();
- document.getElementById('closeZoom').setAttribute('class', 'icon hide');
- document.getElementById('enableZoom').setAttribute('class', 'icon');
- };
- controsDOM.appendChild(closeZoomDOM);
- }
- }
- /**
- * 渲染footer
- */
- /** 根据配置匹配底部渲染 */
- function matchFooterOpt() {
- var result = {
- footerContainer: false,
- talkModule: false,
- broadcastModule: false,
- hdModule: false,
- fullScreenModule: false
- };
- var template = _this.opt.template;
- switch (template) {
- case 'simple':
- if (params.footer && params.footer instanceof Array) {
- var footer = params.footer;
- result = {
- footerContainer: true,
- talkModule: footer.indexOf('talk') !== -1,
- broadcastModule: footer.indexOf('broadcast') !== -1,
- hdModule: footer.indexOf('hd') !== -1,
- fullScreenModule: footer.indexOf('fullScreen') !== -1
- };
- }
- break;
- case 'standard':
- if (params.footer && params.footer instanceof Array) {
- var footer = params.footer;
- result = {
- footerContainer: true,
- talkModule: footer.indexOf('talk') !== -1,
- broadcastModule: footer.indexOf('broadcast') !== -1,
- hdModule: footer.indexOf('hd') !== -1,
- fullScreenModule: footer.indexOf('fullScreen') !== -1
- };
- }
- break;
- case 'security':
- break;
- case 'voice':
- result = {
- footerContainer: true,
- talkModule: true,
- broadcastModule: true,
- hdModule: true,
- fullScreenModule: true
- };
- break;
- }
- return result;
- }
- /** 根据配置匹配底部渲染 */
- function matchHeaderOpt() {
- var result = {
- headerContainer: false,
- capturePictureModule: false,
- saveModule: false,
- zoomModule: false
- };
- var template = _this.opt.template;
- switch (template) {
- case 'simple':
- if (params.header && params.header instanceof Array) {
- var header = params.header;
- result = {
- headerContainer: true,
- capturePictureModule: header.indexOf('capturePicture') !== -1,
- saveModule: header.indexOf('save') !== -1,
- zoomModule: header.indexOf('zoom') !== -1
- };
- }
- break;
- case 'standard':
- break;
- case 'security':
- break;
- case 'voice':
- result = {
- headerContainer: true,
- capturePictureModule: true,
- saveModule: true,
- zoomModule: true
- };
- break;
- }
- return result;
- }
- if (matchFooterOpt().footerContainer || _this.opt.plugin.indexOf('talk') !== -1) {
- var recoderCSS = _this.opt.filePath + '/npm/css/recoder.css';
- var recoderJs = _this.opt.filePath + '/npm/js/recoder.js';
- var recorderJs = _this.opt.filePath + '/recorder.js'; // addCss()
- addCss(recoderCSS, function () {});
- addJs(recoderJs, function () {
- addJs(recorderJs, function () {});
- }); // 对讲模块
- if (_this.opt.plugin.indexOf('talk') !== -1 || matchFooterOpt().talkModule) {
- var apiSuccess = function apiSuccess(data) {
- console.log("data", data);
- if (data.code == 200) {
- var apiResult = data.data;
- if (apiResult) {
- // 临时将https转换为websocket
- var rtcTrunk = apiResult.rtcUrl;
- if (rtcTrunk.indexOf("ws") === -1) {
- rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
- }
- _this.opt.rtcUrl = rtcTrunk;
- _this.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
- var talk = "talk://" + _this.opt.deviceSerial + ":0:" + _this.opt.channelNo + ":cas.ys7.com:6500";
- _this.opt.talkLink = _this.opt.ttsUrl + "/" + talk;
- _this.opt.stream = apiResult.stream;
- console.log("_this.opt", _this.opt); // 加载依赖
- if (!_this.opt.isReliesReady) {
- var adapeterJS = _this.opt.filePath + '/npm/js/adapeter.js';
- var janusJS = _this.opt.filePath + '/npm/js/janus.js';
- var ttsJS = _this.opt.filePath + '/npm/js/tts.js';
- console.log("加载jquery.js");
- addJs(adapeterJS, function () {
- console.log("加载adapeter.js");
- addJs(janusJS, function () {
- console.log("加载janus.js");
- addJs(ttsJS, function () {
- console.log("加载tts.js"); // 文件加载完毕;
- _this.opt.isReliesReady = true;
- });
- });
- }, function () {
- return !!window.adapter;
- });
- } // 创建DOM
- if (!document.getElementById("audioleft")) {
- var audioleft = document.createElement('div');
- audioleft.style.display = 'none';
- audioleft.id = 'audioleft';
- document.body.appendChild(audioleft);
- }
- if (!document.getElementById("audioright")) {
- var audioright = document.createElement('div');
- audioright.style.display = 'none';
- audioright.id = 'audioright';
- document.body.appendChild(audioright);
- }
- }
- }
- EZUIKit.opt = _this.opt;
- if (window.EZUIKit) {
- window.EZUIKit.opt = _this.opt;
- }
- };
- request(_this.opt.apiDomain, 'POST', {
- accessToken: _this.opt.accessToken,
- deviceSerial: _this.opt.deviceSerial,
- channelNo: _this.opt.channelNo
- }, '', apiSuccess);
- }
- if (matchFooterOpt().footerContainer) {
- /* 时间计数 */
- var countTime = function countTime(type, start) {
- clearInterval(EZUIKit.state.countTimer);
- if (type === 'add') {
- var i = start;
- EZUIKit.state.countTimer = setInterval(function () {
- ++i;
- document.getElementById("time-area").innerHTML = formatSeconds(i);
- }, 1000);
- } else if (type === 'sub') {
- var i = start;
- EZUIKit.state.countTimer = setInterval(function () {
- if (i > 0) {
- i--;
- document.getElementById("time-area").innerHTML = formatSeconds(i);
- } else {
- clearInterval(EZUIKit.state.countTimer);
- EZUIKit.state.countTimer = undefined;
- console.log("倒计时结束,开启声音"); // decoder.openSound(0);
- }
- }, 1000);
- } else if (type === 'destory') {
- clearInterval(EZUIKit.state.countTimer);
- EZUIKit.state.countTimer = undefined;
- document.getElementById("time-area").innerHTML = '00:00';
- } //将秒数转换为时分秒格式
- function formatSeconds(value) {
- var theTime = parseInt(value); // 秒
- var middle = 0; // 分
- var hour = 0; // 小时
- var secondV = '00';
- var minV = '00';
- var hourV = '00';
- if (theTime > 59) {
- middle = parseInt(theTime / 60);
- theTime = parseInt(theTime % 60);
- if (middle > 59) {
- hour = parseInt(middle / 60);
- middle = parseInt(middle % 60);
- }
- }
- secondV = parseInt(theTime) > 9 ? parseInt(theTime) : '0' + parseInt(theTime);
- minV = parseInt(middle) > 9 ? parseInt(middle) : '0' + parseInt(middle);
- hourV = parseInt(hour) > 9 ? parseInt(hour) : '0' + parseInt(hour);
- if (hour > 0) {
- return hourV + ':' + minV + ':' + secondV;
- } else if (middle > 0) {
- return minV + ':' + secondV;
- } else {
- return '00:' + secondV;
- }
- }
- };
- // 底部容器
- var footerContainer = document.createElement('div');
- footerContainer.setAttribute("class", 'audio-controls');
- domElement.appendChild(footerContainer);
- if (matchFooterOpt().hdModule || matchFooterOpt().fullScreenModule) {
- // 底部右侧元素
- var rightContros = document.createElement('div');
- rightContros.setAttribute('class', 'contros');
- footerContainer.appendChild(rightContros);
- if (matchFooterOpt().hdModule) {
- // 高清-标清切换
- var hdDom = document.createElement('span');
- hdDom.setAttribute('id', 'video-hd');
- hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
- hdDom.onclick = function () {
- // 停止
- if (_this.opt.videoLoading) {
- layer.msg("视频加载中,请稍后");
- return false;
- } else {
- var stopPromise = _this.stop();
- _this.opt.videoLoading = true;
- stopPromise.then(function (data) {
- _this.opt.videoLoading = false;
- if (_this.opt.url.indexOf('.hd') === -1) {
- _this.opt.url = _this.opt.url.replace('.live', '.hd.live');
- hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
- } else {
- _this.opt.url = _this.opt.url.replace('.hd.live', '.live');
- hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清';
- }
- _this.play(_this.opt.url);
- })["catch"](function (error) {
- console.log("error", error);
- });
- }
- //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;
- };
- rightContros.appendChild(hdDom);
- }
- if (matchFooterOpt().fullScreenModule) {
- // 声音控制
- var openSoundDOM = document.createElement('span');
- openSoundDOM.setAttribute('class', 'hide');
- openSoundDOM.setAttribute('id', 'ezuikit-open-sound');
- openSoundDOM.setAttribute('title', '打开声音');
- openSoundDOM.setAttribute('style', 'vertical-align: top;');
- 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>';
- openSoundDOM.onclick = function () {
- _this.openSound(0);
- openSoundDOM.setAttribute('class', 'hide');
- closeSoundDOM.setAttribute('class', '');
- }; // 声音控制
- var closeSoundDOM = document.createElement('span');
- openSoundDOM.setAttribute('id', 'ezuikit-close-sound');
- closeSoundDOM.setAttribute('class', 'hide');
- closeSoundDOM.setAttribute('title', '关闭声音');
- closeSoundDOM.setAttribute('style', 'vertical-align: top;');
- 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>';
- closeSoundDOM.onclick = function () {
- _this.closeSound(0);
- openSoundDOM.setAttribute('class', '');
- closeSoundDOM.setAttribute('class', 'hide');
- };
- rightContros.appendChild(openSoundDOM);
- rightContros.appendChild(closeSoundDOM);
- } // 根据当前音频配置展示
- if (_this.opt.audio == 1) {
- closeSoundDOM.setAttribute('class', '');
- } else {
- openSoundDOM.setAttribute('class', '');
- _this.closeSound(0);
- }
- if (matchFooterOpt().fullScreenModule) {
- // 全屏控制
- var fullScreenDOM = document.createElement('span');
- fullScreenDOM.setAttribute('title', '全屏');
- fullScreenDOM.setAttribute('style', 'vertical-align: top;');
- 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>';
- fullScreenDOM.onclick = function () {
- _this.fullScreen();
- };
- rightContros.appendChild(fullScreenDOM);
- }
- }
- if (matchFooterOpt().talkModule) {
- // 对讲
- var startTalkDOM = document.createElement('div');
- var stopTalkDOM = document.createElement('div');
- startTalkDOM.setAttribute("class", "ptp-talk off");
- 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>';
- startTalkDOM.onclick = function () {
- console.log("EZUIKit.state.countTimer", EZUIKit.state.countTimer);
- if (EZUIKit.state.countTimer) {
- window.layer.msg("语音设备正忙,请稍后重试");
- return false;
- }
- countTime('add', 0);
- console.log("开始对讲,关闭声音");
- _this.closeSound(0);
- console.log(_this.opt);
- _this.startTalk();
- this.setAttribute("class", "ptp-talk off hide");
- stopTalkDOM.setAttribute("class", "ptp-talk on");
- };
- stopTalkDOM.setAttribute("class", "ptp-talk on hide");
- 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>';
- stopTalkDOM.onclick = function () {
- console.log(_this.opt);
- _this.stopTalk();
- countTime('destory', 0);
- _this.openSound(0);
- this.setAttribute("class", "ptp-talk on hide");
- startTalkDOM.setAttribute("class", "ptp-talk off");
- };
- footerContainer.appendChild(startTalkDOM);
- footerContainer.appendChild(stopTalkDOM);
- }
- if (matchFooterOpt().broadcastModule) {
- var fetchVoiceList = function fetchVoiceList(page) {
- function apiSuccess(data) {
- console.log("data", data);
- if (data.code == 200) {
- randerVoliceList(data.data, 5);
- EZUIKit.state.page = data.page.page; // 如果用户语音列表为空
- if (page == 0 && data.data.length == 0 && !EZUIKit.state.fetchDefaultList) {
- // 获取用户语音为空
- EZUIKit.state.fetchDefaultList = true;
- fetchVoiceList(0);
- }
- }
- }
- request(domain + '/api/lapp/voice/query', 'POST', {
- accessToken: _this.opt.accessToken,
- pageStart: page,
- pageSize: EZUIKit.state.pageSize,
- "default": EZUIKit.state.fetchDefaultList ? 'true' : 'false'
- }, '', apiSuccess);
- };
- var randerVoliceList = function randerVoliceList(data) {
- console.log("renderVoliceList", data);
- if (data && data.length > 0) {
- for (var i = 0; i < data.length; i++) {
- var voiceItem = document.createElement('li');
- 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>";
- 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>";
- // $("#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>");
- voiceItem.onclick = function (e) {
- console.log("点击元素", e.target, e.target.dataset.url);
- var voiceUrl = e.target.dataset.url;
- var time = e.target.dataset.time;
- playListOfVoice(voiceUrl, time);
- };
- }
- if (data.length === EZUIKit.state.pageSize) {
- document.getElementById('voice-list-end').innerHTML = "向下滚动加载更多";
- } else {
- document.getElementById('voice-list-end').innerHTML = "没有更多数据了";
- }
- }
- };
- var playListOfVoice = function playListOfVoice(voiceUrl, time) {
- console.log("播放语音", voiceUrl, time); // decoder && decoder.closeSound(0);
- function apiSuccess(data) {
- console.log("data.data", data.data);
- if (data.code == 200) {
- // $("#startBroadcast").show();
- // $("#stopBroadcast").hide();
- countTime('sub', parseInt(time));
- } else if (data.code == "10001") {
- window.layer.msg("未找到当前语音");
- } else {
- window.layer.msg(data.msg || '发送失败,请稍后再试');
- } // padding = false;
- }
- request(domain + '/api/lapp/voice/send', 'POST', {
- accessToken: _this.opt.accessToken,
- deviceSerial: _this.opt.deviceSerial,
- channelNo: _this.opt.channelNo,
- fileUrl: voiceUrl
- }, '', apiSuccess);
- }; // 自定义语音
- // 对讲
- var startBroadcastDOM = document.createElement('div');
- var stopBroadcastDOM = document.createElement('div');
- startBroadcastDOM.setAttribute("class", 'broadcast off');
- stopBroadcastDOM.setAttribute("class", "broadcast on hide");
- 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>';
- startBroadcastDOM.onclick = function () {
- this.setAttribute("class", "broadcast off hide");
- stopBroadcastDOM.setAttribute("class", "broadcast on");
- };
- 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>'; // //自定义语音唤起
- // document.getElementById("voice-custom").onclick = function(){
- // console.log("显示自定义语音");
- // }
- stopBroadcastDOM.onclick = function () {
- this.setAttribute("class", "broadcast on hide");
- startBroadcastDOM.setAttribute("class", "broadcast off");
- };
- footerContainer.appendChild(startBroadcastDOM);
- footerContainer.appendChild(stopBroadcastDOM); // 召唤自定义语言
- document.getElementById("voice-custom").onclick = function () {
- console.log("显示自定义语音");
- startSpeakDOM.setAttribute('class', 'speak off');
- }; // 获取语音列表
- fetchVoiceList(0);
- var startSpeakDOM = document.createElement('div');
- var stopSpeakDOM = document.createElement('div');
- startSpeakDOM.setAttribute('class', 'speak off hide');
- stopSpeakDOM.setAttribute('class', 'speak on hide');
- startSpeakDOM.setAttribute('id', 'startSpeak');
- stopSpeakDOM.setAttribute('id', 'stopSpeak');
- 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>';
- 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>';
- footerContainer.appendChild(startSpeakDOM);
- footerContainer.appendChild(stopSpeakDOM);
- document.getElementById("voice-list").onscroll = function (e) {
- var sum = this.scrollHeight;
- console.log("sum", sum, this.scrollTop, document.getElementById("voice-list").clientHeight);
- if (sum <= this.scrollTop + this.clientHeight) {
- console.log("拖动到底,执行加载", EZUIKit.state.page);
- fetchVoiceList(++EZUIKit.state.page);
- }
- }; // $("#voice-list").unbind("scroll").bind("scroll", function (e) {
- // // console.log("e",e,this.scrollHeight, $(this).scrollTop() + $(this).height())
- // var sum = this.scrollHeight;
- // if (sum <= $(this).scrollTop() + $(this).height()) {
- // console.log("拖动到底,执行加载", page);
- // fetchVoiceList(++page);
- // }
- // loading = false;
- // });
- // time-area
- var timeAreaDOM = document.createElement('div');
- timeAreaDOM.setAttribute('class', 'time-area');
- timeAreaDOM.setAttribute('id', 'time-area');
- timeAreaDOM.innerHTML = '00:00';
- footerContainer.appendChild(timeAreaDOM); // 按住说话
- var recorder;
- document.getElementById('startSpeak').onmousedown = function () {
- if (EZUIKit.state.countTimer) {
- window.layer.msg("语音设备正忙,请稍后重试");
- return false;
- }
- console.log("按住说话");
- startSpeakDOM.setAttribute('class', 'speak off hide');
- stopSpeakDOM.setAttribute('class', 'speak on'); // console.log("startRecording",startRecording);
- // startRecording();
- voiceInit();
- countTime('add', 0);
- setTimeout(function () {
- EZUIKit.state.recodeTime = 0;
- startRecording();
- }, 1000);
- if (EZUIKit.state.recodeTimer) {
- // 先清空计数器
- clearInterval(EZUIKit.state.recodeTimer);
- }
- EZUIKit.state.recodeTimer = setInterval(function () {
- if (EZUIKit.state.recodeTime >= 59) {
- _this.stopTalk();
- countTime('destory', 0);
- this.setAttribute("class", "ptp-talk on hide");
- startTalkDOM.setAttribute("class", "ptp-talk off");
- window.layer.msg("不超过1分钟");
- } else {
- EZUIKit.state.recodeTime = EZUIKit.state.recodeTime + 1;
- }
- }, 1000);
- /** 录音控制 */
- var audio_context;
- function startUserMedia(stream) {
- var input = audio_context.createMediaStreamSource(stream);
- recorder = new window.Recorder(input);
- }
- function startRecording() {
- recorder && recorder.record();
- }
- function voiceInit() {
- console.log("run init");
- try {
- // webkit shim
- window.AudioContext = window.AudioContext || window.webkitAudioContext;
- navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
- window.URL = window.URL || window.webkitURL;
- audio_context = new AudioContext();
- console.log('Audio context set up.');
- console.log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
- } catch (e) {
- console.log("err", e);
- window.layer.msg('No web audio support in this browser!');
- }
- navigator.getUserMedia({
- audio: true
- }, startUserMedia, function (e) {
- console.log('No live audio input: ' + e);
- });
- }
- }; // 松开发送
- document.getElementById('stopSpeak').onmouseup = function () {
- console.log("松开发送");
- stopSpeakDOM.setAttribute('class', 'speak on hide');
- stopSpeakFun();
- function stopSpeakFun() {
- countTime('destory', 0);
- if (EZUIKit.state.recodeTime < 1) {
- window.layer.msg("说话时间过短");
- clearInterval(EZUIKit.state.recodeTimer);
- return false;
- }
- clearInterval(EZUIKit.state.recodeTimer);
- wavUpload();
- }
- function wavUpload() {
- try {
- recorder && recorder.stop(); // createAudioDom();
- recorder && recorder.exportWAV(function (wav_file) {
- console.log("wav_file", wav_file);
- if (wav_file.size < 1000) {
- window.layer.msg("录音失败,请重试"); // recodeTime = 0;
- EZUIKit.state.recodeTime = 0;
- return false;
- } // 测试
- countTime('sub', EZUIKit.state.recodeTime + 2); // 延时
- var formdata = new FormData(); // form 表单 {key:value}
- formdata.append("voiceFile", wav_file); // form input type="file"
- formdata.append("accessToken", _this.opt.accessToken);
- formdata.append("deviceSerial", _this.opt.deviceSerial);
- formdata.append("channelNo", _this.opt.channelNo); // padding = true;
- function apiSuccess(data) {
- console.log("data.data", data.data);
- if (data.code == 200) {
- // $("#startBroadcast").show();
- // $("#stopBroadcast").hide();
- countTime('sub', EZUIKit.state.recodeTime + 2);
- } else if (data.code == "10001") {
- window.layer.msg("未找到当前语音");
- } else {
- window.layer.msg(data.msg || '发送失败,请稍后再试');
- } // padding = false;
- }
- function apiError(err) {
- console.log("err", err);
- }
- request(domain + '/api/lapp/voice/sendonce', 'POST', {
- voiceFile: wav_file,
- accessToken: _this.opt.accessToken,
- deviceSerial: _this.opt.deviceSerial,
- channelNo: _this.opt.channelNo
- }, '', apiSuccess, apiError);
- });
- recorder && recorder.clear();
- } catch (err) {
- console.log(err);
- }
- }
- };
- }
- }
- }
- });
- });
- // iframe 传递数据
- var _this = this;
- window.addEventListener("message", function (event) {
- event.origin;
- var id = _this.opt.id;
- if (event.data.type) {
- switch (event.data.type) {
- case 'openSound':
- if (id == event.data.id && params.openSoundCallBack) {
- params.openSoundCallBack(event.data);
- }
- break;
- case 'closeSound':
- if (id == event.data.id && params.closeSoundCallBack) {
- params.closeSoundCallBack(event.data);
- }
- break;
- case 'capturePicture':
- if (id == event.data.id && params.capturePictureCallBack) {
- params.capturePictureCallBack(event.data);
- }
- break;
- case 'startSave':
- if (id == event.data.id && params.startSaveCallBack) {
- params.startSaveCallBack(event.data);
- }
- break;
- case 'stopSave':
- if (id == event.data.id && params.stopSaveCallBack) {
- params.stopSaveCallBack(event.data);
- }
- break;
- case 'fullScreen':
- if (id == event.data.id && params.fullScreenCallBack) {
- params.fullScreenCallBack(event.data);
- }
- break;
- case 'getOSDTime':
- if (id == event.data.id && params.getOSDTimeCallBack) {
- params.getOSDTimeCallBack(event.data);
- }
- break;
- case 'handleSuccess':
- if (id == event.data.id && params.handleSuccess) {
- params.handleSuccess(event.data);
- }
- break;
- case 'handleError':
- if (id == event.data.id && params.handleError) {
- params.handleError(event.data);
- }
- break;
- case 'dblclick':
- if (id == event.data.id && _this.opt.bSupporDoubleClickFull) {
- if (_this.opt.fullScreenStatus === 0) {
- _this.fullScreen();
- } else {
- _this.cancelFullScreen();
- }
- }
- break;
- case 'startTalk':
- _this.startTalk();
- // params.startTalk();
- _this.closeSound();
- break;
- case 'stopTalk':
- // window.stopTalk()
- _this.stopTalk();
- _this.openSound();
- break;
- case 'clickEventHandle':
- console.log("event.data", event.data);
- if (params.clickEventHandle) {
- params.clickEventHandle(event.data);
- }
- break;
- case 'removeEventHandle':
- if (params.removeEventHandle) {
- params.removeEventHandle(event.data);
- }
- break;
- case 'esc':
- if (params.clickEventHandle) {
- params.clickEventHandle(event.data);
- }
- break;
- case 'iframeFullScreen':
- if (id == event.data.id) {
- var requestFullScreen = function requestFullScreen(element) {
- var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
- if (requestMethod) {
- requestMethod.call(element);
- } else if (typeof window.ActiveXObject !== "undefined") {
- var wscript = new ActiveXObject("WScript.Shell");
- if (wscript !== null) {
- wscript.SendKeys("{F11}");
- }
- }
- };
- requestFullScreen(document.getElementById("EZUIKitPlayer-" + event.data.id));
- }
- break;
- }
- }
- });
- // 全屏变化回调
- function fullscreenchange(data) {
- _this.opt.fullScreenStatus = data ? 1 : 0;
- if (params.fullScreenChangeCallBack) {
- params.fullScreenChangeCallBack({
- data: data,
- id: _this.opt.id
- });
- }
- }
- if (typeof document.fullScreen !== "undefined") {
- document.addEventListener("fullscreenchange", function () {
- var e = document.fullscreen || false;
- fullscreenchange(e);
- });
- } else if (typeof document.webkitIsFullScreen !== "undefined") {
- document.addEventListener("webkitfullscreenchange", function () {
- var e = document.webkitIsFullScreen || false;
- fullscreenchange(e);
- });
- } else if (typeof document.mozFullScreen !== "undefined") {
- document.addEventListener("mozfullscreenchange", function () {
- var e = document.mozFullScreen || false;
- fullscreenchange(e);
- });
- }
- }; // 播放相关API
- EZUIKitPlayer.prototype.play = function (data) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- if (_typeof(data) === 'object' && data.url) {
- this.opt.url = data.url;
- }
- if (_typeof(data) === 'object' && data.accessToken) {
- this.opt.accessToken = data.accessToken;
- }
- if (typeof data === 'string') {
- this.opt.url = data;
- }
- player.postMessage({
- action: "play",
- accessToken: this.opt.accessToken,
- url: this.opt.url
- }, domain + "/ezopen/h5/iframe");
- var _this = this;
- this.opt.videoLoading = true;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'handleSuccess') {
- setTimeout(function () {
- _this.opt.videoLoading = false;
- }, 1000);
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.stop = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("stop", domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'stop') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.openSound = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("openSound", domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'openSound') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.closeSound = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("closeSound", domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'closeSound') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.startSave = function (fileName) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "startSave",
- fileName: fileName || 'default'
- }, domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'startSave') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.stopSave = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("stopSave", domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'stopSave') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.fullScreen = function () {
- if (this.opt.fullScreenStatus === 1) {
- return false;
- }
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- 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)) {
- // console.log('移动端全屏');
- var width = document.documentElement.clientWidth;
- var height = document.documentElement.clientHeight;
- // wrapper = document.getElementById("test"),
- var wrapper = document.body; //document.body 属性返回 <body> 元素, document.documentElement 属性返回 <html> 元素。
- wrapper = document.getElementById(id);
- var style = "";
- style += "width:" + height + "px;"; // 注意旋转后的宽高切换
- style += "height:" + width + "px;";
- style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
- // 注意旋转中点的处理
- style += "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
- style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
- style += 'position: fixed;top: 0;left: 0;z-index:10';
- wrapper.style.cssText = style;
- // var cancelFullDOM = document.createElement('div');
- // cancelFullDOM.id = id + "cancel-full-screen"
- // var cancelFullDOMStyle="width:30px;height:"+height+"px;z-index:1000;position:fixed;top:0px;right:0px;";
- // cancelFullDOMStyle += "background-image: url(https://resource.ys7cloud.com/group1/M00/00/7E/CtwQE1-01qeAH2wAAAABOliqQ5g167.png);"
- // cancelFullDOMStyle += "background-size: contain;background-repeat:no-repeat;background-color:rgba(0,0,0,0.2)"
- // cancelFullDOM.style = cancelFullDOMStyle;
- // cancelFullDOM.onclick = function(){
- // _this.cancelFullScreen();
- // }
- // document.body.appendChild(cancelFullDOM);
- setTimeout(function () {
- player.postMessage('autoResize', domain + "/ezopen/h5/iframe");
- }, 500);
- } else {
- // console.log('pc端全屏');
- var requestFullScreen = function requestFullScreen(element) {
- var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
- if (requestMethod) {
- requestMethod.call(element);
- } else if (typeof window.ActiveXObject !== "undefined") {
- var wscript = new ActiveXObject("WScript.Shell");
- if (wscript !== null) {
- wscript.SendKeys("{F11}");
- }
- }
- };
- requestFullScreen(document.getElementById(id));
- }
- if (this.params.fullScreenCallBack) {
- this.params.fullScreenCallBack(this.opt.id);
- }
- this.opt.fullScreenStatus = 1;
- };
- EZUIKitPlayer.prototype.cancelFullScreen = function () {
- if (this.opt.fullScreenStatus === 0) {
- return false;
- }
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- 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)) {
- var width = document.getElementById(id).width;
- var height = document.getElementById(id).height;
- // wrapper = document.getElementById("test"),
- var wrapper = document.body; //document.body 属性返回 <body> 元素, document.documentElement 属性返回 <html> 元素。
- wrapper = document.getElementById(id);
- var style = "";
- style += "width:" + width + "px;";
- style += "height:" + height + "px;";
- style += "-webkit-transform: none; transform: none;";
- style += "-webkit-transform-origin: 0 0;";
- style += "transform-origin: 0 0;";
- wrapper.style.cssText = style;
- setTimeout(function () {
- player.postMessage("autoResize", domain + "/ezopen/h5/iframe");
- }, 500);
- var cancelFullDOMId = id + "cancel-full-screen";
- var cancelFullDOM = document.getElementById(cancelFullDOMId);
- if (cancelFullDOM) {
- document.body.removeChild(cancelFullDOM);
- }
- } else {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.webkitCancelFullScreen) {
- document.webkitCancelFullScreen();
- } else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- }
- }
- if (this.params.cancelFullScreenCallBack) {
- this.params.cancelFullScreenCallBack(this.opt.id);
- }
- this.opt.fullScreenStatus = 0;
- };
- EZUIKitPlayer.prototype.capturePicture = function (fileName, isUndownload) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "capturePicture",
- fileName: fileName || 'default',
- isUndownload: isUndownload
- }, domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'capturePicture') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.enableZoom = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("enableZoom", domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.closeZoom = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("closeZoom", domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.getOSDTime = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("getOSDTime", domain + "/ezopen/h5/iframe");
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- window.addEventListener("message", function (event) {
- var playId = _this.opt.id;
- if (playId == event.data.id && event.data.type === 'getOSDTime') {
- resolve(event.data);
- }
- });
- });
- return promise;
- };
- EZUIKitPlayer.prototype.autoResize = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("autoResize", domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.reSize = function (width, height) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- var containerDOM = document.getElementById(this.opt.id);
- containerDOM.style.width = width + 'px';
- containerDOM.style.height = height + 'px';
- document.getElementById(this.opt.id).style.width = width + 'px';
- document.getElementById(this.opt.id).style.height = height + 'px';
- var playDOM = document.getElementById(id);
- playDOM.setAttribute("width", width);
- playDOM.setAttribute("height", height);
- playDOM.style.width = width + 'px';
- playDOM.style.height = height + 'px';
- setTimeout(function () {
- player.postMessage({
- action: 'autoResize'
- }, domain + "/ezopen/h5/iframe");
- }, 500);
- };
- EZUIKitPlayer.prototype.startTalk = function () {
- console.log("执行开始对讲");
- console.log(this.opt);
- var _this = this;
- EZUIKit.opt = this.opt;
- if (window.EZUIKit) {
- window.EZUIKit.opt = this.opt;
- }
- var apiSuccess = function apiSuccess(data) {
- if (data.code == 200) {
- var apiResult = data.data;
- if (apiResult) {
- // 临时将https转换为websocket
- var rtcTrunk = apiResult.rtcUrl;
- if (rtcTrunk.indexOf("ws") === -1) {
- rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws");
- }
- _this.opt.rtcUrl = rtcTrunk;
- _this.opt.ttsUrl = "tts://" + apiResult.ttsUrl;
- var talk = "talk://" + _this.opt.deviceSerial + ":0:" + _this.opt.channelNo + ":cas.ys7.com:6500";
- _this.opt.talkLink = _this.opt.ttsUrl + "/" + talk;
- _this.opt.stream = apiResult.stream;
- window.startTalk();
- }
- }
- };
- request(_this.opt.apiDomain, 'POST', {
- accessToken: _this.opt.accessToken,
- deviceSerial: _this.opt.deviceSerial,
- channelNo: _this.opt.channelNo
- }, '', apiSuccess);
- };
- EZUIKitPlayer.prototype.stopTalk = function () {
- console.log("执行结束对讲");
- window.stopTalk();
- };
- EZUIKitPlayer.prototype.edit = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage("edit", domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.btnReRender = function (data) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "btnReRender",
- data: data
- }, domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.changePlayUrl = function (data) {
- if (data.deviceSerial) {
- this.opt.deviceSerial = data.deviceSerial;
- }
- if (data.channelNo) {
- this.opt.channelNo = data.channelNo;
- }
- if (data.accessToken) {
- this.opt.accessToken = data.accessToken;
- }
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "changePlayUrl",
- data: data
- }, domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.fetchThemeData = function () {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "fetchThemeData"
- }, domain + "/ezopen/h5/iframe");
- };
- EZUIKitPlayer.prototype.setThemeData = function (accessToken, header, footer) {
- var id = 'EZUIKitPlayer-' + this.opt.id;
- var player = document.getElementById(id).contentWindow;
- player.postMessage({
- action: "setThemeData",
- data: {
- accessToken: accessToken,
- header: header,
- footer: footer
- }
- }, domain + "/ezopen/h5/iframe");
- };
- /**
- * 视频播放器-结束
- */
- EZUIKit.EZUIKitPlayer = EZUIKitPlayer;
- window.EZUIKitV3 = EZUIKit;
- var EZUIKitV3 = EZUIKit;
- return EZUIKitV3;
- });
- var EZUIKitV3$1 = EZUIKitV3;
- /* global setTimeout, clearTimeout */
- var dist = function debounce(fn) {
- var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var lastCallAt = void 0;
- var deferred = void 0;
- var timer = void 0;
- var pendingArgs = [];
- return function debounced() {
- var currentWait = getWait(wait);
- var currentTime = new Date().getTime();
- var isCold = !lastCallAt || currentTime - lastCallAt > currentWait;
- lastCallAt = currentTime;
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- if (isCold && options.leading) {
- return options.accumulate ? Promise.resolve(fn.call(this, [args])).then(function (result) {
- return result[0];
- }) : Promise.resolve(fn.call.apply(fn, [this].concat(args)));
- }
- if (deferred) {
- clearTimeout(timer);
- } else {
- deferred = defer();
- }
- pendingArgs.push(args);
- timer = setTimeout(flush.bind(this), currentWait);
- if (options.accumulate) {
- var argsIndex = pendingArgs.length - 1;
- return deferred.promise.then(function (results) {
- return results[argsIndex];
- });
- }
- return deferred.promise;
- };
- function flush() {
- var thisDeferred = deferred;
- clearTimeout(timer);
- Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);
- pendingArgs = [];
- deferred = null;
- }
- };
- function getWait(wait) {
- return typeof wait === 'function' ? wait() : wait;
- }
- function defer() {
- var deferred = {};
- deferred.promise = new Promise(function (resolve, reject) {
- deferred.resolve = resolve;
- deferred.reject = reject;
- });
- return deferred;
- }
- (function () {
- var h;
- function l(a) {
- var b = 0;
- return function () {
- return b < a.length ? {
- done: !1,
- value: a[b++]
- } : {
- done: !0
- };
- };
- }
- var m = "function" == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
- if (a == Array.prototype || a == Object.prototype) return a;
- a[b] = c.value;
- return a;
- };
- function n(a) {
- a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof commonjsGlobal && commonjsGlobal];
- for (var b = 0; b < a.length; ++b) {
- var c = a[b];
- if (c && c.Math == Math) return c;
- }
- throw Error("Cannot find global object");
- }
- var q = n(this);
- function r(a, b) {
- if (b) a: {
- var c = q;
- a = a.split(".");
- for (var d = 0; d < a.length - 1; d++) {
- var e = a[d];
- if (!(e in c)) break a;
- c = c[e];
- }
- a = a[a.length - 1];
- d = c[a];
- b = b(d);
- b != d && null != b && m(c, a, {
- configurable: !0,
- writable: !0,
- value: b
- });
- }
- }
- r("Symbol", function (a) {
- function b(f) {
- if (this instanceof b) throw new TypeError("Symbol is not a constructor");
- return new c(d + (f || "") + "_" + e++, f);
- }
- function c(f, g) {
- this.A = f;
- m(this, "description", {
- configurable: !0,
- writable: !0,
- value: g
- });
- }
- if (a) return a;
- c.prototype.toString = function () {
- return this.A;
- };
- var d = "jscomp_symbol_" + (1E9 * Math.random() >>> 0) + "_",
- e = 0;
- return b;
- });
- r("Symbol.iterator", function (a) {
- if (a) return a;
- a = Symbol("Symbol.iterator");
- for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), c = 0; c < b.length; c++) {
- var d = q[b[c]];
- "function" === typeof d && "function" != typeof d.prototype[a] && m(d.prototype, a, {
- configurable: !0,
- writable: !0,
- value: function () {
- return u(l(this));
- }
- });
- }
- return a;
- });
- function u(a) {
- a = {
- next: a
- };
- a[Symbol.iterator] = function () {
- return this;
- };
- return a;
- }
- function v(a) {
- var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
- return b ? b.call(a) : {
- next: l(a)
- };
- }
- var w;
- if ("function" == typeof Object.setPrototypeOf) w = Object.setPrototypeOf;else {
- var y;
- a: {
- var z = {
- a: !0
- },
- A = {};
- try {
- A.__proto__ = z;
- y = A.a;
- break a;
- } catch (a) {}
- y = !1;
- }
- w = y ? function (a, b) {
- a.__proto__ = b;
- if (a.__proto__ !== b) throw new TypeError(a + " is not extensible");
- return a;
- } : null;
- }
- var B = w;
- function C() {
- this.m = !1;
- this.j = null;
- this.v = void 0;
- this.h = 1;
- this.u = this.C = 0;
- this.l = null;
- }
- function D(a) {
- if (a.m) throw new TypeError("Generator is already running");
- a.m = !0;
- }
- C.prototype.o = function (a) {
- this.v = a;
- };
- C.prototype.s = function (a) {
- this.l = {
- D: a,
- F: !0
- };
- this.h = this.C || this.u;
- };
- C.prototype.return = function (a) {
- this.l = {
- return: a
- };
- this.h = this.u;
- };
- function E(a, b) {
- a.h = 3;
- return {
- value: b
- };
- }
- function F(a) {
- this.g = new C();
- this.G = a;
- }
- F.prototype.o = function (a) {
- D(this.g);
- if (this.g.j) return G(this, this.g.j.next, a, this.g.o);
- this.g.o(a);
- return H(this);
- };
- function I(a, b) {
- D(a.g);
- var c = a.g.j;
- if (c) return G(a, "return" in c ? c["return"] : function (d) {
- return {
- value: d,
- done: !0
- };
- }, b, a.g.return);
- a.g.return(b);
- return H(a);
- }
- F.prototype.s = function (a) {
- D(this.g);
- if (this.g.j) return G(this, this.g.j["throw"], a, this.g.o);
- this.g.s(a);
- return H(this);
- };
- function G(a, b, c, d) {
- try {
- var e = b.call(a.g.j, c);
- if (!(e instanceof Object)) throw new TypeError("Iterator result " + e + " is not an object");
- if (!e.done) return a.g.m = !1, e;
- var f = e.value;
- } catch (g) {
- return a.g.j = null, a.g.s(g), H(a);
- }
- a.g.j = null;
- d.call(a.g, f);
- return H(a);
- }
- function H(a) {
- for (; a.g.h;) try {
- var b = a.G(a.g);
- if (b) return a.g.m = !1, {
- value: b.value,
- done: !1
- };
- } catch (c) {
- a.g.v = void 0, a.g.s(c);
- }
- a.g.m = !1;
- if (a.g.l) {
- b = a.g.l;
- a.g.l = null;
- if (b.F) throw b.D;
- return {
- value: b.return,
- done: !0
- };
- }
- return {
- value: void 0,
- done: !0
- };
- }
- function J(a) {
- this.next = function (b) {
- return a.o(b);
- };
- this.throw = function (b) {
- return a.s(b);
- };
- this.return = function (b) {
- return I(a, b);
- };
- this[Symbol.iterator] = function () {
- return this;
- };
- }
- function K(a, b) {
- b = new J(new F(b));
- B && a.prototype && B(b, a.prototype);
- return b;
- }
- function L(a, b) {
- a instanceof String && (a += "");
- var c = 0,
- d = !1,
- e = {
- next: function () {
- if (!d && c < a.length) {
- var f = c++;
- return {
- value: b(f, a[f]),
- done: !1
- };
- }
- d = !0;
- return {
- done: !0,
- value: void 0
- };
- }
- };
- e[Symbol.iterator] = function () {
- return e;
- };
- return e;
- }
- r("Array.prototype.entries", function (a) {
- return a ? a : function () {
- return L(this, function (b, c) {
- return [b, c];
- });
- };
- });
- if ("undefined" !== typeof Blob && ("undefined" === typeof FormData || !FormData.prototype.keys)) {
- var M = function (a, b) {
- for (var c = 0; c < a.length; c++) b(a[c]);
- },
- N = function (a) {
- return a.replace(/\r?\n|\r/g, "\r\n");
- },
- O = function (a, b, c) {
- if (b instanceof Blob) {
- c = void 0 !== c ? String(c + "") : "string" === typeof b.name ? b.name : "blob";
- if (b.name !== c || "[object Blob]" === Object.prototype.toString.call(b)) b = new File([b], c);
- return [String(a), b];
- }
- return [String(a), String(b)];
- },
- P = function (a, b) {
- if (a.length < b) throw new TypeError(b + " argument required, but only " + a.length + " present.");
- },
- Q = "object" === typeof globalThis ? globalThis : "object" === typeof window ? window : "object" === typeof self ? self : this,
- R = Q.FormData,
- S = Q.XMLHttpRequest && Q.XMLHttpRequest.prototype.send,
- T = Q.Request && Q.fetch,
- U = Q.navigator && Q.navigator.sendBeacon,
- V = Q.Element && Q.Element.prototype,
- W = Q.Symbol && Symbol.toStringTag;
- W && (Blob.prototype[W] || (Blob.prototype[W] = "Blob"), "File" in Q && !File.prototype[W] && (File.prototype[W] = "File"));
- try {
- new File([], "");
- } catch (a) {
- Q.File = function (b, c, d) {
- b = new Blob(b, d || {});
- Object.defineProperties(b, {
- name: {
- value: c
- },
- lastModified: {
- value: +(d && void 0 !== d.lastModified ? new Date(d.lastModified) : new Date())
- },
- toString: {
- value: function () {
- return "[object File]";
- }
- }
- });
- W && Object.defineProperty(b, W, {
- value: "File"
- });
- return b;
- };
- }
- var escape = function (a) {
- return a.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
- },
- X = function (a) {
- this.i = [];
- var b = this;
- a && M(a.elements, function (c) {
- if (c.name && !c.disabled && "submit" !== c.type && "button" !== c.type && !c.matches("form fieldset[disabled] *")) if ("file" === c.type) {
- var d = c.files && c.files.length ? c.files : [new File([], "", {
- type: "application/octet-stream"
- })];
- M(d, function (e) {
- b.append(c.name, e);
- });
- } else "select-multiple" === c.type || "select-one" === c.type ? M(c.options, function (e) {
- !e.disabled && e.selected && b.append(c.name, e.value);
- }) : "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));
- });
- };
- h = X.prototype;
- h.append = function (a, b, c) {
- P(arguments, 2);
- this.i.push(O(a, b, c));
- };
- h.delete = function (a) {
- P(arguments, 1);
- var b = [];
- a = String(a);
- M(this.i, function (c) {
- c[0] !== a && b.push(c);
- });
- this.i = b;
- };
- h.entries = function b() {
- var c,
- d = this;
- return K(b, function (e) {
- 1 == e.h && (c = 0);
- if (3 != e.h) return c < d.i.length ? e = E(e, d.i[c]) : (e.h = 0, e = void 0), e;
- c++;
- e.h = 2;
- });
- };
- h.forEach = function (b, c) {
- P(arguments, 1);
- for (var d = v(this), e = d.next(); !e.done; e = d.next()) {
- var f = v(e.value);
- e = f.next().value;
- f = f.next().value;
- b.call(c, f, e, this);
- }
- };
- h.get = function (b) {
- P(arguments, 1);
- var c = this.i;
- b = String(b);
- for (var d = 0; d < c.length; d++) if (c[d][0] === b) return c[d][1];
- return null;
- };
- h.getAll = function (b) {
- P(arguments, 1);
- var c = [];
- b = String(b);
- M(this.i, function (d) {
- d[0] === b && c.push(d[1]);
- });
- return c;
- };
- h.has = function (b) {
- P(arguments, 1);
- b = String(b);
- for (var c = 0; c < this.i.length; c++) if (this.i[c][0] === b) return !0;
- return !1;
- };
- h.keys = function c() {
- var d = this,
- e,
- f,
- g,
- k,
- p;
- return K(c, function (t) {
- 1 == t.h && (e = v(d), f = e.next());
- if (3 != t.h) {
- if (f.done) {
- t.h = 0;
- return;
- }
- g = f.value;
- k = v(g);
- p = k.next().value;
- return E(t, p);
- }
- f = e.next();
- t.h = 2;
- });
- };
- h.set = function (c, d, e) {
- P(arguments, 2);
- c = String(c);
- var f = [],
- g = O(c, d, e),
- k = !0;
- M(this.i, function (p) {
- p[0] === c ? k && (k = !f.push(g)) : f.push(p);
- });
- k && f.push(g);
- this.i = f;
- };
- h.values = function d() {
- var e = this,
- f,
- g,
- k,
- p,
- t;
- return K(d, function (x) {
- 1 == x.h && (f = v(e), g = f.next());
- if (3 != x.h) {
- if (g.done) {
- x.h = 0;
- return;
- }
- k = g.value;
- p = v(k);
- p.next();
- t = p.next().value;
- return E(x, t);
- }
- g = f.next();
- x.h = 2;
- });
- };
- X.prototype._asNative = function () {
- for (var d = new R(), e = v(this), f = e.next(); !f.done; f = e.next()) {
- var g = v(f.value);
- f = g.next().value;
- g = g.next().value;
- d.append(f, g);
- }
- return d;
- };
- X.prototype._blob = function () {
- var d = "----formdata-polyfill-" + Math.random(),
- e = [],
- f = "--" + d + '\r\nContent-Disposition: form-data; name="';
- this.forEach(function (g, k) {
- 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");
- });
- e.push("--" + d + "--");
- return new Blob(e, {
- type: "multipart/form-data; boundary=" + d
- });
- };
- X.prototype[Symbol.iterator] = function () {
- return this.entries();
- };
- X.prototype.toString = function () {
- return "[object FormData]";
- };
- V && !V.matches && (V.matches = V.matchesSelector || V.mozMatchesSelector || V.msMatchesSelector || V.oMatchesSelector || V.webkitMatchesSelector || function (d) {
- d = (this.document || this.ownerDocument).querySelectorAll(d);
- for (var e = d.length; 0 <= --e && d.item(e) !== this;);
- return -1 < e;
- });
- W && (X.prototype[W] = "FormData");
- if (S) {
- var Y = Q.XMLHttpRequest.prototype.setRequestHeader;
- Q.XMLHttpRequest.prototype.setRequestHeader = function (d, e) {
- Y.call(this, d, e);
- "content-type" === d.toLowerCase() && (this.B = !0);
- };
- Q.XMLHttpRequest.prototype.send = function (d) {
- d instanceof X ? (d = d._blob(), this.B || this.setRequestHeader("Content-Type", d.type), S.call(this, d)) : S.call(this, d);
- };
- }
- T && (Q.fetch = function (d, e) {
- e && e.body && e.body instanceof X && (e.body = e.body._blob());
- return T.call(this, d, e);
- });
- U && (Q.navigator.sendBeacon = function (d, e) {
- e instanceof X && (e = e._asNative());
- return U.call(this, d, e);
- });
- Q.FormData = X;
- }
- })();
- /**
- * Created by wangweijie5 on 2016/12/16.
- */
- var _createClass = function () {
- function defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var __instance = function () {
- var instance = void 0;
- return function (newInstance) {
- if (newInstance) instance = newInstance;
- return instance;
- };
- }();
- (function () {
- function AudioRenderer() {
- _classCallCheck(this, AudioRenderer);
- if (__instance()) return __instance();
- // 确保只有单例
- if (AudioRenderer.unique !== undefined) {
- return AudioRenderer.unique;
- }
- AudioRenderer.unique = this;
- this.oAudioContext = null;
- this.currentVolume = 80; // 初始音量
- this.bSetVolume = false;
- this.gainNode = null;
- this.iWndNum = -1; // 窗口号
- this.mVolumes = new Map(); // 用于存储所有音量
- // Init AudioContext
- var AudioContext = window.AudioContext || window.webkitAudioContext;
- this.oAudioContext = new AudioContext();
- this.writeString = function (view, offset, string) {
- for (var i = 0; i < string.length; i++) {
- view.setUint8(offset + i, string.charCodeAt(i));
- }
- };
- this.setBufferToDataview = function (output, offset, input) {
- for (var i = 0; i < input.length; i++, offset++) {
- output.setUint8(offset, input[i]);
- }
- };
- __instance(this);
- }
- /**
- * @synopsis 音频播放
- *
- * @param dataBuf [IN] 音频缓存
- * @param dataLen [IN] 缓存长度
- * @param audioInfo [IN] 音频参数
- *
- * @returns 状态码
- */
- _createClass(AudioRenderer, [{
- key: 'Play',
- value: function Play(dataBuf, dataLen, audioInfo) {
- var bufferData = new ArrayBuffer(44 + dataLen);
- var viewTalk = new DataView(bufferData);
- var sampleRates = audioInfo.samplesPerSec;
- var channels = audioInfo.channels;
- var bitsPerSample = audioInfo.bitsPerSample;
- //console.log("audiorender sampleRates"+sampleRates+"channels:"+channels+"bitsPerSample:"+bitsPerSample);
- /* RIFF identifier */
- this.writeString(viewTalk, 0, 'RIFF');
- /* file length */
- viewTalk.setUint32(4, 32 + dataLen * 2, true);
- /* RIFF type */
- this.writeString(viewTalk, 8, 'WAVE');
- /* format chunk identifier */
- this.writeString(viewTalk, 12, 'fmt ');
- /* format chunk length */
- viewTalk.setUint32(16, 16, true);
- /* sample format (raw) */
- viewTalk.setUint16(20, 1, true);
- /* channel count */
- viewTalk.setUint16(22, channels, true);
- /* sample rate */
- viewTalk.setUint32(24, sampleRates, true);
- /* byte rate (sample rate * block align) */
- viewTalk.setUint32(28, sampleRates * 2, true);
- /* block align (channel count * bytes per sample)/8 */
- viewTalk.setUint16(32, channels * bitsPerSample / 8, true);
- /* bits per sample */
- viewTalk.setUint16(34, bitsPerSample, true);
- /* data chunk identifier */
- this.writeString(viewTalk, 36, 'data');
- /* data chunk length */
- viewTalk.setUint32(40, dataLen, true);
- this.setBufferToDataview(viewTalk, 44, dataBuf);
- var self = this;
- this.oAudioContext.decodeAudioData(viewTalk.buffer, function (buffer) {
- var bufferSource = self.oAudioContext.createBufferSource();
- if (bufferSource == null) {
- return -1;
- }
- bufferSource.buffer = buffer;
- bufferSource.start(0);
- if (self.gainNode == null || self.bSetVolume) {
- self.gainNode = self.oAudioContext.createGain();
- // self.gainNode.gain.value = self.currentVolume;
- // // self.currentVolume = self.gainNode.gain.value;
- // self.gainNode.connect(self.oAudioContext.destination);
- self.bSetVolume = false;
- }
- self.gainNode.gain.value = self.currentVolume / 100;
- // self.currentVolume = self.gainNode.gain.value;
- self.gainNode.connect(self.oAudioContext.destination);
- bufferSource.connect(self.gainNode);
- }, function (e) {
- console.log("decode error");
- return -1;
- });
- return 0;
- }
- /**
- * @synopsis 停止播放
- *
- * @returns 返回音量
- */
- }, {
- key: 'Stop',
- value: function Stop() {
- if (this.gainNode != null) {
- this.gainNode.disconnect();
- this.gainNode = null;
- }
- // this.oAudioContext.close();
- // AudioRenderer.unique = undefined;
- // __instance() = null;
- return true;
- }
- /**
- * @synopsis 设置音量
- *
- * @param iVolume [IN] 音量
- *
- * @returns 状态码
- */
- }, {
- key: 'SetVolume',
- value: function SetVolume(iVolume) {
- this.bSetVolume = true;
- this.currentVolume = iVolume;
- // 储存当前窗口设置音量值
- this.mVolumes.set(this.iWndNum, this.currentVolume);
- return true;
- }
- /**
- * @synopsis 设置窗口号
- *
- * @param iWndNum [IN] 窗口号
- *
- * @returns 状态码
- */
- }, {
- key: 'SetWndNum',
- value: function SetWndNum(iWndNum) {
- this.iWndNum = iWndNum;
- // 获取当前窗口设置音量值
- var iVolume = this.mVolumes.get(iWndNum);
- if (iVolume == undefined) {
- iVolume = 80; // 默认音量
- }
- this.currentVolume = iVolume;
- return true;
- }
- /**
- * @synopsis 获取音量
- *
- * @returns 返回音量
- */
- }, {
- key: 'GetVolume',
- value: function GetVolume() {
- // 获取当前窗口设置音量值
- var iVolume = this.mVolumes.get(this.iWndNum);
- if (iVolume == undefined) {
- iVolume = 80; // 默认音量
- }
- return iVolume;
- }
- }]);
- window.AudioRenderer = AudioRenderer;
- return AudioRenderer;
- })();
- //顶点着色器
- //attribute修饰符用于声明由浏览器(javascript)传输给顶点着色器的变量值;
- // vertexPos即我们定义的顶点坐标;
- // gl_Position是一个内建的传出变量。
- var vertexYUVShader = ['attribute vec4 vertexPos;', 'attribute vec2 texturePos;', 'varying vec2 textureCoord;', 'void main()', '{', 'gl_Position = vertexPos;', 'textureCoord = texturePos;', '}'].join('\n');
- //像素着色器(yuv->rgb)
- 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');
- (function (root, factory) {
- // root.SuperRender = factory();
- window.SuperRender = factory();
- })(undefined, function () {
- function RenderManager(canvas) {
- this.canvasElement = document.getElementById(canvas);
- this.initContextGL();
- if (this.contextGL) {
- this.YUVProgram = this.initProgram(vertexYUVShader, fragmentYUVShader);
- this.initBuffers();
- this.initTextures();
- }
- }
- /**
- * 初始化WebGL上下文
- */
- RenderManager.prototype.initContextGL = function () {
- var canvas = this.canvasElement;
- var gl = null;
- try {
- gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
- } catch (e) {
- gl = null;
- }
- if (!gl || typeof gl.getParameter !== "function") {
- gl = null;
- }
- this.contextGL = gl;
- console.log("WebGL1.0");
- };
- /**
- * 初始化着色器程序
- * @param vertexShaderScript 顶点着色器脚本
- * @param fragmentShaderScript 片段着色器脚本
- */
- RenderManager.prototype.initProgram = function (vertexShaderScript, fragmentShaderScript) {
- var gl = this.contextGL;
- var vertexShader = gl.createShader(gl.VERTEX_SHADER); //创建定点着色器
- gl.shaderSource(vertexShader, vertexShaderScript);
- gl.compileShader(vertexShader);
- if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
- console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));
- }
- var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
- gl.shaderSource(fragmentShader, fragmentShaderScript);
- gl.compileShader(fragmentShader);
- if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
- console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));
- }
- var program = gl.createProgram();
- gl.attachShader(program, vertexShader);
- gl.attachShader(program, fragmentShader);
- gl.linkProgram(program);
- if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
- console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));
- }
- gl.deleteShader(vertexShader);
- gl.deleteShader(fragmentShader);
- return program;
- };
- /**
- * 初始化数据缓存
- */
- RenderManager.prototype.initBuffers = function () {
- var gl = this.contextGL;
- var vertexPosBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
- var texturePosBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.DYNAMIC_DRAW);
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
- this.vertexPosBuffer = vertexPosBuffer;
- this.texturePosBuffer = texturePosBuffer;
- };
- /**
- * 创建纹理
- */
- RenderManager.prototype.initTexture = function () {
- var gl = this.contextGL;
- var textureRef = gl.createTexture();
- gl.bindTexture(gl.TEXTURE_2D, textureRef);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
- gl.bindTexture(gl.TEXTURE_2D, null);
- return textureRef;
- };
- /**
- * 初始化YUV纹理
- */
- RenderManager.prototype.initTextures = function () {
- var gl = this.contextGL;
- var program = this.YUVProgram;
- gl.useProgram(program);
- var yTextureRef = this.initTexture();
- var ySamplerRef = gl.getUniformLocation(program, 'ySampler');
- gl.uniform1i(ySamplerRef, 0);
- this.yTextureRef = yTextureRef;
- var uTextureRef = this.initTexture();
- var uSamplerRef = gl.getUniformLocation(program, 'uSampler');
- gl.uniform1i(uSamplerRef, 1);
- this.uTextureRef = uTextureRef;
- var vTextureRef = this.initTexture();
- var vSamplerRef = gl.getUniformLocation(program, 'vSampler');
- gl.uniform1i(vSamplerRef, 2);
- this.vTextureRef = vTextureRef;
- gl.useProgram(null);
- };
- /**
- * 显示帧数据
- * @param nWidth 宽度
- * @param nHeight 高度
- * @param nHeight 帧数据
- */
- RenderManager.prototype.SR_DisplayFrameData = function (nWidth, nHeight, pData, dWidth, dHeight) {
- if (nWidth <= 0 || nHeight <= 0) {
- return;
- }
- var gl = this.contextGL;
- if (null == pData) {
- gl.clearColor(0.0, 0.0, 0.0, 0.0);
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
- return;
- }
- var canvas = this.canvasElement;
- this.nWindowWidth = canvas.width;
- this.nWindowHeight = canvas.height;
- var nWindowWidth = this.nWindowWidth;
- var nWindowHeight = this.nWindowHeight;
- gl.clearColor(0.8, 0.8, 1.0, 1.0);
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
- gl.viewport(0, 0, nWindowWidth, nWindowHeight);
- this.updateFrameData(nWidth, nHeight, pData, dWidth, dHeight);
- var program = this.YUVProgram;
- gl.useProgram(program);
- var vertexPosBuffer = this.vertexPosBuffer;
- gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);
- var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');
- gl.enableVertexAttribArray(vertexPosRef);
- gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
- var texturePosBuffer = this.texturePosBuffer;
- gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
- var texturePosRef = gl.getAttribLocation(program, 'texturePos');
- gl.enableVertexAttribArray(texturePosRef);
- gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
- gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
- gl.disableVertexAttribArray(vertexPosRef);
- gl.disableVertexAttribArray(texturePosRef);
- gl.useProgram(null);
- };
- /**
- * 上传YUV数据到纹理
- * @param nWidth 宽度
- * @param nHeight 高度
- * @param nHeight 帧数据
- */
- RenderManager.prototype.updateFrameData = function (width, height, data, dWidth, dHeight) {
- var gl = this.contextGL;
- var yTextureRef = this.yTextureRef;
- var uTextureRef = this.uTextureRef;
- var vTextureRef = this.vTextureRef;
- var i420Data = data;
- // debugger;
- if (width == dWidth && height == dHeight) {
- var yDataLength = width * height;
- var yData = i420Data.subarray(0, yDataLength);
- gl.activeTexture(gl.TEXTURE0);
- gl.bindTexture(gl.TEXTURE_2D, yTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width, height, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, yData);
- var cbDataLength = width / 2 * height / 2;
- var cbData = i420Data.subarray(width * height, width * height + cbDataLength);
- gl.activeTexture(gl.TEXTURE2);
- gl.bindTexture(gl.TEXTURE_2D, vTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width / 2, height / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, cbData);
- var crDataLength = cbDataLength;
- var crData = i420Data.subarray(width * height + width * height / 4, width * height + width * height / 4 + crDataLength);
- gl.activeTexture(gl.TEXTURE1);
- gl.bindTexture(gl.TEXTURE_2D, uTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, width / 2, height / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, crData);
- } else {
- // //裁剪宽
- var yDataLength = dWidth * dHeight;
- var yData = new Uint8Array(yDataLength);
- for (var i = 0; i < dHeight; i++) {
- //var ySonData=new Uint8Array(dWidth) ;
- var ySonData = i420Data.subarray(i * width, i * width + dWidth);
- for (var j = 0; j < dWidth; j++) {
- yData[i * dWidth + j] = ySonData[j];
- }
- }
- gl.activeTexture(gl.TEXTURE0);
- gl.bindTexture(gl.TEXTURE_2D, yTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth, dHeight, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, yData);
- yData = null;
- ySonData = null;
- var cbDataLength = dWidth / 2 * dHeight / 2;
- var cbData = new Uint8Array(cbDataLength);
- //var cbSonData=new Uint8Array(dWidth/2) ;
- for (var i = 0; i < dHeight / 2; i++) {
- var cbSonData = i420Data.subarray(width * height + i * width / 2, width * height + i * width / 2 + dWidth / 2);
- for (var j = 0; j < dWidth / 2; j++) {
- cbData[i * dWidth / 2 + j] = cbSonData[j];
- }
- }
- gl.activeTexture(gl.TEXTURE2);
- gl.bindTexture(gl.TEXTURE_2D, vTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth / 2, dHeight / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, cbData);
- cbData = null;
- cbSonData = null;
- var crDataLength = cbDataLength;
- var crData = new Uint8Array(crDataLength);
- for (var i = 0; i < dHeight / 2; i++) {
- var crSonData = i420Data.subarray(width * height * 5 / 4 + i * width / 2, width * height * 5 / 4 + i * width / 2 + dWidth / 2);
- for (var j = 0; j < dWidth / 2; j++) {
- crData[i * dWidth / 2 + j] = crSonData[j];
- }
- }
- gl.activeTexture(gl.TEXTURE1);
- gl.bindTexture(gl.TEXTURE_2D, uTextureRef);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, dWidth / 2, dHeight / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, crData);
- crData = null;
- crSonData = null;
- }
- };
- /**
- * 设置显示区域
- * @param stDisplayRect 显示区域
- */
- RenderManager.prototype.SR_SetDisplayRect = function (stDisplayRect) {
- var gl = this.contextGL;
- var nWindowWidth = this.nWindowWidth;
- var nWindowHeight = this.nWindowHeight;
- var texturePosValues = null;
- if (stDisplayRect && nWindowWidth > 0 && nWindowHeight > 0) {
- var fLeft = stDisplayRect.left / nWindowWidth;
- var fTop = stDisplayRect.top / nWindowHeight;
- var fRight = stDisplayRect.right / nWindowWidth;
- var fBottom = stDisplayRect.bottom / nWindowHeight;
- texturePosValues = new Float32Array([fRight, fTop, fLeft, fTop, fRight, fBottom, fLeft, fBottom]);
- } else {
- texturePosValues = new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]);
- }
- var texturePosBuffer = this.texturePosBuffer;
- gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, texturePosValues);
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
- };
- /**
- * 释放显示资源
- */
- RenderManager.prototype.SR_Destroy = function () {
- var gl = this.contextGL;
- var YUVProgram = this.YUVProgram;
- gl.deleteProgram(YUVProgram);
- var vertexPosBuffer = this.vertexPosBuffer;
- var texturePosBuffer = this.texturePosBuffer;
- gl.deleteBuffer(vertexPosBuffer);
- gl.deleteBuffer(texturePosBuffer);
- var yTextureRef = this.yTextureRef;
- var uTextureRef = this.uTextureRef;
- var vTextureRef = this.vTextureRef;
- gl.deleteTexture(yTextureRef);
- gl.deleteTexture(uTextureRef);
- gl.deleteTexture(vTextureRef);
- //gl.getExtension('WEBGL_lose_context').loseContext();
- };
- return RenderManager;
- });
- // 插件资源静态域名
- var uikitStaticDomain = 'https://open.ys7.com';
- // const uikitStaticDomain = 'https://test13open.ys7.com';
- var uikitStaticPathV2 = "".concat(uikitStaticDomain, "/console/ezuikit_static/v66/v2");
- var uikitStaticPathV1 = "".concat(uikitStaticDomain, "/console/ezuikit_static/v66/v1");
- // iframe模板 - 兼容旧版本
- var matchTemplate = function matchTemplate(templateName, params) {
- var IFRAMETEMPLATE = ['theme', 'standard'];
- var LOCALTEMPLATE = ['pcLive', 'pcRec', 'mobileLive', 'mobileRec', 'noData', 'security', 'voice', 'simple'];
- if (typeof templateName === 'undefined') {
- if (params.themeData) {
- return {
- templateType: 'themeData',
- templateId: 'themeData'
- };
- }
- return {
- templateType: 'local',
- templateId: ''
- };
- }
- if (typeof templateName === 'string') {
- if (templateName.length === 32) {
- return {
- templateType: 'remote',
- templateId: templateName
- };
- } else if (IFRAMETEMPLATE.indexOf(templateName) !== -1) {
- // 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
- if (templateName === 'simple' && typeof params.header === 'undefined' && typeof params.footer === 'undefined') {
- return {
- templateType: 'local',
- templateId: ''
- };
- }
- return {
- templateType: 'iframe',
- templateId: templateName
- };
- } else if (LOCALTEMPLATE.indexOf(templateName) !== -1) {
- return {
- templateType: 'local',
- templateId: templateName
- };
- }
- }
- };
- // 是否多进程可用
- var isVersion2Available = function isVersion2Available() {
- var ua = window.navigator.userAgent.toLowerCase(); //获取用户端信息
- var info = {
- sa: /version.*safari/.test(ua),
- //匹配Safari浏览器
- ch: /chrome/.test(ua),
- //匹配Chrome浏览器
- ff: /gecko/.test(ua) && !/webkit/.test(ua) //匹配Firefox浏览器
- };
- var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
- if (isMobile) {
- return false;
- } else if (info.ch) {
- var getChromeVersion = function getChromeVersion() {
- var arr = window.navigator.userAgent.split(' ');
- var chromeVersion = '';
- for (var i = 0; i < arr.length; i++) {
- if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
- }
- if (chromeVersion) {
- return Number(chromeVersion.split('/')[1].split('.')[0]);
- } else {
- return false;
- }
- };
- return getChromeVersion() > 91 && !!window.SharedArrayBuffer;
- }
- return false;
- };
- var EZUIKitPlayer = /*#__PURE__*/function () {
- function EZUIKitPlayer(params) {
- var _this = this;
- _classCallCheck$1(this, EZUIKitPlayer);
- // 解决当ws连接建立但是没有推流导致未触发播放成功事件,
- // 此时切换设备执行 播放器 stop 时触发了播放成功事件导致设备序列号重置
- this.isStoping = false; // 是否在播放前 stop 执行过程中
- var _params$autoplay = params.autoplay,
- autoplay = _params$autoplay === void 0 ? true : _params$autoplay;
- // 如果设置了模板(除精简版),此处不自动播放,根据模板判断是否执行自动播放:
- if (params.template || params.themeData) {
- autoplay = false;
- }
- this.params = params;
- this.autoplay = autoplay;
- window.EZUIKit[params.id] = {
- state: {
- EZUIKitPlayer: {
- init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
- themeInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit || false,
- talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
- }
- }
- };
- if (matchTemplate(this.params.template, params).templateType !== 'iframe') {
- this.Monitor = new Monitor({
- env: !(typeof params.disableMonitor !== 'undefined' && params.disableMonitor) ? 'online' : 'test12'
- }, this);
- this.id = params.id;
- this.width = params.width;
- this.height = params.height;
- this.url = params.url;
- this.accessToken = params.accessToken;
- this.themeId = matchTemplate(params.template, params).templateId;
- this.id = params.id;
- this.audio = true;
- this.poster = params.poster;
- this.speed = 1;
- this.disabledTimeLine = false;
- this.disabledPTZ = false;
- this.enableSharedArrayBufferGuide = false;
- this.capacity = {};
- this.playTimer = null; // 播放定时器,限制至少1秒触发播放
- this.env = {
- domain: "https://open.ys7.com"
- };
- var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
- this.isMobile = isMobile;
- // 兼容多次初始化
- if (document.getElementById("".concat(this.id, "-wrap"))) {
- document.getElementById("".concat(this.id, "-wrap")).innerHTML = "";
- document.getElementById("".concat(this.id, "-wrap")).id = this.id;
- }
- this.staticPath = isVersion2Available() ? uikitStaticPathV2 : uikitStaticPathV1;
- if (typeof params.staticPath === 'string') {
- if (params.staticPath.startsWith("http")) {
- this.staticPath = params.staticPath;
- } else {
- this.staticPath = window.location.protocol + '//' + window.location.host + params.staticPath;
- }
- if (isVersion2Available()) {
- this.staticPath += '/v2';
- } else {
- this.staticPath += '/v1';
- }
- }
- if (typeof params.audio !== 'undefined') {
- this.audio = params.audio;
- }
- if (typeof params.env !== 'undefined') {
- this.env = Object.assign(this.env, params.env);
- }
- if (typeof params.isMobile !== 'undefined') {
- this.isMobile = params.isMobile;
- }
- if (typeof params.disabledTimeLine !== 'undefined') {
- this.disabledTimeLine = params.disabledTimeLine;
- }
- if (typeof params.disabledPTZ !== 'undefined') {
- this.disabledPTZ = params.disabledPTZ;
- }
- if (typeof params.enableSharedArrayBufferGuide !== 'undefined') {
- this.enableSharedArrayBufferGuide = params.enableSharedArrayBufferGuide;
- }
- var pluginUrl = "".concat(this.staticPath, "/js/jsPluginV1-1.0.0.min.js");
- // 执行初始化;
- var doInit = function doInit() {
- window.addPluginUrlIng = true;
- if (isVersion2Available()) {
- console.log("启用多线程解析视频");
- pluginUrl = "".concat(_this.staticPath, "/js/jsPluginV2-2.0.1.min.js");
- } else {
- // 是否引导用户开启谷歌实验室 Google Labs 特性
- //enableSharedArrayBufferGuide
- var getChromeVersion = function getChromeVersion() {
- var arr = navigator.userAgent.split(' ');
- var chromeVersion = '';
- for (var i = 0; i < arr.length; i++) {
- if (/chrome/i.test(arr[i])) {
- chromeVersion = arr[i];
- }
- }
- if (chromeVersion) {
- return Number(chromeVersion.split('/')[1].split('.')[0]);
- }
- return false;
- };
- // pc端 谷歌浏览器 版本 > 91
- if (!isMobile && 91 < getChromeVersion && _this.enableSharedArrayBufferGuide) {
- console.log("提示用户开启谷歌实验室特性");
- var wapDomId = "".concat(_this.id, "-wrap");
- var guideDom = document.createElement("div");
- var guideSpan = document.createElement("span");
- guideSpan.innerHTML = "您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见";
- guideDom.appendChild(guideSpan);
- var guideLink = document.createElement("a");
- guideLink.href = "https://open.ys7.com/help/384";
- guideLink.setAttribute("target", "_blank");
- guideDom.appendChild(guideLink);
- guideLink.innerHTML = "开启说明";
- //guideDom.innerHTML = "您的浏览器当前使用单进程播放视频,可能因内存占用过高导致浏览器卡顿,您可参考·谷歌浏览器开启多线程(链接)·开启谷歌实验室多线程特性,获取更好播放体验";
- guideDom.id = "".concat(_this.id, "-guide");
- guideDom.style = "font-size:12px;color:red;";
- setTimeout(function () {
- if (document.getElementById(wapDomId)) {
- document.getElementById(wapDomId).insertBefore(guideDom, document.getElementById(_this.id));
- }
- }, 5000);
- }
- }
- _this.pluginStatus = new Status(_this, _this.id);
- addJs(pluginUrl, function () {
- if (_this.autoplay) {
- _this.initTime = new Date().getTime();
- _this.Monitor.dclog({
- url: _this.url,
- action: 0,
- text: 'startInit',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- _this.Monitor.localInfoLog({
- Serial: matchEzopenUrl(_this.url).deviceSerial,
- Channel: matchEzopenUrl(_this.url).channelNo,
- Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0",
- ExterVer: isVersion2Available() ? "v7.0.0" : "v6.0.0"
- });
- console.log("初始化-");
- var initEZUIKitPlayerPromise = _this.initEZUIKitPlayer(params);
- var getRealUrlPromise = _this._getRealUrlPromise(params.accessToken, params.url);
- Promise.all([initEZUIKitPlayerPromise, getRealUrlPromise]).then(function (values) {
- if (values[1]) {
- _this.playStartTime = new Date().getTime();
- _this._pluginPlay(values[1], function () {
- console.log("自动播放成功");
- _this.Monitor.dclog({
- url: _this.url,
- action: 202,
- d: new Date().getTime() - _this.initTime,
- text: 'autoPlaySuccess'
- });
- }, function () {
- console.log("自动播放失败");
- _this.Monitor.dclog({
- url: _this.url,
- action: 402,
- d: new Date().getTime() - _this.initTime,
- text: 'autoPlayError'
- });
- });
- } else {
- console.log("promise of one", values);
- }
- window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
- if (document.getElementById("".concat(params.id, "canvas_draw0"))) {
- document.getElementById("".concat(params.id, "canvas_draw0")).style.border = "none";
- }
- })["catch"](function (err) {
- console.log("err", err);
- if (_this.Theme) {
- _this.Theme.setDisabled(true);
- }
- _this.pluginStatus.loadingClear();
- _this.pluginStatus.loadingSetText({
- text: err && err.msg || "获取播放地址失败",
- color: 'red'
- });
- });
- } else {
- _this.initTime = new Date().getTime();
- _this.Monitor.dclog({
- url: _this.url,
- action: 0,
- text: 'startInit',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- _this.Monitor.localInfoLog({
- Serial: matchEzopenUrl(_this.url).deviceSerial,
- Channel: matchEzopenUrl(_this.url).channelNo,
- Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
- });
- var initEZUIKitPlayerPromise = _this.initEZUIKitPlayer(params);
- initEZUIKitPlayerPromise.then(function (data) {
- console.log("初始化成功", data);
- window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
- if (document.getElementById("".concat(params.id, "canvas_draw0"))) {
- document.getElementById("".concat(params.id, "canvas_draw0")).style.border = "none";
- }
- //xuehb 初始化成功 2
- _this.initSuccessTime = new Date().getTime();
- _this.Monitor.dclog({
- url: _this.url,
- action: 201,
- d: _this.initSuccessTime - _this.initTime,
- text: 'initSuccess',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- });
- }
- }, function () {
- if (isVersion2Available()) {
- return !!window.JSPluginV2 || !!window.addPluginUrled;
- }
- return !!window.JSPluginV1 || !!window.addPluginUrled;
- });
- if (params.plugin && params.plugin.indexOf("talk") !== -1) {
- _this.Talk = new Talk(_this);
- window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit = true;
- }
- _this.getDeviceCapacity();
- };
- // 如果浏览器正在加载插件
- if (window.addPluginUrlIng) {
- var doInitTimer = setInterval(function () {
- if (window.JSPluginV1 || window.JSPluginV2) {
- // 判断加载成功
- clearInterval(doInitTimer);
- doInit();
- }
- }, 50);
- } else {
- doInit();
- }
- } else {
- return new EZUIKitV3$1.EZUIKitPlayer(params);
- }
- // this.stop = debouncePromise(()=>this._stop(),0,true);
- this.play = dist(function (options) {
- return _this._play(options);
- }, 500, true);
- this.resume = dist(function (time) {
- return _this._resume(time);
- }, 500, true);
- //xuehb
- this.changePlayUrl = dist(function (options, callback) {
- return _this._changePlayUrl(options, callback);
- }, 500);
- // 监听到页面退出
- // 研究院反馈,播放过程中退出页面需要执行停止视频,否则可能导致浏览器崩溃
- window.addEventListener("beforeunload", function () {
- console.log("退出页面,停止视频流");
- _this.stop();
- });
- }
- _createClass$1(EZUIKitPlayer, [{
- key: "initEZUIKitPlayer",
- value: function initEZUIKitPlayer(params) {
- var _this2 = this;
- var id = params.id,
- _params$width = params.width,
- width = _params$width === void 0 ? 600 : _params$width,
- _params$height = params.height,
- height = _params$height === void 0 ? 400 : _params$height;
- if (!params.width || !params.height) {
- var videoDOMBounding = document.getElementById(id).getBoundingClientRect();
- if (!params.width && videoDOMBounding.width > 0) {
- width = videoDOMBounding.width;
- }
- if (!params.height && videoDOMBounding.height > 0) {
- height = videoDOMBounding.height;
- }
- }
- if (!document.getElementById("".concat(id, "-wrap"))) {
- var wapDom = document.createElement("div");
- wapDom.id = "".concat(id, "-wrap");
- wapDom.style = "display:inline-block;width:".concat(width, "px;position:relative;vertical-align: bottom;");
- document.getElementById(id).parentNode.insertBefore(wapDom, document.getElementById(id));
- document.getElementById(id).parentNode.removeChild(document.getElementById(id));
- // wapDom.appendChild(document.getElementById(id));
- wapDom.innerHTML = "<div id=".concat(id, "></div>");
- document.getElementById(id).style = "display:inline-block;width:".concat(width, "px;height:").concat(height, "px;");
- document.getElementById(id).style.verticalAlign = "top";
- }
- if (this.themeId) {
- this.Theme = new Theme(this, params.id);
- window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
- this.Monitor.dclog({
- url: this.url,
- action: 2,
- text: this.themeId
- });
- if (typeof this.params.handleThemeChange === 'function') {
- this.handleThemeChange = this.params.handleThemeChange;
- }
- }
- // 初始化Message模块
- var pluginMessage = new Message(this, id);
- this.Message = pluginMessage;
- var initDecoder = function initDecoder(resolve, reject) {
- var jSPlugin;
- if (isVersion2Available()) {
- jSPlugin = new window.JSPluginV2({
- szId: id,
- iType: 2,
- iWidth: width,
- iHeight: height,
- iMaxSplit: 1,
- iCurrentSplit: 1,
- szBasePath: "",
- staticPath: _this2.staticPath,
- oStyle: {
- border: "none",
- background: "#000000"
- }
- });
- // 增加视频容器
- //var pluginStatus = new Status(this, id);
- _this2.pluginStatus.loadingStart(id);
- _this2.pluginStatus.loadingSetText({
- text: '初始化播放器完成'
- });
- jSPlugin.EventCallback = {
- pluginErrorHandler: function pluginErrorHandler(iWndIndex, iErrorCode, oError) {
- //插件错误回调
- console.log(iWndIndex, iErrorCode, oError);
- if (iErrorCode === 1003) {
- console.log("断流");
- _this2.Theme.setDecoderState({
- play: false
- });
- _this2.pluginStatus.setPlayStatus({
- play: false
- });
- if (!jSPlugin.bPlay) {
- _this2.pluginStatus.loadingClear();
- _this2.pluginStatus.loadingSetText({
- text: "连接断开,请重试",
- color: 'red'
- });
- }
- if (typeof _this2.params.handleError === 'function') {
- _this2.params.handleError({
- msg: "连接断开,请重试",
- retcode: 1003,
- id: _this2.params.id,
- type: "handleError"
- });
- }
- } else {
- //推流异常时展示响应提示
- if (oError.errorCode != 1) {
- var errorInfo = _this2.errorHander.matchErrorInfo(oError.errorCode);
- var msg = '连接断开,请重试';
- if (errorInfo && errorInfo.msg) {
- msg = errorInfo.msg;
- } else if (errorInfo && errorInfo.description) {
- msg = errorInfo.description;
- }
- _this2.Theme.setDecoderState({
- play: false
- });
- _this2.pluginStatus.setPlayStatus({
- play: false
- });
- _this2.pluginStatus.loadingClear();
- _this2.pluginStatus.loadingSetText({
- text: msg,
- color: 'red'
- });
- } else {
- _this2.pluginStatus.loadingClear();
- if (_this2.Theme) {
- _this2.Theme.setDisabled(false);
- }
- }
- }
- },
- //xuehb 开启取流 4
- openStreamCallback: function openStreamCallback() {
- //开启取流回调 4
- console.log("开启取流");
- _this2.openStreamTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 224,
- d: _this2.openStreamTime - _this2.gotWsUrlTime,
- text: 'openStream',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 完成取流返回流头 5
- getStreamHeaderCallback: function getStreamHeaderCallback() {
- console.log("完成取流返回流头");
- _this2.getStreamHeaderTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 225,
- d: _this2.getStreamHeaderTime - _this2.openStreamTime,
- text: 'getStreamHeader',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 返回视频流 6
- getVideoStreamCallback: function getVideoStreamCallback() {
- console.log("返回视频流(首次)");
- _this2.getVideoStreamTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 226,
- d: _this2.getVideoStreamTime - _this2.getStreamHeaderTime,
- text: 'getVideoStream',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 出现首帧画面(播放成功) 7
- appearFirstFrameCallback: function appearFirstFrameCallback() {
- console.log("出现首帧画面(播放成功)");
- _this2.appearFirstFrameTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 227,
- d: _this2.appearFirstFrameTime - _this2.getStreamHeaderTime,
- text: 'appearFirstFrame',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 平均成功取流的出流耗时 8
- averageStreamSuccessCallback: function averageStreamSuccessCallback() {
- console.log("平均成功取流的出流耗时");
- _this2.averageStreamSuccessTime = _this2.initSuccessTime - _this2.initTime + (_this2.gotWsUrlTime - _this2.startGetWsUrlTime) + (_this2.appearFirstFrameTime - _this2.openStreamTime);
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 228,
- d: _this2.averageStreamSuccessTime,
- text: 'averageStreamSuccess',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- }
- };
- _this2.env = {
- domain: "https://open.ys7.com"
- };
- if (typeof params.env !== 'undefined') {
- _this2.env = Object.assign(_this2.env, params.env);
- }
- if (typeof params.handleTalkSuccess !== 'undefined') {
- _this2.handleTalkSuccess = params.handleTalkSuccess;
- }
- if (typeof params.handleTalkError !== 'undefined') {
- _this2.handleTalkError = params.handleTalkError;
- }
- _this2.errorHander = new Code();
- _this2.jSPlugin = jSPlugin;
- // if (this.themeId) {
- // this.Theme = new Theme(this, id);
- // window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
- // }
- var checkTimer = setInterval(function () {
- //轮询是否加载解码库成功
- if (window.JSPlayerModuleLoaded) {
- clearInterval(checkTimer);
- if (typeof _this2.params.handleInitSuccess === 'function') {
- _this2.params.handleInitSuccess({
- retcode: 0,
- id: _this2.params.id,
- type: "handleInitSuccess"
- });
- }
- resolve({
- meta: {
- retcode: 200,
- msg: "初始化成功"
- }
- });
- if (params.url.indexOf('rec') != -1) {
- //传入rec播放地址时将主题切换至回放
- _this2.Theme.changeTheme(_this2.isMobile ? "mobileRec" : "pcRec");
- }
- }
- }, 50);
- } else {
- jSPlugin = new window.JSPluginV1({
- szId: id,
- iType: 2,
- iWidth: width,
- iHeight: height,
- iMaxSplit: 1,
- iCurrentSplit: 1,
- szBasePath: "",
- staticPath: _this2.staticPath,
- oStyle: {
- border: "none",
- background: "#000000"
- }
- });
- // 增加视频容器
- //var pluginStatus = new Status(this, id);
- _this2.pluginStatus.loadingStart(id);
- _this2.pluginStatus.loadingSetText({
- text: '初始化播放器完成'
- });
- jSPlugin.EventCallback = {
- //xuehb 开启取流 4
- openStreamCallback: function openStreamCallback() {
- console.log("开启取流---v1");
- _this2.openStreamTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 224,
- d: _this2.openStreamTime - _this2.gotWsUrlTime,
- text: 'openStream',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 完成取流返回流头 5
- getStreamHeaderCallback: function getStreamHeaderCallback() {
- console.log("完成取流返回流头");
- _this2.getStreamHeaderTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 225,
- d: _this2.getStreamHeaderTime - _this2.openStreamTime,
- text: 'getStreamHeader',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 返回视频流 6
- getVideoStreamCallback: function getVideoStreamCallback() {
- console.log("返回视频流(首次)");
- _this2.getVideoStreamTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 226,
- d: _this2.getVideoStreamTime - _this2.getStreamHeaderTime,
- text: 'getVideoStream',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 出现首帧画面(播放成功) 7
- appearFirstFrameCallback: function appearFirstFrameCallback() {
- console.log("出现首帧画面(播放成功)");
- _this2.appearFirstFrameTime = new Date().getTime();
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 227,
- d: _this2.appearFirstFrameTime - _this2.getStreamHeaderTime,
- text: 'appearFirstFrame',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- //xuehb 平均成功取流的出流耗时 8
- averageStreamSuccessCallback: function averageStreamSuccessCallback() {
- console.log("平均成功取流的出流耗时");
- _this2.averageStreamSuccessTime = _this2.initSuccessTime - _this2.initTime + (_this2.gotWsUrlTime - _this2.startGetWsUrlTime) + (_this2.appearFirstFrameTime - _this2.openStreamTime);
- _this2.Monitor.dclog({
- url: _this2.url,
- action: 228,
- d: _this2.averageStreamSuccessTime,
- text: 'averageStreamSuccess',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- },
- loadEventHandler: function loadEventHandler() {},
- zoomEventResponse: function zoomEventResponse( /*iMode, aPoint*/
- ) {//电子放大回调
- },
- windowEventSelect: function windowEventSelect(iWndIndex) {//插件选中窗口回调
- },
- pluginErrorHandler: function pluginErrorHandler(iWndIndex, iErrorCode, oError) {
- //插件错误回调
- console.log(iWndIndex, iErrorCode, oError);
- if (iErrorCode === 1003) {
- console.log("断流");
- _this2.Theme.setDecoderState({
- play: false
- });
- _this2.pluginStatus.setPlayStatus({
- play: false
- });
- if (!jSPlugin.bPlay) {
- _this2.pluginStatus.loadingClear();
- _this2.pluginStatus.loadingSetText({
- text: "连接断开,请重试",
- color: 'red'
- });
- }
- if (typeof _this2.params.handleError === 'function') {
- _this2.params.handleError({
- msg: "连接断开,请重试",
- retcode: 1003,
- id: _this2.params.id,
- type: "handleError"
- });
- }
- } else {
- //推流异常时展示响应提示
- if (oError.errorCode != 1) {
- var errorInfo = _this2.errorHander.matchErrorInfo(oError.errorCode);
- var msg = '连接断开,请重试';
- if (errorInfo && errorInfo.msg) {
- msg = errorInfo.msg;
- } else if (errorInfo && errorInfo.description) {
- msg = errorInfo.description;
- }
- _this2.Theme.setDecoderState({
- play: false
- });
- _this2.pluginStatus.setPlayStatus({
- play: false
- });
- _this2.pluginStatus.loadingClear();
- _this2.pluginStatus.loadingSetText({
- text: msg,
- color: 'red'
- });
- } else {
- _this2.pluginStatus.loadingClear();
- if (_this2.Theme) {
- _this2.Theme.setDisabled(false);
- }
- }
- }
- },
- windowEventOver: function windowEventOver(iWndIndex) {},
- windowEventOut: function windowEventOut(iWndIndex) {},
- windowEventUp: function windowEventUp(iWndIndex) {},
- windowFullCcreenChange: function windowFullCcreenChange(bFull) {},
- firstFrameDisplay: function firstFrameDisplay(iWndIndex, iWidth, iHeight) {
- console.log(iWidth, iHeight);
- jSPlugin.JS_SetCanFullScreen(false);
- // this.pluginStatus.loadingClear();
- },
- performanceLack: function performanceLack() {},
- mouseEvent: function mouseEvent(iMouseEventType, iMouseX, iMouseY) {}
- };
- _this2.env = {
- domain: "https://open.ys7.com"
- };
- if (typeof params.env !== 'undefined') {
- _this2.env = Object.assign(_this2.env, params.env);
- }
- if (typeof params.handleTalkSuccess !== 'undefined') {
- _this2.handleTalkSuccess = params.handleTalkSuccess;
- }
- if (typeof params.handleTalkError !== 'undefined') {
- _this2.handleTalkError = params.handleTalkError;
- }
- _this2.errorHander = new Code();
- _this2.jSPlugin = jSPlugin;
- // if (this.themeId) {
- // this.Theme = new Theme(this, id);
- // window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
- // }
- // 待需要改造plugin,异步判断;
- if (typeof _this2.params.handleInitSuccess === 'function') {
- _this2.params.handleInitSuccess({
- retcode: 0,
- id: _this2.params.id,
- type: "handleInitSuccess"
- });
- }
- resolve({
- meta: {
- retcode: 200,
- msg: "初始化成功"
- }
- });
- if (params.url.indexOf('rec') != -1) {
- //传入rec播放地址时将主题切换至回放
- _this2.Theme.changeTheme(_this2.isMobile ? "mobileRec" : "pcRec");
- }
- }
- };
- var initDecoderPromise = new Promise(initDecoder);
- return initDecoderPromise;
- }
- }, {
- key: "_getRealUrlPromise",
- value: function _getRealUrlPromise(accessToken, url) {
- var _this3 = this;
- console.log("\u83B7\u53D6\u64AD\u653E\u5730\u5740 url => ".concat(url, " ").concat(this.accessToken));
- console.log('开始获取wsurl');
- //xuehb 开始获取wsurl
- this.startGetWsUrlTime = new Date().getTime();
- this.Monitor.dclog({
- url: this.url,
- action: 222,
- text: 'startGetWsUrl',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- var apiDomain = this.env.domain;
- if (this.env) {
- apiDomain = this.env.domain;
- }
- var getRealUrlPromise = function getRealUrlPromise(resolve, reject) {
- var realUrl = '';
- var apiUrl = apiDomain + "/api/lapp/live/url/ezopen";
- var data = new FormData();
- data.append("ezopen", url);
- data.append("isFlv", false);
- data.append("userAgent", window.navigator.userAgent);
- data.append("isHttp", false);
- data.append("accessToken", accessToken);
- fetch(apiUrl, {
- method: "POST",
- // headers: {
- // 'Content-Type': 'application/json'
- // },
- body: data
- }).then(function (response) {
- return response.json();
- }).then(function (data) {
- if (data.code == 200 || data.retcode == 0) {
- var playUrl = "";
- var stream = "";
- if (data.ext && data.ext.token) {
- realUrl += data.data;
- stream = data.ext.token;
- playUrl = data.data;
- } else if (data.data && data.data.token) {
- realUrl += data.data.url;
- stream = data.data.token;
- playUrl = data.data.url;
- }
- var type = url.indexOf('live') !== -1 ? 'live' : 'playback';
- if (type === 'live') {
- realUrl = realUrl + '&ssn=' + stream + '&auth=1&biz=4&cln=100';
- } else {
- realUrl = realUrl + '&ssn=' + stream + '&auth=1&cln=100';
- }
- console.log(realUrl);
- // 设置秘钥 - 如果地址中包含秘钥参数,播放前配置到JSPlugin对应实例中
- var validateCode = getQueryString('checkCode', realUrl);
- if (validateCode) {
- if (typeof _this3.jSPlugin.decoderVersion !== 'undefined' && _this3.jSPlugin.decoderVersion === '2.0') {
- _this3.validateCode = validateCode;
- } else {
- console.log("设置密钥", validateCode);
- _this3.jSPlugin.JS_SetSecretKey(0, validateCode);
- }
- }
- // 回放处理
- if (realUrl.indexOf('playback') !== -1) {
- var wsBegin = getQueryString('begin', playUrl) || getQueryString('begin', url);
- var wsEnd = getQueryString('end', playUrl) || getQueryString('end', url);
- // 兼容各种时间格式
- if (!wsBegin) {
- var defaultDate = new Date();
- realUrl = realUrl + '&begin=' + defaultDate.Format('yyyyMMdd') + 'T000000Z';
- } else {
- realUrl = realUrl.replace('&begin=' + getQueryString('begin', playUrl), '&begin=' + formatRecTime(wsBegin, '000000'));
- if (!getQueryString('begin', realUrl)) {
- realUrl += '&begin=' + formatRecTime(wsBegin, '000000');
- }
- }
- if (!wsEnd) {
- realUrl = realUrl + '&end=' + formatRecTime(getQueryString('begin', realUrl).substr(0, 8), '235959');
- } else {
- realUrl = realUrl.replace('&end=' + getQueryString('end', playUrl), '&end=' + formatRecTime(wsEnd, '235959'));
- if (!getQueryString('end', realUrl)) {
- realUrl += '&end=' + formatRecTime(wsEnd, '235959');
- }
- }
- // api错误处理
- if (!getQueryString('stream', playUrl)) {
- realUrl = realUrl.replace('stream', '&stream');
- }
- if (url.indexOf('.cloud') !== -1) {
- var recAPISuccess = function recAPISuccess(data) {
- if (data.code == 200) {
- var recSliceArr = [];
- if (data.data && data.data.files && data.data.files.length > 0) {
- var dataArr = data.data.files;
- var nextFileTime = new Date().getTime();
- var isAll = data.data.isAll;
- // mock
- // var number = 0;
- //isAll = false;
- if (isAll) {
- recSliceArr = recSliceArrFun(dataArr);
- var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
- realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
- resolve(realUrl);
- } else {
- // 云存储回调事务
- var recTransaction = function recTransaction() {
- function recAPIV2Success(data) {
- if (data.data && data.data.files && data.data.files.length > 0) {
- //if(number < 2 ) {
- if (data.data.isAll == false) {
- if (data.data.files) {
- dataArr = dataArr.concat(data.data.files);
- }
- nextFileTime = data.data.nextFileTime > 0 ? data.data.nextFileTime : new Date().getTime();
- recTransaction();
- } else {
- recSliceArr = recSliceArrFun(dataArr);
- var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
- realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
- resolve(realUrl);
- }
- // mock
- //number = number + 1;
- } else {
- recSliceArr = recSliceArrFun(dataArr);
- var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
- realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '') + '&r=' + Math.random();
- resolve(realUrl);
- }
- }
- recSliceParams.startTime = nextFileTime;
- request(recSliceUrl, 'POST', recSliceParams, '', recAPIV2Success);
- };
- recTransaction();
- }
- } else {
- reject({
- retcode: -1,
- msg: "未找到录像片段"
- });
- }
- } else {
- reject({
- retcode: -1,
- msg: "未找到录像片段"
- });
- }
- function recSliceArrFun(data) {
- var downloadPathArr = [];
- data.forEach(function (item, index) {
- if (downloadPathArr.length == 0 || item.downloadPath !== downloadPathArr[downloadPathArr.length - 1].downloadPath) {
- downloadPathArr.push({
- downloadPath: item.downloadPath,
- ownerId: item.ownerId,
- iStorageVersion: item.iStorageVersion,
- videoType: item.videoType,
- iPlaySpeed: 0,
- startTime: item.startTime,
- endTime: item.endTime
- });
- } else {
- downloadPathArr[downloadPathArr.length - 1].endTime = item.endTime;
- }
- });
- return downloadPathArr;
- }
- };
- //云存储回放
- // 调用回放API接口获取回放片段 - start
- var recBegin = reRormatRecTime(getQueryString('begin', realUrl));
- var recEnd = reRormatRecTime(getQueryString('end', realUrl));
- var deviceSerial = getQueryString('serial', realUrl);
- var channelNo = getQueryString('chn', realUrl);
- var recSliceUrl = apiDomain + "/api/lapp/video/by/time";
- var recSliceParams = {
- accessToken: _this3.accessToken,
- recType: 1,
- deviceSerial: deviceSerial,
- channelNo: channelNo,
- startTime: recBegin,
- endTime: recEnd,
- version: '2.0'
- };
- request(recSliceUrl, 'POST', recSliceParams, '', recAPISuccess);
- } else {
- // 本地回放
- //alarm rec - start
- if (url.indexOf('alarmId') !== -1) {
- var _recAPISuccess = function _recAPISuccess(data) {
- if (data.code == 200) {
- var recSliceArr = [];
- if (data.data) {
- recSliceArr = recSliceArrFun([data.data]);
- var recSliceArrJSON = JSON.stringify(recSliceArr).replace('\\', '');
- realUrl += '&recSlice=' + recSliceArrJSON.replace('\\', '');
- console.log("realUrl", realUrl, data.data.recType);
- if (data.data.recType == 1) {
- realUrl = realUrl.replace('/playback', '/cloudplayback');
- } else {
- realUrl = realUrl.replace('/cloudplayback', '/playback');
- }
- // _this.opt.sources[0] = realUrl;
- resolve(realUrl);
- // request(nodeUrl, 'GET', '', '', nodeSuccess, nodeError);
- }
- }
- function recSliceArrFun(data) {
- var downloadPathArr = [];
- data.forEach(function (item, index) {
- if (downloadPathArr.length == 0 || item.downloadPath !== downloadPathArr[downloadPathArr.length - 1].downloadPath) {
- downloadPathArr.push({
- downloadPath: item.downloadPath,
- ownerId: item.ownerId,
- iStorageVersion: item.iStorageVersion,
- videoType: item.videoType,
- iPlaySpeed: 0,
- startTime: item.startTime,
- endTime: item.endTime
- });
- } else {
- downloadPathArr[downloadPathArr.length - 1].endTime = item.endTime;
- }
- });
- console.log("downloadPathArr", downloadPathArr);
- return downloadPathArr;
- }
- };
- console.log("进入alarmId回放");
- // 调用回放API接口获取回放片段 - start
- var alarmId = getQueryString('alarmId', realUrl);
- var recBegin = reRormatRecTime(getQueryString('begin', realUrl));
- var recEnd = reRormatRecTime(getQueryString('end', realUrl));
- var deviceSerial = getQueryString('serial', realUrl);
- var channelNo = getQueryString('chn', realUrl);
- var recSliceUrl = apiDomain + "/api/lapp/video/by/id";
- var recSliceParams = {
- accessToken: _this3.accessToken,
- // recType: 1,
- deviceSerial: deviceSerial,
- channelNo: channelNo,
- alarmId: alarmId
- // startTime:recBegin,
- // endTime:recEnd
- };
- request(recSliceUrl, 'POST', recSliceParams, '', _recAPISuccess);
- } else {
- // arlar rec - end
- // request(nodeUrl, 'GET', '', '', nodeSuccess, nodeError);
- resolve(realUrl);
- }
- }
- } else {
- resolve(realUrl);
- }
- } else {
- if (_this3.Theme) {
- _this3.Theme.setDisabled(true);
- }
- _this3.pluginStatus.loadingClear();
- _this3.pluginStatus.loadingSetText({
- text: data.msg,
- color: 'red'
- });
- if (typeof _this3.params.handleError === 'function') {
- _this3.params.handleError({
- retcode: data.code,
- msg: data.msg,
- id: _this3.params.id,
- type: "handleError"
- });
- }
- reject(data);
- }
- // fetch real url end
- });
- };
- return new Promise(function (resolve, reject) {
- return getRealUrlPromise(resolve, reject);
- });
- // 格式化回放时间
- function formatRecTime(time, defaultTime) {
- // 用户格式 无需更改 => 20182626T000000Z
- // return time
- // 用户格式需要更改
- //用户时间长度为 14 20181226000000 =》 20181226000000
- // 用户长度为12 201812260000 =》 201812260000 + defaultTime后面2位
- // 用户长度为10 2018122600 =》 201812260000 + defaultTime后面4位
- // 用户长度为8 20181226 =》 201812260000 + defaultTime后面6位
- // 结果 20181226000000 14位
- // 插入 TZ
- var reg = /^[0-9]{8}T[0-9]{6}Z$/;
- if (reg.test(time)) {
- // 用户格式 无需更改 => 20182626T000000Z
- return time;
- } else if (/[0-9]{8,14}/.test(time)) {
- var start = 6 - (14 - time.length);
- var end = defaultTime.length;
- var standardTime = time + defaultTime.substring(start, end);
- return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
- }
- throw new Error('回放时间格式有误,请确认');
- }
- function reRormatRecTime(time) {
- var year = time.slice(0, 4);
- var month = time.slice(4, 6);
- var day = time.slice(6, 8);
- var hour = time.slice(9, 11);
- var minute = time.slice(11, 13);
- var second = time.slice(13, 15);
- var date = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
- // if (_this.opt.domain !== 'open') {
- // return new Date(date.replace(/-/g, '/')).getTime() + (8 * 60 * 60 * 1000);
- // }
- return new Date(date.replace(/-/g, '/')).getTime();
- }
- }
- }, {
- key: "_pluginPlay",
- value: function _pluginPlay(data, successCallback, errorCallback) {
- var _this4 = this;
- console.log("执行播放 _pluginPlay", data);
- if (!data) {
- return false;
- }
- function getPlayParams(url) {
- var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
- var websocketStreamingParam = (url.indexOf('/live') === -1 ? url.indexOf('cloudplayback') !== -1 ? '/cloudplayback?' : '/playback?' : '/live?') + url.split('?')[1];
- if (websocketStreamingParam.indexOf('/playback') !== -1) {
- websocketStreamingParam = websocketStreamingParam.replace("stream=2", 'stream=1');
- }
- // 本地回放仅支持主码流
- return {
- websocketConnectUrl: websocketConnectUrl,
- websocketStreamingParam: websocketStreamingParam
- };
- }
- var wsUrl = getPlayParams(data).websocketConnectUrl;
- if (this.env && this.env.wsUrl) {
- wsUrl = this.env.wsUrl;
- }
- //xuehb todo 完成获取URL 3
- this.gotWsUrlTime = new Date().getTime();
- this.Monitor.dclog({
- url: this.url,
- action: 223,
- d: this.gotWsUrlTime - this.startGetWsUrlTime,
- text: 'getWsUrlSuccess',
- isVersion2Available: isVersion2Available() ? 1 : 0
- });
- var wsParams = {
- playURL: getPlayParams(data).websocketStreamingParam
- };
- console.log('播放前 stop 阶段 结束');
- this.isStoping = false;
- var now = Date.now();
- console.log('执行播放 ... this.jSPlugin.JS_Play at ', now);
- this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(function () {
- console.log("执行播放 ... this.jSPlugin.JS_Play 播放成功", wsUrl, wsParams);
- console.log("执行播放耗时 ", Date.now() - now);
- if (_this4.isStoping) {
- console.log('现在在播放前 stop 阶段,此次应为无效播放成功触发。不执行后续回调, 此次耗时无效');
- return;
- }
- if (_this4.validateCode && typeof _this4.jSPlugin.decoderVersion !== 'undefined' && _this4.jSPlugin.decoderVersion === '2.0') {
- _this4.jSPlugin.JS_SetSecretKey(0, _this4.validateCode);
- }
- _this4.pluginStatus.loadingClear();
- _this4.pluginStatus.setPlayStatus({
- play: true,
- loading: false
- });
- if (_this4.Theme) {
- _this4.Theme.setDecoderState({
- play: true
- });
- var isOpenSound = lodash.findIndex(_this4.Theme.themeData.footer.btnList, function (v) {
- return v.iconId === 'sound' && v.isrender === 1 && v.defaultActive === 1;
- }) > -1;
- _this4.audio = isOpenSound;
- }
- if (_this4.audio) {
- setTimeout(function () {
- _this4.openSound();
- }, 500);
- }
- if (typeof _this4.params.handleSuccess === 'function') {
- _this4.params.handleSuccess({
- retcode: 0,
- id: _this4.params.id,
- type: "handleSuccess"
- });
- }
- successCallback(wsParams);
- _this4.Monitor.dclog({
- url: _this4.url,
- action: 211,
- d: new Date().getTime() - _this4.playStartTime,
- text: 'startPlaySuccess'
- });
- _this4.Monitor.playLog({
- Enc: _this4.url.indexOf("@") === -1 ? 0 : 1,
- // 0 不加密 1 加密
- PlTp: _this4.url.indexOf("back") === -1 ? 1 : 2,
- // 1 直播 2 回放
- Via: 2,
- // 2 服务端取流
- ErrCd: 0,
- Cost: new Date().getTime() - _this4.playStartTime,
- // 毫秒数
- Serial: matchEzopenUrl(_this4.url).deviceSerial,
- Channel: matchEzopenUrl(_this4.url).channelNo,
- Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
- });
- }, function (err) {
- console.log("err", err);
- var msg = '播放失败,请检查设备及客户端网络';
- var retcode = -1;
- if (_this4.jSPlugin.bPlay) {
- return false;
- }
- if (err && err.errorCode) {
- var errorInfo = _this4.errorHander.matchErrorInfo(err.errorCode);
- if (_this4.Theme) {
- _this4.Theme.setDisabled(true);
- }
- if (errorInfo && errorInfo.msg) {
- msg = errorInfo.msg;
- } else if (errorInfo && errorInfo.description) {
- msg = errorInfo.description;
- } else {
- msg = '播放失败,请检查设备及客户端网络';
- }
- retcode = err.errorCode;
- }
- _this4.pluginStatus.loadingClear();
- _this4.pluginStatus.loadingSetText({
- text: msg,
- color: 'red'
- });
- if (typeof _this4.params.handleError === 'function') {
- _this4.params.handleError({
- retcode: retcode,
- msg: msg,
- id: _this4.params.id,
- type: "handleError"
- });
- }
- errorCallback();
- _this4.Monitor.dclog({
- url: _this4.url,
- action: 411,
- d: new Date().getTime() - _this4.playStartTime,
- text: 'startPlayError'
- });
- _this4.Monitor.playLog({
- Enc: _this4.url.indexOf("@") === -1 ? 0 : 1,
- // 0 不加密 1 加密
- PlTp: _this4.url.indexOf("back") === -1 ? 1 : 2,
- // 1 直播 2 回放
- Via: 2,
- // 2 服务端取流
- ErrCd: retcode,
- Cost: -1,
- // 毫秒数
- Serial: matchEzopenUrl(_this4.url).deviceSerial,
- Channel: matchEzopenUrl(_this4.url).channelNo,
- Ver: isVersion2Available() ? "v7.0.0" : "v6.0.0"
- });
- });
- }
- }, {
- key: "_play",
- value: function _play(options) {
- var _this5 = this;
- console.log("\u6267\u884C\u64AD\u653E play options.url =>", options);
- this.pluginStatus.setPlayStatus({
- play: false,
- loading: true
- });
- this.playStartTime = new Date().getTime();
- this.Monitor.dclog({
- url: this.url,
- action: 1,
- d: new Date().getTime() - this.initTime,
- text: 'startPlay'
- });
- if (options) {
- if (typeof options === 'string') {
- this.url = options;
- }
- if (typeof options.url === 'string') {
- this.url = options.url;
- }
- if (typeof options.accessToken === 'string') {
- this.accessToken = options.accessToken;
- }
- if (this.Theme && (typeof options.url === 'string' || typeof options.accessToken === 'string')) {
- this.Theme.getDeviceInfo();
- }
- }
- var promise = new Promise(function (resolve, reject) {
- console.log('执行 播放前 stop');
- _this5.isStoping = true;
- _this5.jSPlugin.JS_Stop(0).then(function () {
- console.log("\u64AD\u653E\u524D stop \u6267\u884C\u6210\u529F this.url => ".concat(_this5.url, " ").concat(_this5.accessToken));
- _this5._getRealUrlPromise(_this5.accessToken, _this5.url).then(function (data) {
- _this5._pluginPlay(data, function (params) {
- // if (params.playURL.indexOf('playback') != -1) {
- // //传入rec播放地址时将主题切换至回放
- // this.Theme.changeTheme(this.isMobile ? "mobileRec" :"pcRec");
- // }
- resolve(true);
- }, function () {
- return reject(false);
- });
- })["catch"](function (err) {
- var msg = err.msg ? err.msg : '播放失败,请检查设备及客户端网络';
- if (_this5.Theme) {
- _this5.Theme.setDisabled(true);
- }
- _this5.pluginStatus.loadingClear();
- _this5.pluginStatus.loadingSetText({
- text: msg,
- color: 'red'
- });
- if (typeof _this5.params.handleError === 'function') {
- _this5.params.handleError({
- retcode: err.oError ? err.oError.errorCode : -1,
- msg: msg,
- id: _this5.params.id,
- type: "handleError"
- });
- }
- reject({
- retcode: err.oError ? err.oError.errorCode : -1,
- msg: msg,
- id: _this5.params.id,
- type: "handleError"
- });
- });
- });
- });
- return promise;
- }
- }, {
- key: "stop",
- value: function stop() {
- var _this6 = this;
- this.pluginStatus.setPlayStatus({
- loading: true
- });
- this.reSetTheme();
- return this.jSPlugin.JS_Stop(0).then(function () {
- console.log("停止成功");
- _this6.pluginStatus.setPlayStatus({
- play: false,
- loading: false
- });
- if (_this6.Theme) {
- _this6.Theme.setDecoderState({
- play: false
- });
- }
- });
- }
- }, {
- key: "changeVideoLevel",
- value: function changeVideoLevel(level) {
- var _this7 = this;
- var initUrl = this.url;
- var url = level ? initUrl.replace(".live", ".hd.live") : initUrl.replace(".hd.live", ".live");
- this.jSPlugin.playURL = level ? this.jSPlugin.playURL.replace("stream=2", "stream=1") : this.jSPlugin.playURL.replace("stream=1", "stream=2");
- console.log("changeVideoLevel", url, this.jSPlugin.playURL);
- this.url = url;
- var promise = new Promise(function (resolve, reject) {
- _this7.pause().then(function () {
- console.log("暂停成功");
- _this7.resume().then(function (data) {
- console.log("恢复成功");
- });
- })["catch"](function () {
- console.log("暂停失败");
- _this7.resume().then(function (data) {
- console.log("恢复成功");
- });
- });
- });
- return promise;
- }
- }, {
- key: "reSetTheme",
- value: function reSetTheme() {
- // 云台初始化
- if (this.Theme && this.Theme.Ptz) {
- this.Theme.setDecoderState({
- pantile: false
- });
- this.Theme.Ptz.hide();
- }
- // 录制初始化
- if (this.Theme) {
- if (this.Theme.decoderState.state.recordvideo) {
- this.Theme.setDecoderState({
- recordvideo: false
- });
- }
- }
- // 电子放大初始化
- if (this.Theme && this.Theme.decoderState.state.zoom) {
- this.Zoom.stopZoom();
- this.Theme.setDecoderState({
- zoom: false
- });
- }
- // 对讲初始化
- if (this.Theme && this.Theme.decoderState.state.talk) {
- this.stopTalk();
- this.Theme.setDecoderState({
- talk: false
- });
- }
- // 回放日期选择
- if (this.Theme && this.Theme.Rec && !this.Theme.isMobile) {
- this.Theme.Rec.datepickerHide();
- }
- // 回放倍速
- if (this.Theme && this.Theme.Rec) {
- this.Theme.changeRecSpeed(1);
- this.Theme.nextRate = 1;
- this.speed = 1;
- this.Theme.setDecoderState({
- speed: false
- });
- }
- }
- //xuehb 添加回调
- }, {
- key: "_changePlayUrl",
- value: function _changePlayUrl(options) {
- var _this8 = this;
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
- console.log('_changePlayUrl');
- console.log(options);
- this.reSetTheme();
- this.getDeviceCapacity({
- accessToken: options.accessToken,
- deviceSerial: options.deviceSerial
- });
- var initUrl = this.url;
- var url = matchUrl(initUrl, options);
- if (options.accessToken) {
- this.accessToken = options.accessToken;
- }
- this.url = url;
- //xuehb
- callback();
- this.pluginStatus.loadingStart(this.id);
- this.pluginStatus.loadingSetText({
- text: '加载中,请稍后'
- });
- var promise = new Promise(function (resolve, reject) {
- var changePlayUrlParams = {
- url: url
- };
- if (options.accessToken) {
- changePlayUrlParams["accessToken"] = options.accessToken;
- }
- console.log("切换播放地址 参数 ", changePlayUrlParams);
- return _this8.play(changePlayUrlParams).then(function () {
- console.log("切换播放地址 play 执行成功 ", _this8.url, _this8.accessToken);
- // 当前处于网页全屏状态
- if (_this8.Theme && _this8.Theme.decoderState.state.webExpend) {
- _this8.Theme.webExpend();
- }
- // 当前处于全屏状态
- if (_this8.Theme && _this8.Theme.decoderState.state.expend) {
- _this8.Theme.expend();
- }
- if (options.type) {
- if (options.type == 'rec' || options.type == 'cloud.rec') {
- _this8.Theme.changeTheme(_this8.isMobile ? "mobileRec" : "pcRec");
- } else {
- _this8.Theme.changeTheme(_this8.isMobile ? "mobileLive" : "pcLive");
- }
- } else {
- if (_this8.url.indexOf('.rec') > -1) {
- _this8.Theme.changeTheme(_this8.isMobile ? "mobileRec" : "pcRec");
- } else {
- _this8.Theme.changeTheme(_this8.isMobile ? "mobileLive" : "pcLive");
- }
- }
- if (options && options.begin && options.deviceSerial) {
- _this8.Theme.Rec.setDatepickerDate(options.begin);
- }
- _this8.Theme.setDisabled(false);
- resolve(url);
- })["catch"](function (err) {
- reject(url);
- if (err && err.msg) {
- if (_this8.Theme) {
- _this8.Theme.setDisabled(true);
- }
- _this8.pluginStatus.loadingClear();
- _this8.pluginStatus.loadingSetText({
- text: err.msg,
- color: 'red'
- });
- }
- });
- });
- /**
- * 匹配播放地址 用户播放地址切换
- * options
- * type | string | live,rec
- * hd | boolean | true,false
- * deviceSerial
- * channelNO
- * begin
- * end
- */
- function matchUrl(matchInitUrl, matchOptions) {
- if (matchOptions.url) {
- return matchOptions.url;
- }
- console.log('--------------matchInitUrl', matchInitUrl);
- var type = matchInitUrl.split("/")[4].split(".")[matchInitUrl.split("/")[4].split(".").length - 1].split("?")[0];
- if (type === 'rec' && matchInitUrl.indexOf(".cloud.rec") !== -1) {
- type = 'cloud.rec';
- }
- if (matchOptions.type) {
- type = matchOptions.type;
- }
- var deviceSerial = matchInitUrl.split("/")[3];
- if (matchOptions.deviceSerial) {
- deviceSerial = matchOptions.deviceSerial;
- }
- var channelNo = matchInitUrl.split("/")[4].split(".")[0];
- if (matchOptions.channelNo) {
- channelNo = matchOptions.channelNo;
- }
- // 如果切换设备,之前设备有验证码,新设备无验证码,建议传空验证码,清理验证码(降低解码消耗)
- var validCode = matchInitUrl.split("/")[2].split("@").length === 2 ? matchInitUrl.split("/")[2].split("@")[0] : "";
- if (typeof matchOptions.validCode !== 'undefined') {
- validCode = matchOptions.validCode;
- }
- var hd = typeof matchOptions.hd === 'undefined' ? matchInitUrl.indexOf('.hd') !== -1 : matchOptions.hd;
- var result = "ezopen://".concat(validCode ? "".concat(validCode, "@") : "", "open.ys7.com/").concat(deviceSerial, "/").concat(channelNo).concat(hd ? '.hd' : '', ".").concat(type);
- if (type === 'live') {
- return result;
- }
- result = "ezopen://".concat(validCode ? "".concat(validCode, "@") : "", "open.ys7.com/").concat(deviceSerial, "/").concat(channelNo, ".").concat(type);
- if (matchOptions.begin && matchOptions.end) {
- result += "?begin=".concat(matchOptions.begin, "&end=").concat(matchOptions.end);
- } else if (matchOptions.begin) {
- result += "?begin=".concat(matchOptions.begin);
- } else if (getQueryString("begin", matchInitUrl)) {
- result += "?begin=".concat(getQueryString("begin", matchInitUrl));
- }
- return result;
- }
- return promise;
- }
- }, {
- key: "getOSDTime",
- value: function getOSDTime() {
- var _this9 = this;
- var promise = new Promise(function (resolve, reject) {
- _this9.jSPlugin.JS_GetOSDTime(0).then(function (data) {
- resolve({
- code: 0,
- retcode: 0,
- data: data
- });
- // 兼容旧版本callback
- if (typeof _this9.params.getOSDTimeCallBack === 'function') {
- _this9.params.getOSDTimeCallBack({
- id: _this9.id,
- type: 'getOSDTime',
- code: 0,
- data: data
- });
- }
- })["catch"](function (err) {
- reject({
- code: -1,
- retcode: -1,
- data: err
- });
- // 兼容旧版本callback
- if (typeof _this9.params.getOSDTimeCallBack === 'function') {
- _this9.params.getOSDTimeCallBack({
- id: _this9.id,
- type: 'getOSDTime',
- code: -1,
- data: -1
- });
- }
- });
- });
- return promise;
- }
- }, {
- key: "capturePicture",
- value: function capturePicture(name) {
- var _this10 = this;
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var capturePictureRT = this.jSPlugin.JS_CapturePicture(0, name, "JPEG", callback, !!callback);
- if (isPromise(capturePictureRT)) {
- // 兼容旧版本callback
- if (typeof this.params.capturePictureCallBack === 'function') {
- capturePictureRT.then(function () {
- _this10.params.capturePictureCallBack({
- id: _this10.id,
- type: 'capturePicture',
- code: 0
- });
- })["catch"](function () {
- _this10.params.capturePictureCallBack({
- id: _this10.id,
- type: 'capturePicture',
- code: -1
- });
- });
- }
- return capturePictureRT;
- }
- return new Promise(function (resolve) {
- resolve(capturePictureRT);
- });
- }
- }, {
- key: "startSave",
- value: function startSave(name) {
- var _this11 = this;
- var startSaveRT = this.jSPlugin.JS_StartSave(0, name);
- if (isPromise(startSaveRT)) {
- // 兼容旧版本callback
- if (typeof this.params.startSaveCallBack === 'function') {
- startSaveRT.then(function () {
- _this11.params.startSaveCallBack({
- id: _this11.id,
- type: 'startSave',
- code: 0
- });
- })["catch"](function () {
- _this11.params.startSaveCallBack({
- id: _this11.id,
- type: 'startSave',
- code: -1
- });
- });
- }
- return startSaveRT;
- }
- if (this.Theme) {
- this.Theme.setDecoderState({
- recordvideo: true
- });
- }
- return new Promise(function (resolve) {
- resolve(startSaveRT);
- });
- }
- }, {
- key: "stopSave",
- value: function stopSave() {
- var _this12 = this;
- var stopSaveRT = this.jSPlugin.JS_StopSave(0);
- if (isPromise(stopSaveRT)) {
- // 兼容旧版本callback
- if (typeof this.params.startSaveCallBack === 'function') {
- stopSaveRT.then(function () {
- _this12.params.stopSaveCallBack({
- id: _this12.id,
- type: 'stopSave',
- code: 0
- });
- })["catch"](function () {
- _this12.params.stopSaveCallBack({
- id: _this12.id,
- type: 'stopSave',
- code: -1
- });
- });
- }
- return stopSaveRT;
- }
- if (this.Theme) {
- this.Theme.setDecoderState({
- recordvideo: false
- });
- }
- return new Promise(function (resolve) {
- resolve(stopSaveRT);
- });
- }
- }, {
- key: "openSound",
- value: function openSound() {
- var openSoundRT = this.jSPlugin.JS_OpenSound(0);
- console.log("打开声音", openSoundRT);
- if (isPromise(openSoundRT)) {
- return openSoundRT;
- }
- if (this.Theme) {
- this.Theme.setDecoderState({
- sound: true
- });
- }
- // 兼容旧版本callback
- if (typeof this.params.openSoundCallBack === 'function') {
- this.params.openSoundCallBack({
- id: this.id,
- type: 'openSound',
- code: openSoundRT
- });
- }
- return new Promise(function (resolve) {
- resolve(openSoundRT);
- });
- }
- }, {
- key: "closeSound",
- value: function closeSound() {
- var closeSoundRT = this.jSPlugin.JS_CloseSound(0);
- if (isPromise(closeSoundRT)) {
- return closeSoundRT;
- }
- if (this.Theme) {
- this.Theme.setDecoderState({
- sound: false
- });
- }
- // 兼容旧版本callback
- if (typeof this.params.closeSoundCallBack === 'function') {
- this.params.closeSoundCallBack({
- id: this.id,
- type: 'closeSound',
- code: closeSoundRT
- });
- }
- return new Promise(function (resolve) {
- resolve(closeSoundRT);
- });
- }
- }, {
- key: "enableZoom",
- value: function enableZoom() {
- var enableZoomRT = this.jSPlugin.JS_EnableZoom(0);
- if (isPromise(enableZoomRT)) {
- return enableZoomRT;
- }
- return new Promise(function (resolve) {
- resolve(enableZoomRT);
- });
- }
- }, {
- key: "closeZoom",
- value: function closeZoom() {
- var closeZoomRT = this.jSPlugin.JS_DisableZoom(0);
- if (isPromise(closeZoomRT)) {
- return closeZoomRT;
- }
- return new Promise(function (resolve) {
- resolve(closeZoomRT);
- });
- }
- }, {
- key: "setPoster",
- value: function setPoster(url) {
- // this.pluginStatus.setPoster(url);
- if (isVersion2Available()) {
- if (document.getElementById("".concat(this.id))) {
- document.getElementById("".concat(this.id)).style.backgroundImage = "url(".concat(url, ")");
- document.getElementById("".concat(this.id)).style.backgroundSize = "100% 100%";
- }
- } else {
- if (document.getElementById("".concat(this.id, "canvas0"))) {
- document.getElementById("".concat(this.id, "canvas0")).style.backgroundImage = "url(".concat(url, ")");
- document.getElementById("".concat(this.id, "canvas0")).style.backgroundSize = "cover";
- }
- }
- }
- }, {
- key: "reSize",
- value: function reSize(width, height) {
- var headerHeight = 0;
- var timeLineHeight = 0;
- this.params.height = height;
- this.params.width = width;
- //总体高度包含模板
- if (this.Theme && this.Theme.isNeedRenderHeader && document.getElementById("".concat(this.id, "-headControl"))) {
- headerHeight = parseInt(document.getElementById("".concat(this.id, "-headControl")).style.height, 10);
- }
- if (this.Theme && this.Theme.isNeedRenderTimeLine && !this.isMobile) {
- timeLineHeight = 48;
- }
- height = height - headerHeight - timeLineHeight;
- this.width = width;
- this.height = height;
- document.getElementById("".concat(this.id, "-wrap")).style = "width:".concat(width, "px;position:relative;display:inline-block;vertical-align: bottom;");
- document.getElementById("".concat(this.id)).style.width = width + 'px';
- document.getElementById("".concat(this.id)).style.height = height + 'px';
- if (this.jSPlugin && this.jSPlugin.bPlay) {
- if (this.jSPlugin) {
- this.jSPlugin.iHeight = height;
- this.jSPlugin.iWidth = width;
- }
- this.jSPlugin.JS_Resize(width, height);
- } else {
- if (document.getElementById("".concat(this.id, "-player"))) {
- document.getElementById("".concat(this.id, "-player")).width = width;
- document.getElementById("".concat(this.id, "-player")).height = height;
- document.getElementById("".concat(this.id, "-player")).style.width = width + "px";
- document.getElementById("".concat(this.id, "-player")).style.height = height + "px";
- }
- var scale = 1;
- if (document.getElementById("".concat(this.id, "canvas0"))) {
- 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);
- if (isNeedScale) {
- scale = 2;
- }
- document.getElementById("".concat(this.id, "canvas0")).style.width = width * scale + "px";
- document.getElementById("".concat(this.id, "canvas0")).style.height = height * scale + "px";
- document.getElementById("".concat(this.id, "canvas0")).width = width * scale;
- document.getElementById("".concat(this.id, "canvas0")).height = height * scale;
- document.getElementById("".concat(this.id, "canvas0")).parentNode.style.width = width * scale + "px";
- document.getElementById("".concat(this.id, "canvas0")).parentNode.style.height = height * scale + "px";
- document.getElementById("".concat(this.id, "canvas_draw0")).height = height * scale;
- }
- if (this.jSPlugin) {
- this.jSPlugin.iHeight = height * scale;
- this.jSPlugin.iWidth = width * scale;
- }
- }
- }
- }, {
- key: "fast",
- value: function fast(next) {
- var _this13 = this;
- var speed = this.speed;
- if (next) {
- var fastRT = this.jSPlugin.JS_Fast(0, next);
- } else {
- if (speed === 1) {
- speed = 2;
- } else if (speed === 2) {
- speed = 4;
- } else {
- if (typeof this.params.handleError === 'function') {
- this.params.handleError({
- msg: "播放速度最大为4倍速度",
- retcode: 1003,
- id: this.id,
- type: "handleError"
- });
- }
- return new Promise(function (resolve, reject) {
- _this13.speed = speed;
- reject({
- code: -1,
- data: {
- speed: speed,
- result: "播放速度最大为4倍速度"
- }
- });
- });
- }
- var fastRT = this.jSPlugin.JS_Fast(0);
- }
- return new Promise(function (resolve) {
- _this13.speed = speed;
- resolve({
- code: 0,
- data: {
- speed: speed,
- result: fastRT
- }
- });
- });
- }
- }, {
- key: "slow",
- value: function slow() {
- var _this14 = this;
- var speed = this.speed;
- if (speed === 4) {
- speed = 2;
- } else if (speed === 2) {
- speed = 1;
- } else {
- if (typeof this.params.handleError === 'function') {
- this.params.handleError({
- msg: "播放速度最小为1倍速度",
- retcode: 1003,
- id: this.id,
- type: "handleError"
- });
- }
- return new Promise(function (resolve, reject) {
- _this14.speed = speed;
- reject({
- code: -1,
- data: {
- speed: speed,
- result: "播放速度最小为1倍速度"
- }
- });
- });
- }
- var slowRT = this.jSPlugin.JS_Slow(0);
- return new Promise(function (resolve) {
- _this14.speed = speed;
- resolve({
- code: 0,
- data: {
- speed: speed,
- result: slowRT
- }
- });
- });
- }
- }, {
- key: "seek",
- value: function seek(startTime, endTime) {
- var url = this.url;
- var currentDay = (getQueryString('begin', url) || new Date().Format('yyyyMMdd')).substr(0, 8);
- endTime = formatRecTime(currentDay, '235959');
- if (startTime.length === 6) {
- startTime = formatRecTime(currentDay, startTime);
- } else if (startTime.length === 16) {
- if (startTime.substr(0, 8) !== currentDay) {
- if (typeof this.params.handleError === 'function') {
- this.params.handleError({
- msg: "seek时间不能跨日期",
- retcode: -1,
- id: this.id,
- type: "handleError"
- });
- }
- return false;
- }
- } else {
- if (typeof this.params.handleError === 'function') {
- this.params.handleError({
- msg: "seek时间格式错误",
- retcode: -1,
- id: this.id,
- type: "handleError"
- });
- }
- return false;
- }
- // 格式化回放时间
- function formatRecTime(time, defaultTime) {
- // 用户格式 无需更改 => 20182626T000000Z
- // return time
- // 用户格式需要更改
- //用户时间长度为 14 20181226000000 =》 20181226000000
- // 用户长度为12 201812260000 =》 201812260000 + defaultTime后面2位
- // 用户长度为10 2018122600 =》 201812260000 + defaultTime后面4位
- // 用户长度为8 20181226 =》 201812260000 + defaultTime后面6位
- // 结果 20181226000000 14位
- // 插入 TZ
- var reg = /^[0-9]{8}T[0-9]{6}Z$/;
- if (reg.test(time)) {
- // 用户格式 无需更改 => 20182626T000000Z
- return time;
- } else if (/[0-9]{8,14}/.test(time)) {
- var start = 6 - (14 - time.length);
- var end = defaultTime.length;
- var standardTime = time + defaultTime.substring(start, end);
- return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
- }
- throw new Error('回放时间格式有误,请确认');
- }
- var seekRT = this.jSPlugin.JS_Seek(0, startTime, endTime);
- console.log("seekRT", seekRT);
- if (isPromise(seekRT)) {
- return seekRT;
- }
- return new Promise(function (resolve) {
- resolve(seekRT);
- });
- }
- }, {
- key: "fullScreen",
- value: function fullScreen() {
- var _this15 = this;
- var promise = requestFullScreenPromise(document.getElementById("".concat(this.id)));
- promise.then(function (data) {
- console.log("全屏promise", window.screen.availWidth);
- _this15.jSPlugin.JS_Resize(window.screen.availWidth, window.screen.availHeight);
- // 兼容旧版本callback
- if (typeof _this15.params.fullScreenCallBack === 'function') {
- _this15.params.fullScreenCallBack({
- id: _this15.id,
- type: 'fullScreen',
- code: 0
- });
- }
- });
- // 监听全屏事件触发
- var fullscreenchange = function fullscreenchange() {
- var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
- if (!isFullScreen) {
- _this15.jSPlugin.JS_Resize(_this15.width, _this15.height);
- }
- // 兼容旧版本callback
- if (typeof _this15.params.fullScreenChangeCallBack === 'function') {
- _this15.params.fullScreenChangeCallBack({
- id: _this15.id,
- type: 'fullScreen',
- code: isFullScreen
- });
- }
- };
- ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
- window.addEventListener(item, function (data) {
- return fullscreenchange();
- });
- });
- }
- }, {
- key: "cancelFullScreen",
- value: function cancelFullScreen() {
- var _this16 = this;
- var cancelPromise = cancelFullScreenPromise();
- cancelPromise.then(function (data) {
- console.log("取消全屏", data, _this16.jSPlugin);
- _this16.jSPlugin.JS_Resize(_this16.width, _this16.height);
- });
- }
- }, {
- key: "startTalk",
- value: function startTalk() {
- this.Talk.startTalk();
- }
- }, {
- key: "stopTalk",
- value: function stopTalk() {
- this.Talk.stopTalk();
- }
- }, {
- key: "destroy",
- value: function destroy() {
- var destroyRT = this.jSPlugin.JS_DestroyWorker(0);
- if (this.Theme) {
- this.Theme = null;
- window.EZUIKit[this.params.id].state.EZUIKitPlayer.themeInit = false;
- }
- if (isPromise(destroyRT)) {
- return destroyRT;
- }
- return new Promise(function (resolve) {
- resolve(destroyRT);
- });
- }
- }, {
- key: "getDeviceCapacity",
- value: function getDeviceCapacity(params) {
- var _this17 = this;
- var apiDomain = this.env.domain;
- if (this.env) {
- apiDomain = this.env.domain;
- }
- var capacityUrl = apiDomain + "/api/lapp/device/capacity";
- var capacitySuccess = function capacitySuccess(data) {
- if (data.code == 200 && data.data) {
- _this17.capacity = data.data;
- }
- };
- var capacityParams = params || {
- accessToken: this.accessToken,
- deviceSerial: matchEzopenUrl(this.url).deviceSerial
- };
- request(capacityUrl, 'POST', capacityParams, '', capacitySuccess);
- }
- // pause() {
- // return this.jSPlugin.JS_Pause(0);
- // }
- // resume(time) {
- // return this.jSPlugin.JS_Resume(time);
- // }
- }, {
- key: "pause",
- value: function pause() {
- var _this18 = this;
- // return this.jSPlugin.JS_Pause(0);
- // this.reSetTheme();
- return new Promise(function (resolve, reject) {
- // 兼容单线程未关闭声音无法再次开启声音问题
- _this18.jSPlugin.JS_CloseSound(0);
- _this18.jSPlugin.JS_Pause(0, function (data) {
- _this18.setPoster(data.base64);
- }).then(function (data) {
- // 暂停成功
- if (_this18.Theme) {
- _this18.Theme.setDecoderState({
- play: false
- });
- }
- resolve();
- })["catch"](function (err) {
- // 暂停失败
- console.log(err);
- reject(err);
- });
- });
- }
- }, {
- key: "_resume",
- value: function _resume(time) {
- var _this19 = this;
- return new Promise(function (resolve, reject) {
- _this19.pluginStatus.setPlayStatus({
- play: false,
- loading: true
- });
- _this19.jSPlugin.JS_Resume(time).then(function (data) {
- setTimeout(function () {
- // 暂停恢复后,保持倍速
- if (_this19.url.indexOf(".rec") !== -1 && _this19.speed != 1) {
- _this19.jSPlugin.JS_Speed(_this19.speed);
- }
- }, 500);
- // 主题播放状态及声音状态
- if (_this19.Theme) {
- _this19.Theme.setDecoderState({
- play: true,
- speed: _this19.speed
- });
- var isOpenSound = _this19.Theme.decoderState.state.sound;
- if (isOpenSound) {
- setTimeout(function () {
- _this19.openSound();
- }, 500);
- }
- }
- resolve(data);
- })["catch"](function (err) {
- console.log("resume err", err);
- reject(err);
- });
- });
- // return this.jSPlugin.JS_Resume(time);
- }
- }]);
- return EZUIKitPlayer;
- }();
- var oWebControl = null;
- // var accessToken = '';
- /**
- * video 初始化及配置
- * @param {*video挂载的dom id} id
- * @param {*连接成功的回调} cbConnectSuccess
- * @param {*连接报错的回调} cbConnectError
- * @param {*连接关闭的回调} cbConnectClose
- */
- function WebControlInit(id, cbConnectSuccess, cbConnectError, cbConnectClose) {
- return new WebControl({
- szPluginContainer: id,
- iServicePortStart: 14510,
- // 对应 LocalServiceConfig.xml 中的ServicePortStart值
- iServicePortEnd: 14519,
- // 对应 LocalServiceConfig.xml 中的ServicePortEnd值
- cbConnectSuccess: cbConnectSuccess,
- cbConnectError: cbConnectError,
- cbConnectClose: cbConnectClose
- });
- }
- /**
- * 离开页面时调用 断开链接的方法
- * @param {*视频插件实例} oWebControl
- */
- function WebControlDistory() {
- if (oWebControl != null) {
- oWebControl.JS_DestroyWnd().then(function () {
- console.log('JS_DestroyWnd');
- }, function () {});
- oWebControl.JS_StopService('window').then(function () {
- oWebControl.JS_Disconnect().then(function () {
- console.log('JS_Disconnect');
- }, function () {});
- });
- }
- }
- // 监听视频控件的事件-todo
- function cbIntegrationCallBack(oData) {
- if (oData.responseMsg.eventName === 'FireTransFunction') ;
- // if (typeof onHDCallbackMessage === 'function' && oData && oData.responseMsg) {
- // onHDCallbackMessage(oData.responseMsg)
- // }
- console.log(oData.responseMsg);
- }
- function cbConnectSuccess() {
- // 设置窗口控制回调
- oWebControl.JS_SetWindowControlCallback({
- cbIntegrationCallBack: cbIntegrationCallBack
- });
- //创建视频窗口
- oWebControl.JS_StartService('window', {
- dllPath: './chain/cloudTransform.dll'
- }).then(function () {
- oWebControl.JS_CreateWnd('playWnd', 900, 500).then(function () {
- console.log('JS_CreateWnd success');
- });
- });
- }
- function cbConnectError() {
- console.log('cbConnectError');
- oWebControl = null;
- console.error('确认本地进程是否已安装并开启成功!');
- }
- function cbConnectClose(bNormalClose) {
- // 连接异常断开:bNormalClose = false
- // JS_Disconnect正常断开:bNormalClose = true
- console.log('cbConnectClose');
- oWebControl = null;
- }
- // //销毁视频控件
- // function WebControlDistory() {
- // // var bIE = !!window.ActiveXObject || 'ActiveXObject' in window // 是否为IE浏览器
- // if (oWebControl != null) {
- // oWebControl.JS_DestroyWnd().then(
- // function () {
- // console.log('JS_DestroyWnd');
- // },
- // function () { }
- // );
- // oWebControl.JS_StopService('window').then(function () {
- // oWebControl.JS_Disconnect().then(
- // function () {
- // console.log('JS_Disconnect');
- // },
- // function () { }
- // );
- // });
- // }
- // }
- window.onscroll = function () {
- if (oWebControl != null) {
- oWebControl.JS_Resize(900, 500);
- }
- };
- window.onresize = function () {
- if (oWebControl != null) {
- oWebControl.JS_Resize(900, 500);
- }
- };
- window.onunload = function () {
- try {
- oWebControl.JS_HideWnd();
- WebControlDistory();
- } catch (error) {
- console.error(error);
- }
- };
- window.onpagehide = function () {
- try {
- oWebControl.JS_HideWnd();
- } catch (error) {
- console.error(error);
- }
- };
- var EZUIKitHD = /*#__PURE__*/function () {
- function EZUIKitHD(params) {
- var _this = this;
- _classCallCheck$1(this, EZUIKitHD);
- _defineProperty(this, "changeModel", function (num, playParams) {
- var self = _this;
- _this.switchVideo = parseInt(num);
- // if (num == 0) {
- // this.setLayout(this.layout);
- // } else {
- // this.setLayout(1)
- // }
- if (oWebControl) {
- oWebControl.JS_RequestInterface({
- funcName: 'ChangeModel',
- arguments: encodeURI(JSON.stringify({
- model: num
- }))
- }).then(function (oData) {
- // self.play();
- if (num == 0) {
- // 预览
- self.play({
- deviceSerial: playParams.deviceSerial,
- channelNo: playParams.channelNo,
- validateCode: playParams.validateCode
- });
- } else {
- // 回放
- self.play({
- deviceSerial: playParams.deviceSerial,
- channelNo: playParams.channelNo,
- validateCode: playParams.validateCode,
- startTime: playParams.startTime,
- endTime: playParams.endTime
- });
- }
- });
- }
- });
- _defineProperty(this, "init", function (initParams) {
- var _argumentsPram;
- var self = _this;
- if (!initParams.appKey || !initParams.accessToken) {
- self.showTips(false, '请输入appkey和token');
- return;
- }
- if (typeof initParams.appKey !== 'undefined') {
- _this.appKey = initParams.appKey;
- }
- if (typeof initParams.accessToken !== 'undefined') {
- _this.accessToken = initParams.accessToken;
- }
- if (typeof initParams.platformId !== 'undefined') {
- _this.platformId = initParams.platformId;
- }
- // const onHDCallbackMessage = typeof initParams.onCallbackMessage === 'function';
- // if (onHDCallbackMessage) {
- // onHDCallbackMessage = initParams.onHDCallbackMessage
- // }
- // 初始化入参
- var argumentsPram = (_argumentsPram = {
- layout: +self.layout,
- userName: "",
- waterMark: ""
- }, _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", {
- code: 0,
- message: null,
- data: {
- appKey: initParams.appKey,
- ezvizToken: initParams.accessToken,
- videoLevel: 0,
- logLevel: 3,
- showMainTool: 1,
- showSubTool: 1,
- waterMark: "1",
- userName: "openteam",
- platformId: initParams.platformId
- }
- }), _argumentsPram);
- console.log('初始化入参', argumentsPram);
- // 调用视频控件初始化方法
- oWebControl.JS_RequestInterface({
- funcName: 'Init',
- arguments: encodeURI(JSON.stringify(argumentsPram))
- }).then(function (oData) {
- console.log(oData.responseMsg);
- self.showTips(true, '视频初始化成功!');
- });
- });
- _defineProperty(this, "play", function (playParams) {
- var self = _this;
- if (!playParams.deviceSerial || !playParams.channelNo) {
- return;
- }
- if (typeof playParams.deviceSerial !== 'undefined') {
- _this.deviceSerial = playParams.deviceSerial;
- }
- if (typeof playParams.channelNo !== 'undefined') {
- _this.channelNo = playParams.channelNo;
- }
- if (typeof playParams.startTime !== 'undefined' && playParams.startTime) {
- _this.startTime = playParams.startTime + ' 00:00:00';
- }
- if (typeof playParams.endTime !== 'undefined' && playParams.endTime) {
- _this.endTime = playParams.endTime + ' 23:59:59';
- }
- if (typeof playParams.validateCode !== 'undefined' && playParams.validateCode) {
- _this.validateCode = playParams.validateCode;
- }
- // 预览入参
- var argumentsPram = {
- response: {
- code: 0,
- message: null,
- data: {
- deviceSerial: playParams.deviceSerial,
- channelCode: playParams.channelNo,
- channelNo: +playParams.channelNo,
- codeIsEncrypt: 0,
- validateCode: playParams.validateCode,
- deviceClass: self.deviceClass,
- deviceType: "10222",
- //deviceType:"10240",
- channelId: "2222222222",
- channelName: "channelNameTest",
- storeName: "storeName",
- storeId: "storeid",
- // startTime: '2022-09-13 20:00:00',
- // endTime: '2022-09-13 21:40:00',
- startTime: _this.startTime,
- endTime: _this.endTime
- //Limited_start:limitStart,
- //Limited_end:limitEnd,
- }
- }
- };
- if (self.deviceClass === '1') {
- // 国标协议对应的两个字段
- argumentsPram.response.data.channelCode = self.channelNo;
- argumentsPram.response.data.platformId = self.platformId;
- } else {
- // 海康协议对应的一个字段
- argumentsPram.response.data.channelNo = +self.channelNo;
- }
- // 回放时对应的两个字段
- if (_this.switchVideo === 1) {
- if (_this.startTime) argumentsPram.response.data.startTime = _this.startTime;
- if (_this.endTime) argumentsPram.response.data.endTime = _this.endTime;
- }
- console.log('预览/回放入参', argumentsPram);
- // 调用视频控件预览方法
- oWebControl.JS_RequestInterface({
- funcName: _this.switchVideo === 0 ? 'StartPreview' : 'StartPlayback',
- arguments: encodeURI(JSON.stringify(argumentsPram))
- }).then(function (oData) {
- console.log(oData.responseMsg);
- self.showTips(true, '预览/回放成功!');
- })["catch"](function (res) {
- console.log('开始播放:', res);
- });
- });
- _defineProperty(this, "showCBInfo", function (message) {
- _this.callbackMessage = _this.callbackMessage + JSON.stringify(message) + '\n\n';
- console.log(_this.callbackMessage);
- });
- _defineProperty(this, "showTips", function (status, message) {
- // let self = this;
- // this.successTip = status;
- // this.tips = message;
- // this.tipsShow = true;
- // setTimeout(() => {
- // self.tipsShow = false;
- // }, 1000);
- });
- _defineProperty(this, "hideVideo", function () {
- oWebControl.JS_HideWnd();
- });
- _defineProperty(this, "showVideo", function () {
- oWebControl.JS_ShowWnd();
- });
- _defineProperty(this, "GetLayout", function () {
- var data = null;
- oWebControl.JS_RequestInterface({
- funcName: 'GetLayout',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: data
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "capturePicture", function (wndId) {
- var data = null;
- oWebControl.JS_RequestInterface({
- funcName: 'CaptureJPGEx',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: data
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "stop", function () {
- var wndId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
- oWebControl.JS_RequestInterface({
- funcName: 'StopPlay',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId) //传入1表示停止窗口1,传入-1表示停止当前活动窗口
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "setLayout", function (num) {
- var layout = parseInt(num);
- if (isNaN(layout) || layout == 0 || layout >= 13) {
- console.log('不支持实际布局大于16的窗口数');
- return;
- }
- _this.layout = layout;
- oWebControl.JS_RequestInterface({
- funcName: 'SetLayout',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- layout: layout //参数int为布局编号,其定义参见控件初始化函数 init方法中指定的编号。
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "setSoundVolumn", function () {
- var wndId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
- var num = arguments.length > 1 ? arguments[1] : undefined;
- oWebControl.JS_RequestInterface({
- funcName: 'SoundVolumn',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId),
- //传入1表示停止窗口1,传入-1表示停止当前活动窗口
- volumn: parseInt(num)
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "testMute", function () {
- var num = parseInt(prompt('请输入窗口ID'));
- oWebControl.JS_RequestInterface({
- funcName: 'MuteOnOff',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: num
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "testSelectWnd", function () {
- var num = parseInt(prompt('请输入窗口ID'));
- oWebControl.JS_RequestInterface({
- funcName: 'SelectPlayWnd',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: num
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "setVideoLevel", function (wndId, level) {
- oWebControl.JS_RequestInterface({
- funcName: 'SetVideoLevel',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: _this.switchVideo == 1 ? 0 : parseInt(wndId),
- level: parseInt(level, 10) //0:流畅 1:均衡 2:高品质 3:超清
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "startTalk", function (wndId) {
- oWebControl.JS_RequestInterface({
- funcName: 'StartTalk',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId)
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "stopTalk", function (wndId) {
- oWebControl.JS_RequestInterface({
- funcName: 'StopTalk',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId)
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "startSave", function (wndId) {
- oWebControl.JS_RequestInterface({
- funcName: 'StartRecord',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId)
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- _defineProperty(this, "stopSave", function (wndId) {
- oWebControl.JS_RequestInterface({
- funcName: 'StopRecord',
- arguments: encodeURI(JSON.stringify({
- response: {
- code: 0,
- message: null,
- data: {
- wndId: parseInt(wndId)
- }
- }
- }))
- }).then(function (oData) {
- console.log(JSON.stringify(oData.responseMsg));
- console.log(oData.responseMsg);
- });
- });
- this.appKey = 'b9a3ad6e8026410095d8252169fa430a', this.accessToken = 'at.2vtum8873rrcwbrv431qb6pn94dkbv23-8dw2twn355-1u3x014-wrthellzk', this.deviceSerial = 'C33368372', this.channelNo = '1', this.validateCode = ''; // 设备验证码
- this.deviceClass = '0';
- this.platformId = '';
- this.startTime = '';
- this.endTime = '';
- this.layout = 2;
- this.switchVideo = 0; // 0实时预览 1录像回放
- this.tips = '调用成功';
- this.successTip = false;
- this.tipsShow = false;
- oWebControl = WebControlInit('playWnd', cbConnectSuccess, cbConnectError, cbConnectClose);
- }
- /**
- * 切换模式
- * @param {*} num 0: 预览 1:回放
- */
- _createClass$1(EZUIKitHD, [{
- key: "alarmMsg",
- value: function alarmMsg() {
- var 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": 1620921217000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620920678000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620920586000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620919513000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620919483000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620919333000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620918913000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620918616000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620918305000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620917858000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620917658000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620917244000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620917064000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916994000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916668000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916571000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916529000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916343000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620916081000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620915825000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620915676000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620915531000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620915394000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620915197000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914971000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914644000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914533000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914457000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914376000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620914284000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620913973000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620913431000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912834000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912771000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912354000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912275000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912093000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620912024000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911890000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911839000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911807000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911760000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911682000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911270000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620911184000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910982000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910931000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910851000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910781000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910727000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910677000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910647000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910588000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910544000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910484000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910410000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910350000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910278000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910217000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620910124000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909976000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909939000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909847000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909817000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909736000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909664000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909605000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909575000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909346000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909247000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909216000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909149000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909120000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620909028000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908999000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908969000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908909000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908880000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908835000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908750000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908720000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908652000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908612000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908582000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908552000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908456000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908426000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908299000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908268000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620908050000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907918000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907758000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907625000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907386000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907292000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620907127000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906864000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906828000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906797000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906747000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906717000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906632000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906501000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906412000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906368000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906329000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906142000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906112000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620906013000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905946000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905823000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905697000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905622000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905571000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905541000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905511000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905481000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905442000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905412000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905382000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905352000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905322000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905262000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905196000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620905150000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904994000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904931000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904813000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904730000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904700000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904618000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904286000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904173000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904143000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904112000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904053000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620904023000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903854000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903789000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903723000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903643000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903612000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903573000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903505000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903383000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903329000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903299000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903268000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903200000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903149000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620903120000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902977000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902860000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902770000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902639000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902609000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902517000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902373000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902320000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902253000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902198000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620902132000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901940000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901850000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901789000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901746000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901685000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901638000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901520000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901489000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901424000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901271000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901233000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620901157000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900915000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900834000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900774000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900744000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900650000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900440000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900409000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900175000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900134000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900069000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620900016000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899976000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899908000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899879000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899826000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899756000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899599000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899559000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899467000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899406000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899265000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899211000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899140000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899110000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620899050000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898991000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898926000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898834000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898785000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898746000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898697000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898666000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898507000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898293000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898248000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898218000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898157000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898088000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620898020000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897960000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897850000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897807000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897771000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897719000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897690000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897630000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897600000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897570000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897540000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897475000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897412000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897369000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897339000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897279000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897237000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897207000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897172000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897142000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897112000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620897024000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896985000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896874000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896843000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896814000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896783000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896736000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896621000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896478000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896447000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896358000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896307000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896277000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896247000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896214000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620896040000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895953000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895921000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895868000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895770000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895704000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895590000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895559000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895480000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895442000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895377000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895347000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895293000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895171000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895136000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620895017000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894926000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894896000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894864000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894834000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894738000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894599000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894539000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894426000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894359000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894297000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894213000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894183000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620894051000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893964000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893934000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893843000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893754000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893676000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893606000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893530000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893452000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893423000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893357000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893288000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893143000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893051000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620893006000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892904000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892824000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892764000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892541000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892479000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892412000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892311000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892281000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892209000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620892063000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891991000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891931000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891870000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891810000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891708000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891655000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891585000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891531000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891501000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891401000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891297000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891257000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891216000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891178000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891128000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620891033000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890973000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890940000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890879000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890794000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890714000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890616000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890586000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890469000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890414000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890346000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890288000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890179000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890108000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890041000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620890011000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889937000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889719000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889635000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889481000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889451000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889317000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889227000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889139000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620889034000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888973000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888902000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888837000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888767000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888737000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888706000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888633000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888571000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888413000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888353000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888323000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888249000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888162000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620888000000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887859000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887776000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887734000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887692000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887619000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887501000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887355000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887320000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887289000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887126000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887066000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620887034000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886970000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886884000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886804000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886728000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886609000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886538000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886478000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886396000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886334000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886246000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886111000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620886011000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885956000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885894000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885696000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885514000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885484000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885414000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885383000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885341000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885306000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885276000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885216000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885186000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885114000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885037000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620885006000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884975000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884945000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884911000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884851000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884780000
- }, {
- "alarmType": 10800,
- "alarmName": "移动侦测报警",
- "alarmTime": 1620884696000
- }],
- "success": true
- }
- };
- console.log(res);
- //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}}
- oWebControl.JS_RequestInterface({
- funcName: 'TransFunctionResult',
- arguments: encodeURI(JSON.stringify(res))
- });
- //.JS_RequestInterface({funcName: 'TransFunctionResult', arguments: {
- // response: res
- //}})
- }
- }]);
- return EZUIKitHD;
- }();
- (function (global, factory) {
- if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
- module.exports = global.document ? factory(global, true) : function (w) {
- if (!w.document) {
- throw new Error("EZUIPlayer requires a window with a document");
- }
- return factory(w);
- };
- } else {
- factory(global);
- }
- // Pass this if window is not defined yet
- })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
- var EZUIKit = {
- Core: Core,
- HLS: HLS,
- FLV: FLV,
- EZUIKitPlayer: EZUIKitPlayer,
- EZUIKitHD: EZUIKitHD
- };
- window.EZUIKit = EZUIKit;
- return EZUIKit;
- });
|