site.js 468 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141
  1. /*!
  2. * Bootstrap v5.2.2 (https://getbootstrap.com/)
  3. * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";const t="transitionend",e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},i=t=>{const i=e(t);return i&&document.querySelector(i)?i:null},n=t=>{const i=e(t);return i?document.querySelector(i):null},s=e=>{e.dispatchEvent(new Event(t))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,a=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},l=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),c=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?c(t.parentNode):null},h=()=>{},d=t=>{t.offsetHeight},u=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,f=[],p=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=u();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(f.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of f)t()})),f.push(e)):e()},m=t=>{"function"==typeof t&&t()},_=(e,i,n=!0)=>{if(!n)return void m(e);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(i)+5;let r=!1;const a=({target:n})=>{n===i&&(r=!0,i.removeEventListener(t,a),m(e))};i.addEventListener(t,a),setTimeout((()=>{r||s(i)}),o)},b=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},v=/[^.]*(?=\..*)\.|.*/,y=/\..*/,w=/::\d+$/,A={};let E=1;const T={mouseenter:"mouseover",mouseleave:"mouseout"},C=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function O(t,e){return e&&`${e}::${E++}`||t.uidEvent||E++}function x(t){const e=O(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function k(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function L(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=N(t);return C.has(o)||(o=t),[n,s,o]}function D(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=L(e,i,n);if(e in T){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=x(t),c=l[a]||(l[a]={}),h=k(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=O(r,e.replace(v,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return j(s,{delegateTarget:r}),n.oneOff&&P.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return j(n,{delegateTarget:t}),i.oneOff&&P.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function S(t,e,i,n,s){const o=k(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function I(t,e,i,n){const s=e[i]||{};for(const o of Object.keys(s))if(o.includes(n)){const n=s[o];S(t,e,i,n.callable,n.delegationSelector)}}function N(t){return t=t.replace(y,""),T[t]||t}const P={on(t,e,i,n){D(t,e,i,n,!1)},one(t,e,i,n){D(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=L(e,i,n),a=r!==e,l=x(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))I(t,l,i,e.slice(1));for(const i of Object.keys(c)){const n=i.replace(w,"");if(!a||e.includes(n)){const e=c[i];S(t,l,r,e.callable,e.delegationSelector)}}}else{if(!Object.keys(c).length)return;S(t,l,r,o,s?i:null)}},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=u();let s=null,o=!0,r=!0,a=!1;e!==N(e)&&n&&(s=n.Event(e,i),n(t).trigger(s),o=!s.isPropagationStopped(),r=!s.isImmediatePropagationStopped(),a=s.isDefaultPrevented());let l=new Event(e,{bubbles:o,cancelable:!0});return l=j(l,i),a&&l.preventDefault(),r&&t.dispatchEvent(l),l.defaultPrevented&&s&&s.preventDefault(),l}};function j(t,e){for(const[i,n]of Object.entries(e||{}))try{t[i]=n}catch(e){Object.defineProperty(t,i,{configurable:!0,get:()=>n})}return t}const M=new Map,H={set(t,e,i){M.has(t)||M.set(t,new Map);const n=M.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>M.has(t)&&M.get(t).get(e)||null,remove(t,e){if(!M.has(t))return;const i=M.get(t);i.delete(e),0===i.size&&M.delete(t)}};function $(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function W(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}const B={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${W(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${W(e)}`)},getDataAttributes(t){if(!t)return{};const e={},i=Object.keys(t.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),e[i]=$(t.dataset[n])}return e},getDataAttribute:(t,e)=>$(t.getAttribute(`data-bs-${W(e)}`))};class F{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const i=o(e)?B.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...o(e)?B.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const n of Object.keys(e)){const s=e[n],r=t[n],a=o(r)?"element":null==(i=r)?`${i}`:Object.prototype.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(s).test(a))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${a}" but expected type "${s}".`)}var i}}class z extends F{constructor(t,e){super(),(t=r(t))&&(this._element=t,this._config=this._getConfig(e),H.set(this._element,this.constructor.DATA_KEY,this))}dispose(){H.remove(this._element,this.constructor.DATA_KEY),P.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,i=!0){_(t,e,i)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return H.get(r(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.2.2"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const q=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;P.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),l(this))return;const o=n(this)||this.closest(`.${s}`);t.getOrCreateInstance(o)[e]()}))};class R extends z{static get NAME(){return"alert"}close(){if(P.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),P.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=R.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}q(R,"close"),g(R);const V='[data-bs-toggle="button"]';class K extends z{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=K.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}P.on(document,"click.bs.button.data-api",V,(t=>{t.preventDefault();const e=t.target.closest(V);K.getOrCreateInstance(e).toggle()})),g(K);const Q={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let n=t.parentNode.closest(e);for(;n;)i.push(n),n=n.parentNode.closest(e);return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(e,t).filter((t=>!l(t)&&a(t)))}},X={endCallback:null,leftCallback:null,rightCallback:null},Y={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class U extends F{constructor(t,e){super(),this._element=t,t&&U.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return X}static get DefaultType(){return Y}static get NAME(){return"swipe"}dispose(){P.off(this._element,".bs.swipe")}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),m(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=40)return;const e=t/this._deltaX;this._deltaX=0,e&&m(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(P.on(this._element,"pointerdown.bs.swipe",(t=>this._start(t))),P.on(this._element,"pointerup.bs.swipe",(t=>this._end(t))),this._element.classList.add("pointer-event")):(P.on(this._element,"touchstart.bs.swipe",(t=>this._start(t))),P.on(this._element,"touchmove.bs.swipe",(t=>this._move(t))),P.on(this._element,"touchend.bs.swipe",(t=>this._end(t))))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&("pen"===t.pointerType||"touch"===t.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const G="next",J="prev",Z="left",tt="right",et="slid.bs.carousel",it="carousel",nt="active",st={ArrowLeft:tt,ArrowRight:Z},ot={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},rt={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class at extends z{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=Q.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===it&&this.cycle()}static get Default(){return ot}static get DefaultType(){return rt}static get NAME(){return"carousel"}next(){this._slide(G)}nextWhenVisible(){!document.hidden&&a(this._element)&&this.next()}prev(){this._slide(J)}pause(){this._isSliding&&s(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?P.one(this._element,et,(()=>this.cycle())):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void P.one(this._element,et,(()=>this.to(t)));const i=this._getItemIndex(this._getActive());if(i===t)return;const n=t>i?G:J;this._slide(n,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&P.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(P.on(this._element,"mouseenter.bs.carousel",(()=>this.pause())),P.on(this._element,"mouseleave.bs.carousel",(()=>this._maybeEnableCycle()))),this._config.touch&&U.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of Q.find(".carousel-item img",this._element))P.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()));const t={leftCallback:()=>this._slide(this._directionToOrder(Z)),rightCallback:()=>this._slide(this._directionToOrder(tt)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new U(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=st[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=Q.findOne(".active",this._indicatorsElement);e.classList.remove(nt),e.removeAttribute("aria-current");const i=Q.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);i&&(i.classList.add(nt),i.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const i=this._getActive(),n=t===G,s=e||b(this._getItems(),i,n,this._config.wrap);if(s===i)return;const o=this._getItemIndex(s),r=e=>P.trigger(this._element,e,{relatedTarget:s,direction:this._orderToDirection(t),from:this._getItemIndex(i),to:o});if(r("slide.bs.carousel").defaultPrevented)return;if(!i||!s)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=s;const l=n?"carousel-item-start":"carousel-item-end",c=n?"carousel-item-next":"carousel-item-prev";s.classList.add(c),d(s),i.classList.add(l),s.classList.add(l),this._queueCallback((()=>{s.classList.remove(l,c),s.classList.add(nt),i.classList.remove(nt,c,l),this._isSliding=!1,r(et)}),i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return Q.findOne(".active.carousel-item",this._element)}_getItems(){return Q.find(".carousel-item",this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return p()?t===Z?J:G:t===Z?G:J}_orderToDirection(t){return p()?t===J?Z:tt:t===J?tt:Z}static jQueryInterface(t){return this.each((function(){const e=at.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)}))}}P.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",(function(t){const e=n(this);if(!e||!e.classList.contains(it))return;t.preventDefault();const i=at.getOrCreateInstance(e),s=this.getAttribute("data-bs-slide-to");return s?(i.to(s),void i._maybeEnableCycle()):"next"===B.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())})),P.on(window,"load.bs.carousel.data-api",(()=>{const t=Q.find('[data-bs-ride="carousel"]');for(const e of t)at.getOrCreateInstance(e)})),g(at);const lt="show",ct="collapse",ht="collapsing",dt='[data-bs-toggle="collapse"]',ut={parent:null,toggle:!0},ft={parent:"(null|element)",toggle:"boolean"};class pt extends z{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const n=Q.find(dt);for(const t of n){const e=i(t),n=Q.find(e).filter((t=>t===this._element));null!==e&&n.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return ut}static get DefaultType(){return ft}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((t=>t!==this._element)).map((t=>pt.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(P.trigger(this._element,"show.bs.collapse").defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(ct),this._element.classList.add(ht),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct,lt),this._element.style[e]="",P.trigger(this._element,"shown.bs.collapse")}),this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(P.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,d(this._element),this._element.classList.add(ht),this._element.classList.remove(ct,lt);for(const t of this._triggerArray){const e=n(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0,this._element.style[t]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct),P.trigger(this._element,"hidden.bs.collapse")}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(lt)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=r(t.parent),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(dt);for(const e of t){const t=n(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=Q.find(":scope .collapse .collapse",this._config.parent);return Q.find(t,this._config.parent).filter((t=>!e.includes(t)))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const i of t)i.classList.toggle("collapsed",!e),i.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each((function(){const i=pt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}P.on(document,"click.bs.collapse.data-api",dt,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=i(this),n=Q.find(e);for(const t of n)pt.getOrCreateInstance(t,{toggle:!1}).toggle()})),g(pt);var gt="top",mt="bottom",_t="right",bt="left",vt="auto",yt=[gt,mt,_t,bt],wt="start",At="end",Et="clippingParents",Tt="viewport",Ct="popper",Ot="reference",xt=yt.reduce((function(t,e){return t.concat([e+"-"+wt,e+"-"+At])}),[]),kt=[].concat(yt,[vt]).reduce((function(t,e){return t.concat([e,e+"-"+wt,e+"-"+At])}),[]),Lt="beforeRead",Dt="read",St="afterRead",It="beforeMain",Nt="main",Pt="afterMain",jt="beforeWrite",Mt="write",Ht="afterWrite",$t=[Lt,Dt,St,It,Nt,Pt,jt,Mt,Ht];function Wt(t){return t?(t.nodeName||"").toLowerCase():null}function Bt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ft(t){return t instanceof Bt(t).Element||t instanceof Element}function zt(t){return t instanceof Bt(t).HTMLElement||t instanceof HTMLElement}function qt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Bt(t).ShadowRoot||t instanceof ShadowRoot)}const Rt={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];zt(s)&&Wt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});zt(n)&&Wt(n)&&(Object.assign(n.style,o),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Vt(t){return t.split("-")[0]}var Kt=Math.max,Qt=Math.min,Xt=Math.round;function Yt(){var t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ut(){return!/^((?!chrome|android).)*safari/i.test(Yt())}function Gt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,o=1;e&&zt(t)&&(s=t.offsetWidth>0&&Xt(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Xt(n.height)/t.offsetHeight||1);var r=(Ft(t)?Bt(t):window).visualViewport,a=!Ut()&&i,l=(n.left+(a&&r?r.offsetLeft:0))/s,c=(n.top+(a&&r?r.offsetTop:0))/o,h=n.width/s,d=n.height/o;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function Jt(t){var e=Gt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Zt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&qt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function te(t){return Bt(t).getComputedStyle(t)}function ee(t){return["table","td","th"].indexOf(Wt(t))>=0}function ie(t){return((Ft(t)?t.ownerDocument:t.document)||window.document).documentElement}function ne(t){return"html"===Wt(t)?t:t.assignedSlot||t.parentNode||(qt(t)?t.host:null)||ie(t)}function se(t){return zt(t)&&"fixed"!==te(t).position?t.offsetParent:null}function oe(t){for(var e=Bt(t),i=se(t);i&&ee(i)&&"static"===te(i).position;)i=se(i);return i&&("html"===Wt(i)||"body"===Wt(i)&&"static"===te(i).position)?e:i||function(t){var e=/firefox/i.test(Yt());if(/Trident/i.test(Yt())&&zt(t)&&"fixed"===te(t).position)return null;var i=ne(t);for(qt(i)&&(i=i.host);zt(i)&&["html","body"].indexOf(Wt(i))<0;){var n=te(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function re(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ae(t,e,i){return Kt(t,Qt(e,i))}function le(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ce(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}const he={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,o=i.elements.arrow,r=i.modifiersData.popperOffsets,a=Vt(i.placement),l=re(a),c=[bt,_t].indexOf(a)>=0?"height":"width";if(o&&r){var h=function(t,e){return le("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ce(t,yt))}(s.padding,i),d=Jt(o),u="y"===l?gt:bt,f="y"===l?mt:_t,p=i.rects.reference[c]+i.rects.reference[l]-r[l]-i.rects.popper[c],g=r[l]-i.rects.reference[l],m=oe(o),_=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=p/2-g/2,v=h[u],y=_-d[c]-h[f],w=_/2-d[c]/2+b,A=ae(v,w,y),E=l;i.modifiersData[n]=((e={})[E]=A,e.centerOffset=A-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Zt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function de(t){return t.split("-")[1]}var ue={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fe(t){var e,i=t.popper,n=t.popperRect,s=t.placement,o=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,d=t.isFixed,u=r.x,f=void 0===u?0:u,p=r.y,g=void 0===p?0:p,m="function"==typeof h?h({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var _=r.hasOwnProperty("x"),b=r.hasOwnProperty("y"),v=bt,y=gt,w=window;if(c){var A=oe(i),E="clientHeight",T="clientWidth";A===Bt(i)&&"static"!==te(A=ie(i)).position&&"absolute"===a&&(E="scrollHeight",T="scrollWidth"),(s===gt||(s===bt||s===_t)&&o===At)&&(y=mt,g-=(d&&A===w&&w.visualViewport?w.visualViewport.height:A[E])-n.height,g*=l?1:-1),s!==bt&&(s!==gt&&s!==mt||o!==At)||(v=_t,f-=(d&&A===w&&w.visualViewport?w.visualViewport.width:A[T])-n.width,f*=l?1:-1)}var C,O=Object.assign({position:a},c&&ue),x=!0===h?function(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:Xt(e*n)/n||0,y:Xt(i*n)/n||0}}({x:f,y:g}):{x:f,y:g};return f=x.x,g=x.y,l?Object.assign({},O,((C={})[y]=b?"0":"",C[v]=_?"0":"",C.transform=(w.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",C)):Object.assign({},O,((e={})[y]=b?g+"px":"",e[v]=_?f+"px":"",e.transform="",e))}const pe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,o=i.adaptive,r=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Vt(e.placement),variation:de(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,fe(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,fe(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};var ge={passive:!0};const me={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,o=void 0===s||s,r=n.resize,a=void 0===r||r,l=Bt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,ge)})),a&&l.addEventListener("resize",i.update,ge),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,ge)})),a&&l.removeEventListener("resize",i.update,ge)}},data:{}};var _e={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,(function(t){return _e[t]}))}var ve={start:"end",end:"start"};function ye(t){return t.replace(/start|end/g,(function(t){return ve[t]}))}function we(t){var e=Bt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ae(t){return Gt(ie(t)).left+we(t).scrollLeft}function Ee(t){var e=te(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function Te(t){return["html","body","#document"].indexOf(Wt(t))>=0?t.ownerDocument.body:zt(t)&&Ee(t)?t:Te(ne(t))}function Ce(t,e){var i;void 0===e&&(e=[]);var n=Te(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=Bt(n),r=s?[o].concat(o.visualViewport||[],Ee(n)?n:[]):n,a=e.concat(r);return s?a:a.concat(Ce(ne(r)))}function Oe(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xe(t,e,i){return e===Tt?Oe(function(t,e){var i=Bt(t),n=ie(t),s=i.visualViewport,o=n.clientWidth,r=n.clientHeight,a=0,l=0;if(s){o=s.width,r=s.height;var c=Ut();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:r,x:a+Ae(t),y:l}}(t,i)):Ft(e)?function(t,e){var i=Gt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):Oe(function(t){var e,i=ie(t),n=we(t),s=null==(e=t.ownerDocument)?void 0:e.body,o=Kt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=Kt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+Ae(t),l=-n.scrollTop;return"rtl"===te(s||i).direction&&(a+=Kt(i.clientWidth,s?s.clientWidth:0)-o),{width:o,height:r,x:a,y:l}}(ie(t)))}function ke(t){var e,i=t.reference,n=t.element,s=t.placement,o=s?Vt(s):null,r=s?de(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case gt:e={x:a,y:i.y-n.height};break;case mt:e={x:a,y:i.y+i.height};break;case _t:e={x:i.x+i.width,y:l};break;case bt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?re(o):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case wt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case At:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function Le(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,o=i.strategy,r=void 0===o?t.strategy:o,a=i.boundary,l=void 0===a?Et:a,c=i.rootBoundary,h=void 0===c?Tt:c,d=i.elementContext,u=void 0===d?Ct:d,f=i.altBoundary,p=void 0!==f&&f,g=i.padding,m=void 0===g?0:g,_=le("number"!=typeof m?m:ce(m,yt)),b=u===Ct?Ot:Ct,v=t.rects.popper,y=t.elements[p?b:u],w=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=Ce(ne(t)),i=["absolute","fixed"].indexOf(te(t).position)>=0&&zt(t)?oe(t):t;return Ft(i)?e.filter((function(t){return Ft(t)&&Zt(t,i)&&"body"!==Wt(t)})):[]}(t):[].concat(e),o=[].concat(s,[i]),r=o[0],a=o.reduce((function(e,i){var s=xe(t,i,n);return e.top=Kt(s.top,e.top),e.right=Qt(s.right,e.right),e.bottom=Qt(s.bottom,e.bottom),e.left=Kt(s.left,e.left),e}),xe(t,r,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(Ft(y)?y:y.contextElement||ie(t.elements.popper),l,h,r),A=Gt(t.elements.reference),E=ke({reference:A,element:v,strategy:"absolute",placement:s}),T=Oe(Object.assign({},v,E)),C=u===Ct?T:A,O={top:w.top-C.top+_.top,bottom:C.bottom-w.bottom+_.bottom,left:w.left-C.left+_.left,right:C.right-w.right+_.right},x=t.modifiersData.offset;if(u===Ct&&x){var k=x[s];Object.keys(O).forEach((function(t){var e=[_t,mt].indexOf(t)>=0?1:-1,i=[gt,mt].indexOf(t)>=0?"y":"x";O[t]+=k[i]*e}))}return O}function De(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,o=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?kt:l,h=de(n),d=h?a?xt:xt.filter((function(t){return de(t)===h})):yt,u=d.filter((function(t){return c.indexOf(t)>=0}));0===u.length&&(u=d);var f=u.reduce((function(e,i){return e[i]=Le(t,{placement:i,boundary:s,rootBoundary:o,padding:r})[Vt(i)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}const Se={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0===r||r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,u=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,_=Vt(m),b=l||(_!==m&&p?function(t){if(Vt(t)===vt)return[];var e=be(t);return[ye(t),e,ye(e)]}(m):[be(m)]),v=[m].concat(b).reduce((function(t,i){return t.concat(Vt(i)===vt?De(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)}),[]),y=e.rects.reference,w=e.rects.popper,A=new Map,E=!0,T=v[0],C=0;C<v.length;C++){var O=v[C],x=Vt(O),k=de(O)===wt,L=[gt,mt].indexOf(x)>=0,D=L?"width":"height",S=Le(e,{placement:O,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),I=L?k?_t:bt:k?mt:gt;y[D]>w[D]&&(I=be(I));var N=be(I),P=[];if(o&&P.push(S[x]<=0),a&&P.push(S[I]<=0,S[N]<=0),P.every((function(t){return t}))){T=O,E=!1;break}A.set(O,P)}if(E)for(var j=function(t){var e=v.find((function(e){var i=A.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return T=e,"break"},M=p?3:1;M>0&&"break"!==j(M);M--);e.placement!==T&&(e.modifiersData[n]._skip=!0,e.placement=T,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Ie(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ne(t){return[gt,_t,mt,bt].some((function(e){return t[e]>=0}))}const Pe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,o=e.modifiersData.preventOverflow,r=Le(e,{elementContext:"reference"}),a=Le(e,{altBoundary:!0}),l=Ie(r,n),c=Ie(a,s,o),h=Ne(l),d=Ne(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}},je={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,o=void 0===s?[0,0]:s,r=kt.reduce((function(t,i){return t[i]=function(t,e,i){var n=Vt(t),s=[bt,gt].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=o[0],a=o[1];return r=r||0,a=(a||0)*s,[bt,_t].indexOf(n)>=0?{x:a,y:r}:{x:r,y:a}}(i,e.rects,o),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=r}},Me={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=ke({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},He={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0!==r&&r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,u=i.tether,f=void 0===u||u,p=i.tetherOffset,g=void 0===p?0:p,m=Le(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),_=Vt(e.placement),b=de(e.placement),v=!b,y=re(_),w="x"===y?"y":"x",A=e.modifiersData.popperOffsets,E=e.rects.reference,T=e.rects.popper,C="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,O="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),x=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(A){if(o){var L,D="y"===y?gt:bt,S="y"===y?mt:_t,I="y"===y?"height":"width",N=A[y],P=N+m[D],j=N-m[S],M=f?-T[I]/2:0,H=b===wt?E[I]:T[I],$=b===wt?-T[I]:-E[I],W=e.elements.arrow,B=f&&W?Jt(W):{width:0,height:0},F=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},z=F[D],q=F[S],R=ae(0,E[I],B[I]),V=v?E[I]/2-M-R-z-O.mainAxis:H-R-z-O.mainAxis,K=v?-E[I]/2+M+R+q+O.mainAxis:$+R+q+O.mainAxis,Q=e.elements.arrow&&oe(e.elements.arrow),X=Q?"y"===y?Q.clientTop||0:Q.clientLeft||0:0,Y=null!=(L=null==x?void 0:x[y])?L:0,U=N+K-Y,G=ae(f?Qt(P,N+V-Y-X):P,N,f?Kt(j,U):j);A[y]=G,k[y]=G-N}if(a){var J,Z="x"===y?gt:bt,tt="x"===y?mt:_t,et=A[w],it="y"===w?"height":"width",nt=et+m[Z],st=et-m[tt],ot=-1!==[gt,bt].indexOf(_),rt=null!=(J=null==x?void 0:x[w])?J:0,at=ot?nt:et-E[it]-T[it]-rt+O.altAxis,lt=ot?et+E[it]+T[it]-rt-O.altAxis:st,ct=f&&ot?function(t,e,i){var n=ae(t,e,i);return n>i?i:n}(at,et,lt):ae(f?at:nt,et,f?lt:st);A[w]=ct,k[w]=ct-et}e.modifiersData[n]=k}},requiresIfExists:["offset"]};function $e(t,e,i){void 0===i&&(i=!1);var n,s,o=zt(e),r=zt(e)&&function(t){var e=t.getBoundingClientRect(),i=Xt(e.width)/t.offsetWidth||1,n=Xt(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=ie(e),l=Gt(t,r,i),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(o||!o&&!i)&&(("body"!==Wt(e)||Ee(a))&&(c=(n=e)!==Bt(n)&&zt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:we(n)),zt(e)?((h=Gt(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=Ae(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function We(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Be={placement:"bottom",modifiers:[],strategy:"absolute"};function Fe(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function ze(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,s=e.defaultOptions,o=void 0===s?Be:s;return function(t,e,i){void 0===i&&(i=o);var s,r,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Be,o),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,h={state:a,setOptions:function(i){var s="function"==typeof i?i(a.options):i;d(),a.options=Object.assign({},o,a.options,s),a.scrollParents={reference:Ft(t)?Ce(t):t.contextElement?Ce(t.contextElement):[],popper:Ce(e)};var r,c,u=function(t){var e=We(t);return $t.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((r=[].concat(n,a.options.modifiers),c=r.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return a.orderedModifiers=u.filter((function(t){return t.enabled})),a.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,s=t.effect;if("function"==typeof s){var o=s({state:a,name:e,instance:h,options:n});l.push(o||function(){})}})),h.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(Fe(e,i)){a.rects={reference:$e(e,oe(i),"fixed"===a.options.strategy),popper:Jt(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(t){return a.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var s=a.orderedModifiers[n],o=s.fn,r=s.options,l=void 0===r?{}:r,d=s.name;"function"==typeof o&&(a=o({state:a,options:l,name:d,instance:h})||a)}else a.reset=!1,n=-1}}},update:(s=function(){return new Promise((function(t){h.forceUpdate(),t(a)}))},function(){return r||(r=new Promise((function(t){Promise.resolve().then((function(){r=void 0,t(s())}))}))),r}),destroy:function(){d(),c=!0}};if(!Fe(t,e))return h;function d(){l.forEach((function(t){return t()})),l=[]}return h.setOptions(i).then((function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t)})),h}}var qe=ze(),Re=ze({defaultModifiers:[me,Me,pe,Rt]}),Ve=ze({defaultModifiers:[me,Me,pe,Rt,je,Se,He,he,Pe]});const Ke=Object.freeze(Object.defineProperty({__proto__:null,popperGenerator:ze,detectOverflow:Le,createPopperBase:qe,createPopper:Ve,createPopperLite:Re,top:gt,bottom:mt,right:_t,left:bt,auto:vt,basePlacements:yt,start:wt,end:At,clippingParents:Et,viewport:Tt,popper:Ct,reference:Ot,variationPlacements:xt,placements:kt,beforeRead:Lt,read:Dt,afterRead:St,beforeMain:It,main:Nt,afterMain:Pt,beforeWrite:jt,write:Mt,afterWrite:Ht,modifierPhases:$t,applyStyles:Rt,arrow:he,computeStyles:pe,eventListeners:me,flip:Se,hide:Pe,offset:je,popperOffsets:Me,preventOverflow:He},Symbol.toStringTag,{value:"Module"})),Qe="dropdown",Xe="ArrowUp",Ye="ArrowDown",Ue="click.bs.dropdown.data-api",Ge="keydown.bs.dropdown.data-api",Je="show",Ze='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',ti=`${Ze}.show`,ei=".dropdown-menu",ii=p()?"top-end":"top-start",ni=p()?"top-start":"top-end",si=p()?"bottom-end":"bottom-start",oi=p()?"bottom-start":"bottom-end",ri=p()?"left-start":"right-start",ai=p()?"right-start":"left-start",li={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},ci={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class hi extends z{constructor(t,e){super(t,e),this._popper=null,this._parent=this._element.parentNode,this._menu=Q.next(this._element,ei)[0]||Q.prev(this._element,ei)[0]||Q.findOne(ei,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return li}static get DefaultType(){return ci}static get NAME(){return Qe}toggle(){return this._isShown()?this.hide():this.show()}show(){if(l(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!P.trigger(this._element,"show.bs.dropdown",t).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const t of[].concat(...document.body.children))P.on(t,"mouseover",h);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Je),this._element.classList.add(Je),P.trigger(this._element,"shown.bs.dropdown",t)}}hide(){if(l(this._element)||!this._isShown())return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){if(!P.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented){if("ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.off(t,"mouseover",h);this._popper&&this._popper.destroy(),this._menu.classList.remove(Je),this._element.classList.remove(Je),this._element.setAttribute("aria-expanded","false"),B.removeDataAttribute(this._menu,"popper"),P.trigger(this._element,"hidden.bs.dropdown",t)}}_getConfig(t){if("object"==typeof(t=super._getConfig(t)).reference&&!o(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${Qe.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(){if(void 0===Ke)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let t=this._element;"parent"===this._config.reference?t=this._parent:o(this._config.reference)?t=r(this._config.reference):"object"==typeof this._config.reference&&(t=this._config.reference);const e=this._getPopperConfig();this._popper=Ve(t,this._menu,e)}_isShown(){return this._menu.classList.contains(Je)}_getPlacement(){const t=this._parent;if(t.classList.contains("dropend"))return ri;if(t.classList.contains("dropstart"))return ai;if(t.classList.contains("dropup-center"))return"top";if(t.classList.contains("dropdown-center"))return"bottom";const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?ni:ii:e?oi:si}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(B.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=Q.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((t=>a(t)));i.length&&b(i,e,t===Ye,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;const e=Q.find(ti);for(const i of e){const e=hi.getInstance(i);if(!e||!1===e._config.autoClose)continue;const n=t.composedPath(),s=n.includes(e._menu);if(n.includes(e._element)||"inside"===e._config.autoClose&&!s||"outside"===e._config.autoClose&&s)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const o={relatedTarget:e._element};"click"===t.type&&(o.clickEvent=t),e._completeHide(o)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),i="Escape"===t.key,n=[Xe,Ye].includes(t.key);if(!n&&!i)return;if(e&&!i)return;t.preventDefault();const s=this.matches(Ze)?this:Q.prev(this,Ze)[0]||Q.next(this,Ze)[0]||Q.findOne(Ze,t.delegateTarget.parentNode),o=hi.getOrCreateInstance(s);if(n)return t.stopPropagation(),o.show(),void o._selectMenuItem(t);o._isShown()&&(t.stopPropagation(),o.hide(),s.focus())}}P.on(document,Ge,Ze,hi.dataApiKeydownHandler),P.on(document,Ge,ei,hi.dataApiKeydownHandler),P.on(document,Ue,hi.clearMenus),P.on(document,"keyup.bs.dropdown.data-api",hi.clearMenus),P.on(document,Ue,Ze,(function(t){t.preventDefault(),hi.getOrCreateInstance(this).toggle()})),g(hi);const di=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",ui=".sticky-top",fi="padding-right",pi="margin-right";class gi{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,fi,(e=>e+t)),this._setElementAttributes(di,fi,(e=>e+t)),this._setElementAttributes(ui,pi,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,fi),this._resetElementAttributes(di,fi),this._resetElementAttributes(ui,pi)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${i(Number.parseFloat(s))}px`)}))}_saveInitialAttribute(t,e){const i=t.style.getPropertyValue(e);i&&B.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=B.getDataAttribute(t,e);null!==i?(B.removeDataAttribute(t,e),t.style.setProperty(e,i)):t.style.removeProperty(e)}))}_applyManipulationCallback(t,e){if(o(t))e(t);else for(const i of Q.find(t,this._element))e(i)}}const mi="show",_i="mousedown.bs.backdrop",bi={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},vi={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class yi extends F{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return bi}static get DefaultType(){return vi}static get NAME(){return"backdrop"}show(t){if(!this._config.isVisible)return void m(t);this._append();const e=this._getElement();this._config.isAnimated&&d(e),e.classList.add(mi),this._emulateAnimation((()=>{m(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(mi),this._emulateAnimation((()=>{this.dispose(),m(t)}))):m(t)}dispose(){this._isAppended&&(P.off(this._element,_i),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=r(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),P.on(t,_i,(()=>{m(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){_(t,this._getElement(),this._config.isAnimated)}}const wi=".bs.focustrap",Ai="backward",Ei={autofocus:!0,trapElement:null},Ti={autofocus:"boolean",trapElement:"element"};class Ci extends F{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Ei}static get DefaultType(){return Ti}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),P.off(document,wi),P.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),P.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,P.off(document,wi))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const i=Q.focusableChildren(e);0===i.length?e.focus():this._lastTabNavDirection===Ai?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Ai:"forward")}}const Oi="hidden.bs.modal",xi="show.bs.modal",ki="modal-open",Li="show",Di="modal-static",Si={backdrop:!0,focus:!0,keyboard:!0},Ii={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Ni extends z{constructor(t,e){super(t,e),this._dialog=Q.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new gi,this._addEventListeners()}static get Default(){return Si}static get DefaultType(){return Ii}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||P.trigger(this._element,xi,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(ki),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(P.trigger(this._element,"hide.bs.modal").defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(Li),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){for(const t of[window,this._dialog])P.off(t,".bs.modal");this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new yi({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=Q.findOne(".modal-body",this._dialog);e&&(e.scrollTop=0),d(this._element),this._element.classList.add(Li),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,P.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,this._isAnimated())}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.modal",(t=>{if("Escape"===t.key)return this._config.keyboard?(t.preventDefault(),void this.hide()):void this._triggerBackdropTransition()})),P.on(window,"resize.bs.modal",(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),P.on(this._element,"mousedown.dismiss.bs.modal",(t=>{P.one(this._element,"click.dismiss.bs.modal",(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(ki),this._resetAdjustments(),this._scrollBar.reset(),P.trigger(this._element,Oi)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(P.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(Di)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(Di),this._queueCallback((()=>{this._element.classList.remove(Di),this._queueCallback((()=>{this._element.style.overflowY=e}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;if(i&&!t){const t=p()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!i&&t){const t=p()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=Ni.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}P.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=n(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),P.one(e,xi,(t=>{t.defaultPrevented||P.one(e,Oi,(()=>{a(this)&&this.focus()}))}));const i=Q.findOne(".modal.show");i&&Ni.getInstance(i).hide(),Ni.getOrCreateInstance(e).toggle(this)})),q(Ni),g(Ni);const Pi="show",ji="showing",Mi="hiding",Hi=".offcanvas.show",$i="hidePrevented.bs.offcanvas",Wi="hidden.bs.offcanvas",Bi={backdrop:!0,keyboard:!0,scroll:!1},Fi={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class zi extends z{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return Bi}static get DefaultType(){return Fi}static get NAME(){return"offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||P.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._backdrop.show(),this._config.scroll||(new gi).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(ji),this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(Pi),this._element.classList.remove(ji),P.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&(P.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(Mi),this._backdrop.hide(),this._queueCallback((()=>{this._element.classList.remove(Pi,Mi),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new gi).reset(),P.trigger(this._element,Wi)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=Boolean(this._config.backdrop);return new yi({className:"offcanvas-backdrop",isVisible:t,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:t?()=>{"static"!==this._config.backdrop?this.hide():P.trigger(this._element,$i)}:null})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():P.trigger(this._element,$i))}))}static jQueryInterface(t){return this.each((function(){const e=zi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}P.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=n(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this))return;P.one(e,Wi,(()=>{a(this)&&this.focus()}));const i=Q.findOne(Hi);i&&i!==e&&zi.getInstance(i).hide(),zi.getOrCreateInstance(e).toggle(this)})),P.on(window,"load.bs.offcanvas.data-api",(()=>{for(const t of Q.find(Hi))zi.getOrCreateInstance(t).show()})),P.on(window,"resize.bs.offcanvas",(()=>{for(const t of Q.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&zi.getOrCreateInstance(t).hide()})),q(zi),g(zi);const qi=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Ri=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Vi=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Ki=(t,e)=>{const i=t.nodeName.toLowerCase();return e.includes(i)?!qi.has(i)||Boolean(Ri.test(t.nodeValue)||Vi.test(t.nodeValue)):e.filter((t=>t instanceof RegExp)).some((t=>t.test(i)))},Qi={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Xi={allowList:Qi,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"<div></div>"},Yi={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},Ui={entry:"(string|element|function|null)",selector:"(string|element)"};class Gi extends F{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return Xi}static get DefaultType(){return Yi}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((t=>this._resolvePossibleFunction(t))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,i]of Object.entries(this._config.content))this._setContent(t,i,e);const e=t.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&e.classList.add(...i.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,i]of Object.entries(t))super._typeCheckConfig({selector:e,entry:i},Ui)}_setContent(t,e,i){const n=Q.findOne(i,t);n&&((e=this._resolvePossibleFunction(e))?o(e)?this._putElementInTemplate(r(e),n):this._config.html?n.innerHTML=this._maybeSanitize(e):n.textContent=e:n.remove())}_maybeSanitize(t){return this._config.sanitize?function(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const n=(new window.DOMParser).parseFromString(t,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(const t of s){const i=t.nodeName.toLowerCase();if(!Object.keys(e).includes(i)){t.remove();continue}const n=[].concat(...t.attributes),s=[].concat(e["*"]||[],e[i]||[]);for(const e of n)Ki(e,s)||t.removeAttribute(e.nodeName)}return n.body.innerHTML}(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return"function"==typeof t?t(this):t}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const Ji=new Set(["sanitize","allowList","sanitizeFn"]),Zi="fade",tn="show",en=".modal",nn="hide.bs.modal",sn="hover",on="focus",rn={AUTO:"auto",TOP:"top",RIGHT:p()?"left":"right",BOTTOM:"bottom",LEFT:p()?"right":"left"},an={allowList:Qi,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,0],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',title:"",trigger:"hover focus"},ln={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class cn extends z{constructor(t,e){if(void 0===Ke)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return an}static get DefaultType(){return ln}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),P.off(this._element.closest(en),nn,this._hideModalHandler),this.tip&&this.tip.remove(),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=P.trigger(this._element,this.constructor.eventName("show")),e=(c(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this.tip&&(this.tip.remove(),this.tip=null);const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:n}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(n.append(i),P.trigger(this._element,this.constructor.eventName("inserted"))),this._popper?this._popper.update():this._popper=this._createPopper(i),i.classList.add(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.on(t,"mouseover",h);this._queueCallback((()=>{P.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(P.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;const t=this._getTipElement();if(t.classList.remove(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.off(t,"mouseover",h);this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this._isHovered=null,this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||t.remove(),this._element.removeAttribute("aria-describedby"),P.trigger(this._element,this.constructor.eventName("hidden")),this._disposePopper())}),this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(Zi,tn),e.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME).toString();return e.setAttribute("id",i),this._isAnimated()&&e.classList.add(Zi),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new Gi({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Zi)}_isShown(){return this.tip&&this.tip.classList.contains(tn)}_createPopper(t){const e="function"==typeof this._config.placement?this._config.placement.call(this,t,this._element):this._config.placement,i=rn[e.toUpperCase()];return Ve(this._element,t,this._getPopperConfig(i))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return"function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)P.on(this._element,this.constructor.eventName("click"),this._config.selector,(t=>{this._initializeOnDelegatedTarget(t).toggle()}));else if("manual"!==e){const t=e===sn?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=e===sn?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");P.on(this._element,t,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?on:sn]=!0,e._enter()})),P.on(this._element,i,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?on:sn]=e._element.contains(t.relatedTarget),e._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},P.on(this._element.closest(en),nn,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=B.getDataAttributes(this._element);for(const t of Object.keys(e))Ji.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:r(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(t){return this.each((function(){const e=cn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(cn);const hn={...cn.Default,content:"",offset:[0,8],placement:"right",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',trigger:"click"},dn={...cn.DefaultType,content:"(null|string|element|function)"};class un extends cn{static get Default(){return hn}static get DefaultType(){return dn}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each((function(){const e=un.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(un);const fn="click.bs.scrollspy",pn="active",gn="[href]",mn={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},_n={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class bn extends z{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return mn}static get DefaultType(){return _n}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=r(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map((t=>Number.parseFloat(t)))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(P.off(this._config.target,fn),P.on(this._config.target,fn,gn,(t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const i=this._rootElement||window,n=e.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:n,behavior:"smooth"});i.scrollTop=n}})))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((t=>this._observerCallback(t)),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),i=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},n=(this._rootElement||document.documentElement).scrollTop,s=n>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=n;for(const o of t){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(o));continue}const t=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(s&&t){if(i(o),!n)return}else s||t||i(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=Q.find(gn,this._config.target);for(const e of t){if(!e.hash||l(e))continue;const t=Q.findOne(e.hash,this._element);a(t)&&(this._targetLinks.set(e.hash,e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(pn),this._activateParents(t),P.trigger(this._element,"activate.bs.scrollspy",{relatedTarget:t}))}_activateParents(t){if(t.classList.contains("dropdown-item"))Q.findOne(".dropdown-toggle",t.closest(".dropdown")).classList.add(pn);else for(const e of Q.parents(t,".nav, .list-group"))for(const t of Q.prev(e,".nav-link, .nav-item > .nav-link, .list-group-item"))t.classList.add(pn)}_clearActiveClass(t){t.classList.remove(pn);const e=Q.find("[href].active",t);for(const t of e)t.classList.remove(pn)}static jQueryInterface(t){return this.each((function(){const e=bn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(window,"load.bs.scrollspy.data-api",(()=>{for(const t of Q.find('[data-bs-spy="scroll"]'))bn.getOrCreateInstance(t)})),g(bn);const vn="ArrowLeft",yn="ArrowRight",wn="ArrowUp",An="ArrowDown",En="active",Tn="fade",Cn="show",On='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',xn=`.nav-link:not(.dropdown-toggle), .list-group-item:not(.dropdown-toggle), [role="tab"]:not(.dropdown-toggle), ${On}`;class kn extends z{constructor(t){super(t),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),P.on(this._element,"keydown.bs.tab",(t=>this._keydown(t))))}static get NAME(){return"tab"}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),i=e?P.trigger(e,"hide.bs.tab",{relatedTarget:t}):null;P.trigger(t,"show.bs.tab",{relatedTarget:e}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){t&&(t.classList.add(En),this._activate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),P.trigger(t,"shown.bs.tab",{relatedTarget:e})):t.classList.add(Cn)}),t,t.classList.contains(Tn)))}_deactivate(t,e){t&&(t.classList.remove(En),t.blur(),this._deactivate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),P.trigger(t,"hidden.bs.tab",{relatedTarget:e})):t.classList.remove(Cn)}),t,t.classList.contains(Tn)))}_keydown(t){if(![vn,yn,wn,An].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=[yn,An].includes(t.key),i=b(this._getChildren().filter((t=>!l(t))),t.target,e,!0);i&&(i.focus({preventScroll:!0}),kn.getOrCreateInstance(i).show())}_getChildren(){return Q.find(xn,this._parent)}_getActiveElem(){return this._getChildren().find((t=>this._elemIsActive(t)))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),i=this._getOuterElement(t);t.setAttribute("aria-selected",e),i!==t&&this._setAttributeIfNotExists(i,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=n(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`#${t.id}`))}_toggleDropDown(t,e){const i=this._getOuterElement(t);if(!i.classList.contains("dropdown"))return;const n=(t,n)=>{const s=Q.findOne(t,i);s&&s.classList.toggle(n,e)};n(".dropdown-toggle",En),n(".dropdown-menu",Cn),i.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}_elemIsActive(t){return t.classList.contains(En)}_getInnerElement(t){return t.matches(xn)?t:Q.findOne(xn,t)}_getOuterElement(t){return t.closest(".nav-item, .list-group-item")||t}static jQueryInterface(t){return this.each((function(){const e=kn.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(document,"click.bs.tab",On,(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this)||kn.getOrCreateInstance(this).show()})),P.on(window,"load.bs.tab",(()=>{for(const t of Q.find('.active[data-bs-toggle="tab"], .active[data-bs-toggle="pill"], .active[data-bs-toggle="list"]'))kn.getOrCreateInstance(t)})),g(kn);const Ln="hide",Dn="show",Sn="showing",In={animation:"boolean",autohide:"boolean",delay:"number"},Nn={animation:!0,autohide:!0,delay:5e3};class Pn extends z{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Nn}static get DefaultType(){return In}static get NAME(){return"toast"}show(){P.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Ln),d(this._element),this._element.classList.add(Dn,Sn),this._queueCallback((()=>{this._element.classList.remove(Sn),P.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this.isShown()&&(P.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(Sn),this._queueCallback((()=>{this._element.classList.add(Ln),this._element.classList.remove(Sn,Dn),P.trigger(this._element,"hidden.bs.toast")}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Dn),super.dispose()}isShown(){return this._element.classList.contains(Dn)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){P.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),P.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Pn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return q(Pn),g(Pn),{Alert:R,Button:K,Carousel:at,Collapse:pt,Dropdown:hi,Modal:Ni,Offcanvas:zi,Popover:un,ScrollSpy:bn,Tab:kn,Toast:Pn,Tooltip:cn}}));
  7. //# sourceMappingURL=bootstrap.bundle.min.js.map
  8. (function webpackUniversalModuleDefinition(root, factory) {
  9. if(typeof exports === 'object' && typeof module === 'object')
  10. module.exports = factory();
  11. else if(typeof define === 'function' && define.amd)
  12. define("Amplitude", [], factory);
  13. else if(typeof exports === 'object')
  14. exports["Amplitude"] = factory();
  15. else
  16. root["Amplitude"] = factory();
  17. })(this, function() {
  18. return /******/ (function(modules) { // webpackBootstrap
  19. /******/ // The module cache
  20. /******/ var installedModules = {};
  21. /******/
  22. /******/ // The require function
  23. /******/ function __webpack_require__(moduleId) {
  24. /******/
  25. /******/ // Check if module is in cache
  26. /******/ if(installedModules[moduleId]) {
  27. /******/ return installedModules[moduleId].exports;
  28. /******/ }
  29. /******/ // Create a new module (and put it into the cache)
  30. /******/ var module = installedModules[moduleId] = {
  31. /******/ i: moduleId,
  32. /******/ l: false,
  33. /******/ exports: {}
  34. /******/ };
  35. /******/
  36. /******/ // Execute the module function
  37. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  38. /******/
  39. /******/ // Flag the module as loaded
  40. /******/ module.l = true;
  41. /******/
  42. /******/ // Return the exports of the module
  43. /******/ return module.exports;
  44. /******/ }
  45. /******/
  46. /******/
  47. /******/ // expose the modules object (__webpack_modules__)
  48. /******/ __webpack_require__.m = modules;
  49. /******/
  50. /******/ // expose the module cache
  51. /******/ __webpack_require__.c = installedModules;
  52. /******/
  53. /******/ // identity function for calling harmony imports with the correct context
  54. /******/ __webpack_require__.i = function(value) { return value; };
  55. /******/
  56. /******/ // define getter function for harmony exports
  57. /******/ __webpack_require__.d = function(exports, name, getter) {
  58. /******/ if(!__webpack_require__.o(exports, name)) {
  59. /******/ Object.defineProperty(exports, name, {
  60. /******/ configurable: false,
  61. /******/ enumerable: true,
  62. /******/ get: getter
  63. /******/ });
  64. /******/ }
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "";
  81. /******/
  82. /******/ // Load entry module and return exports
  83. /******/ return __webpack_require__(__webpack_require__.s = 47);
  84. /******/ })
  85. /************************************************************************/
  86. /******/ ([
  87. /* 0 */
  88. /***/ (function(module, exports, __webpack_require__) {
  89. "use strict";
  90. var _package = __webpack_require__(59);
  91. module.exports = {
  92. version: _package.version,
  93. audio: new Audio(),
  94. active_metadata: {},
  95. active_album: "",
  96. active_index: 0,
  97. active_playlist: null,
  98. playback_speed: 1.0,
  99. callbacks: {},
  100. songs: [],
  101. playlists: {},
  102. start_song: "",
  103. starting_playlist: "",
  104. starting_playlist_song: "",
  105. repeat: false,
  106. repeat_song: false,
  107. shuffle_list: {},
  108. shuffle_on: false,
  109. default_album_art: "",
  110. default_playlist_art: "",
  111. debug: false,
  112. volume: 0.5,
  113. pre_mute_volume: 0.5,
  114. volume_increment: 5,
  115. volume_decrement: 5,
  116. soundcloud_client: "",
  117. soundcloud_use_art: false,
  118. soundcloud_song_count: 0,
  119. soundcloud_songs_ready: 0,
  120. is_touch_moving: false,
  121. buffered: 0,
  122. bindings: {},
  123. continue_next: true,
  124. delay: 0,
  125. player_state: "stopped",
  126. web_audio_api_available: false,
  127. context: null,
  128. source: null,
  129. analyser: null,
  130. visualizations: {
  131. available: [],
  132. active: [],
  133. backup: ""
  134. },
  135. waveforms: {
  136. sample_rate: 100,
  137. built: []
  138. }
  139. }; /**
  140. * These variables make Amplitude run. The config is the most important
  141. * containing active settings and parameters.
  142. *
  143. * The config JSON is the global settings for ALL of Amplitude functions.
  144. * This is global and contains all of the user preferences. The default
  145. * settings are set, and the user overwrites them when they initialize
  146. * Amplitude.
  147. *
  148. * @module config
  149. * @type {object}
  150. * @property {string} config.version - The current version of AmplitudeJS.
  151. * @property {object} config.audio - Handles all of the audio.
  152. * @property {object} config.active_metadata - Contains the active metadata for the song.
  153. * @property {string} config.active_album - Holds the active album name. Used to check and see if the album changed and run the album changed callback.
  154. * @property {number} config.active_index - Contains the index of the actively playing song.
  155. * @property {string} config.active_playlist - Contains the key to the active playlist index.
  156. * @property {number} config.playback_speed - Sets the initial playback speed of the song. The values for this can be 1.0, 1.5, 2.0
  157. * @property {object} config.callbacks - The user can pass a JSON object with a key => value store of callbacks to be run at certain events.
  158. * @property {array} config.songs - Contains all of the songs the user has passed to Amplitude to use.
  159. * @property {object} config.playlists - Contains all of the playlists the user created.
  160. * @property {object} config.start_song - The index of the song that AmplitudeJS should start with.
  161. * @property {string} config.starting_playlist - The starting playlist the player will intiialize to.
  162. * @property {string} config.starting_playlist_song - The index of the song in the playlist that should be started.
  163. * @property {boolean} config.repeat - When repeat is on, when the song ends the song will replay itself.
  164. * @property {object} config.shuffle_list - When shuffled, gets populated with the songs the user provided in a random order.
  165. * @property {boolean} config.shuffle_on - When on, gets set to true so when traversing through songs, AmplitudeJS knows whether or not to use the songs object or the shuffle_list
  166. * @property {string} config.default_album_art - The user can set default album art to be displayed if the song they set doesn't contain album art.
  167. * @property {string} config.default_playlist_art - The user can set default playlist art to be displayed if the playlist they are setting meta data for doesn't contain an art picture.
  168. * @property {boolean} config.debug - When set to true, AmplitudeJS will print to the console any errors providing helpful feedback to the user.
  169. * @property {number} config.volume - The user can set the initial volume to a number between 0 and 1 over-riding the default of .5
  170. * @property {number} config.pre_mute_volume - This is set on mute so that when a user un-mutes AmplitudeJS knows what to restore the volume to.
  171. * @property {number} config.volume_increment - The default values are an integer between 1 and 100 for how much the volume should increase when the user presses the volume up button.
  172. * @property {number} config.volume_decrement - The default values are an integer between 1 and 100 for how much the volume should decrease when the user presses the volume down button.
  173. * @property {string} config.soundcloud_client - When using SoundCloud, the user will have to provide their API Client ID
  174. * @property {boolean} config.soundcloud_use_art - The user can set this to true and AmplitudeJS will use the album art for the song returned from the Soundcloud API
  175. * @property {number} config.soundcloud_song_count - Used on config to count how many songs are from Soundcloud and compare it to how many are ready for when to move to the rest of the configuration
  176. * @property {number} config.soundcloud_songs_ready - Used on config to count how many songs are ready so when we get all of the data from the SoundCloud API that we need this should match the SoundCloud song count meaning we can move to the rest of the config.
  177. * @property {integer} config.is_touch_moving - Flag for if the user is moving the screen.
  178. * @property {boolean} config.buffered - How much of the song is buffered.
  179. * @property {object} config.bindings - Array of bindings to certain key events.
  180. * @property {boolean} config.continue_next - Determines when a song ends, we should continue to the next song.
  181. * @property {number} config.delay - Sets the delay between songs in MS.
  182. * @property {boolean} config.use_web_audio_api - Flag that determines if the user wants to use Web Audio API Components.
  183. * @property {boolean} config.web_audio_api_available - Flag that determines if the Web Audio API is available.
  184. * @property {object} config.context - Web Audio API Context
  185. * @property {object} config.source - Web Audio API Source
  186. * @property {object} config.analyser - Web Audio API Analyser
  187. * @property {string} config.player_state - The current state of the player.
  188. */
  189. /***/ }),
  190. /* 1 */
  191. /***/ (function(module, exports, __webpack_require__) {
  192. "use strict";
  193. Object.defineProperty(exports, "__esModule", {
  194. value: true
  195. });
  196. var _config = __webpack_require__(0);
  197. var _config2 = _interopRequireDefault(_config);
  198. var _checks = __webpack_require__(5);
  199. var _checks2 = _interopRequireDefault(_checks);
  200. var _audioNavigation = __webpack_require__(3);
  201. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  202. var _playPauseElements = __webpack_require__(2);
  203. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  204. var _metaDataElements = __webpack_require__(7);
  205. var _metaDataElements2 = _interopRequireDefault(_metaDataElements);
  206. var _callbacks = __webpack_require__(9);
  207. var _callbacks2 = _interopRequireDefault(_callbacks);
  208. var _debug = __webpack_require__(4);
  209. var _debug2 = _interopRequireDefault(_debug);
  210. var _visualizations = __webpack_require__(16);
  211. var _visualizations2 = _interopRequireDefault(_visualizations);
  212. var _configState = __webpack_require__(6);
  213. var _configState2 = _interopRequireDefault(_configState);
  214. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  215. /**
  216. * Interacts directly with native functions of the Audio element. Logic
  217. * leading up to these methods are handled by click handlers which call
  218. * helpers and visual synchronizers. These are the core functions of AmplitudeJS.
  219. * Every other function that leads to these prepare the information to be
  220. * acted upon by these functions.
  221. *
  222. * @module core/Core
  223. */
  224. /**
  225. * Import the Visualizations from the FX module.
  226. * @module fx/visualizations
  227. */
  228. /**
  229. * Imports AmplitudeJS Callback Utility
  230. * @module utilities/callbacks
  231. */
  232. /**
  233. * Imports the Play/Pause Visual Elements module.
  234. * @module visual/playPauseElements
  235. */
  236. /**
  237. * Imports the Checks module.
  238. * @module utilities/checks
  239. */
  240. var Core = function () {
  241. /**
  242. * Plays the active song. If the current song is live, it reconnects
  243. * the stream before playing.
  244. *
  245. * Public Accessor: Amplitude.play()
  246. *
  247. * @access public
  248. */
  249. function play() {
  250. _visualizations2.default.stop();
  251. _visualizations2.default.run();
  252. /*
  253. If the audio is live we re-conenct the stream.
  254. */
  255. if (_config2.default.active_metadata.live) {
  256. reconnectStream();
  257. }
  258. /*
  259. Mobile remote sources need to be reconnected on play. I think this is
  260. because mobile browsers are optimized not to load all resources
  261. for speed reasons. We only do this if mobile and the paused button
  262. is not clicked. If the pause button was clicked then we don't reconnect
  263. or the user will lose their place in the stream.
  264. */
  265. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && !_config2.default.paused) {
  266. reconnectStream();
  267. }
  268. /*
  269. Play the song and set the playback rate to the playback
  270. speed.
  271. */
  272. var playPromise = _config2.default.audio.play();
  273. if (playPromise !== undefined) {
  274. playPromise.then(function (_) {}).catch(function (error) {});
  275. }
  276. _config2.default.audio.play();
  277. _config2.default.audio.playbackRate = _config2.default.playback_speed;
  278. /*
  279. Sets the state of the player.
  280. */
  281. _configState2.default.setPlayerState();
  282. }
  283. /**
  284. * Pauses the active song. If it's live, it disconnects the stream.
  285. *
  286. * Public Accessor: Amplitude.pause()
  287. *
  288. * @access public
  289. */
  290. function pause() {
  291. _visualizations2.default.stop();
  292. /*
  293. Pause the active song.
  294. */
  295. _config2.default.audio.pause();
  296. /*
  297. Flag that pause button was clicked.
  298. */
  299. _config2.default.paused = true;
  300. /*
  301. If the song is live, we disconnect the stream so we aren't
  302. saving it to memory.
  303. */
  304. if (_config2.default.active_metadata.live) {
  305. disconnectStream();
  306. }
  307. /*
  308. Sets the state of the player.
  309. */
  310. _configState2.default.setPlayerState();
  311. }
  312. /**
  313. * Stops the active song by setting the current song time to 0.
  314. * When the user resumes, it will be from the beginning.
  315. * If it's a live stream it disconnects.
  316. *
  317. * Public Accessor: Amplitude.stop()
  318. *
  319. * @access public
  320. */
  321. function stop() {
  322. _visualizations2.default.stop();
  323. /*
  324. Set the current time of the song to 0 which will reset the song.
  325. */
  326. if (_config2.default.audio.currentTime != 0) {
  327. _config2.default.audio.currentTime = 0;
  328. }
  329. /*
  330. Run pause so the song will stop
  331. */
  332. _config2.default.audio.pause();
  333. /*
  334. If the song is live, disconnect the stream.
  335. */
  336. if (_config2.default.active_metadata.live) {
  337. disconnectStream();
  338. }
  339. /*
  340. Sets the state of the player.
  341. */
  342. _configState2.default.setPlayerState();
  343. /*
  344. Run the stop callback
  345. */
  346. _callbacks2.default.run("stop");
  347. }
  348. /**
  349. * Sets the song volume.
  350. *
  351. * Public Accessor: Amplitude.setVolume( volumeLevel )
  352. *
  353. * @access public
  354. * @param {number} volumeLevel - A number between 1 and 100 as a percentage of
  355. * min to max for a volume level.
  356. */
  357. function setVolume(volumeLevel) {
  358. /*
  359. If the volume is set to mute somewhere else, we sync the display.
  360. */
  361. if (volumeLevel == 0) {
  362. _config2.default.audio.muted = true;
  363. } else {
  364. _config2.default.audio.muted = false;
  365. }
  366. /*
  367. Sets the volume in the config so we can reference it later on.
  368. */
  369. _config2.default.volume = volumeLevel;
  370. /*
  371. Set the volume of the active song.
  372. */
  373. _config2.default.audio.volume = volumeLevel / 100;
  374. }
  375. /**
  376. * Sets the song percentage. If it's a live song, we ignore this because
  377. * we can't skip ahead. This is an issue if you have a playlist with
  378. * a live source.
  379. *
  380. * Public Accessor: Amplitude.setSongLocation( songPercentage )
  381. *
  382. * @access public
  383. * @param {number} songPercentage - A number between 1 and 100 as a percentage of song completion.
  384. */
  385. function setSongLocation(songPercentage) {
  386. /*
  387. As long as the song is not live, we can set the current time of the
  388. song to the percentage the user passed in.
  389. */
  390. if (!_config2.default.active_metadata.live) {
  391. _config2.default.audio.currentTime = _config2.default.audio.duration * (songPercentage / 100);
  392. }
  393. }
  394. /**
  395. * Skips to a location in a song
  396. *
  397. * Public Accessor: Amplitude.skipToLocation( seconds )
  398. *
  399. * @access public
  400. * @param {number} seconds - An integer containing the seconds to skip to
  401. */
  402. function skipToLocation(seconds) {
  403. /*
  404. When the active song can be played through, we can check to
  405. see if the seconds will work. We only bind the event handler
  406. once and remove it once it's fired.
  407. */
  408. _config2.default.audio.addEventListener("canplaythrough", function () {
  409. /*
  410. If the active song duration is greater than or equal to the
  411. amount of seconds the user wants to skip to and the seconds
  412. is greater than 0, we skip to the seconds defined.
  413. */
  414. if (_config2.default.audio.duration >= seconds && seconds > 0) {
  415. _config2.default.audio.currentTime = seconds;
  416. } else {
  417. _debug2.default.writeMessage("Amplitude can't skip to a location greater than the duration of the audio or less than 0");
  418. }
  419. }, { once: true });
  420. }
  421. /**
  422. * Disconnects the live stream
  423. *
  424. * Public Accessor: Amplitude.disconnectStream()
  425. *
  426. * @access public
  427. */
  428. function disconnectStream() {
  429. _config2.default.audio.src = "";
  430. _config2.default.audio.load();
  431. }
  432. /**
  433. * Reconnects the live stream
  434. *
  435. * Public Accessor: Amplitude.reconnectStream()
  436. *
  437. * @access public\
  438. */
  439. function reconnectStream() {
  440. _config2.default.audio.src = _config2.default.active_metadata.url;
  441. _config2.default.audio.load();
  442. }
  443. /**
  444. * Sets the playback speed for the song.
  445. *
  446. * @param {number} playbackSpeed The speed we want the song to play back at.
  447. */
  448. function setPlaybackSpeed(playbackSpeed) {
  449. /*
  450. Set the config playback speed.
  451. */
  452. _config2.default.playback_speed = playbackSpeed;
  453. /*
  454. Set the active song playback rate.
  455. */
  456. _config2.default.audio.playbackRate = _config2.default.playback_speed;
  457. }
  458. /*
  459. Return publically facing functions
  460. */
  461. return {
  462. play: play,
  463. pause: pause,
  464. stop: stop,
  465. setVolume: setVolume,
  466. setSongLocation: setSongLocation,
  467. skipToLocation: skipToLocation,
  468. disconnectStream: disconnectStream,
  469. reconnectStream: reconnectStream,
  470. setPlaybackSpeed: setPlaybackSpeed
  471. };
  472. }();
  473. /**
  474. * Import the Config State module.
  475. * @module utilities/configState
  476. */
  477. /**
  478. * Imports AmplitudeJS Debug Utility
  479. * @module utilities/debug
  480. */
  481. /**
  482. * Imports the Meta Data Visual Elements module.
  483. * @module visual/metaDataElements
  484. */
  485. /**
  486. * Imports the Audio Navigation module.
  487. * @module utilities/audioNavigation
  488. */
  489. /**
  490. * Imports the config module
  491. * @module config
  492. */
  493. exports.default = Core;
  494. module.exports = exports["default"];
  495. /***/ }),
  496. /* 2 */
  497. /***/ (function(module, exports, __webpack_require__) {
  498. "use strict";
  499. Object.defineProperty(exports, "__esModule", {
  500. value: true
  501. });
  502. var _config = __webpack_require__(0);
  503. var _config2 = _interopRequireDefault(_config);
  504. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  505. /**
  506. * Defines the visual representation of AmplitudeJS play pause elements.
  507. * @module visual/PlayPauseElements
  508. */
  509. var PlayPauseElements = function () {
  510. /**
  511. * Syncs all play pause elements.
  512. *
  513. * @access public
  514. */
  515. function sync() {
  516. syncGlobal();
  517. syncPlaylist();
  518. syncSong();
  519. syncSongInPlaylist();
  520. }
  521. /**
  522. * Syncs the global play pause buttons to the state of the active song.
  523. *
  524. * @access public
  525. */
  526. function syncGlobal() {
  527. /*
  528. Get the active song state.
  529. */
  530. var state = _config2.default.audio.paused ? "paused" : "playing";
  531. /*
  532. Get all play pause buttons.
  533. */
  534. var playPauseElements = document.querySelectorAll(".amplitude-play-pause");
  535. /*
  536. Iterate over all of the play pause elements syncing the
  537. display visually.
  538. */
  539. for (var i = 0; i < playPauseElements.length; i++) {
  540. /*
  541. Grab the playlist and song attributes from the element.
  542. */
  543. var playlist = playPauseElements[i].getAttribute("data-amplitude-playlist");
  544. var song = playPauseElements[i].getAttribute("data-amplitude-song-index");
  545. /*
  546. This method is responsible for only the global elements,
  547. so we make sure there are no playlist or songs defined on
  548. the element.
  549. */
  550. if (playlist == null && song == null) {
  551. /*
  552. Determines what classes we should add and remove
  553. from the elements.
  554. */
  555. switch (state) {
  556. case "playing":
  557. setElementPlay(playPauseElements[i]);
  558. break;
  559. case "paused":
  560. setElementPause(playPauseElements[i]);
  561. break;
  562. }
  563. }
  564. }
  565. }
  566. /**
  567. * Syncs the main playlist play pause buttons to the state of the active song.
  568. *
  569. * @access public
  570. */
  571. function syncPlaylist() {
  572. var state = _config2.default.audio.paused ? "paused" : "playing";
  573. /*
  574. Get all of the main playlist play pause elements
  575. */
  576. var playlistPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  577. /*
  578. Iterate over the play pause elements, syncing the state accordingly.
  579. */
  580. for (var i = 0; i < playlistPlayPauseElements.length; i++) {
  581. /*
  582. Grab the song attributes from the element.
  583. */
  584. var song = playlistPlayPauseElements[i].getAttribute("data-amplitude-song-index");
  585. /*
  586. We want only the play pause elements for the main on a
  587. playlist nothing else. We have another method for the
  588. song in playlist play pause method.
  589. */
  590. if (song == null) {
  591. /*
  592. Determines what classes we should add and remove
  593. from the elements.
  594. */
  595. switch (state) {
  596. case "playing":
  597. setElementPlay(playlistPlayPauseElements[i]);
  598. break;
  599. case "paused":
  600. setElementPause(playlistPlayPauseElements[i]);
  601. break;
  602. }
  603. }
  604. }
  605. }
  606. /**
  607. * Syncs the song play pause buttons to the state of the active song.
  608. *
  609. * @access public
  610. */
  611. function syncSong() {
  612. var state = _config2.default.audio.paused ? "paused" : "playing";
  613. /*
  614. Get all of the individual song play pause buttons. These have an
  615. amplitude-song-index that matches the active index attribute.
  616. */
  617. var songPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  618. /*
  619. Iterate over all of the song play pause elements
  620. */
  621. for (var i = 0; i < songPlayPauseElements.length; i++) {
  622. /*
  623. Grab the playlist attributes from the element.
  624. */
  625. var playlist = songPlayPauseElements[i].getAttribute("data-amplitude-playlist");
  626. /*
  627. We want only the song play pause buttons, not ones scoped in a playlist.
  628. */
  629. if (playlist == null) {
  630. /*
  631. Determines what classes we should add and remove
  632. from the elements.
  633. */
  634. switch (state) {
  635. case "playing":
  636. setElementPlay(songPlayPauseElements[i]);
  637. break;
  638. case "paused":
  639. setElementPause(songPlayPauseElements[i]);
  640. break;
  641. }
  642. }
  643. }
  644. }
  645. /**
  646. * Syncs the song in playlist play pause buttons to the state of
  647. * the active song.
  648. *
  649. * @access public
  650. */
  651. function syncSongInPlaylist() {
  652. var state = _config2.default.audio.paused ? "paused" : "playing";
  653. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  654. /*
  655. Get all of the individual song play pause buttons. These have an
  656. amplitude-song-index attribute. Some have amplitude-playlist which
  657. means they are individual songs within a playlist.
  658. */
  659. var songInPlaylistPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[data-amplitude-song-index="' + activePlaylistIndex + '"][data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  660. /*
  661. Iterate over all of the individual play pause elements for songs inspect
  662. a playlist.
  663. */
  664. for (var i = 0; i < songInPlaylistPlayPauseElements.length; i++) {
  665. /*
  666. Determines what classes we should add and remove
  667. from the elements.
  668. */
  669. switch (state) {
  670. case "playing":
  671. setElementPlay(songInPlaylistPlayPauseElements[i]);
  672. break;
  673. case "paused":
  674. setElementPause(songInPlaylistPlayPauseElements[i]);
  675. break;
  676. }
  677. }
  678. }
  679. /**
  680. * Sets all of the play pause buttons to paused.
  681. *
  682. * @access public
  683. */
  684. function syncToPause() {
  685. /*
  686. Gets all of the play pause elements
  687. */
  688. var playPauseElements = document.querySelectorAll(".amplitude-play-pause");
  689. /*
  690. Sets all of the elements to pause
  691. */
  692. for (var i = 0; i < playPauseElements.length; i++) {
  693. setElementPause(playPauseElements[i]);
  694. }
  695. }
  696. /**
  697. * Sets an element to be playing by removing the 'amplitude-paused' class
  698. * and adding the 'amplitude-playing' class
  699. *
  700. * @access public
  701. * @param {element} element - The element getting the playing class added.
  702. */
  703. function setElementPlay(element) {
  704. element.classList.add("amplitude-playing");
  705. element.classList.remove("amplitude-paused");
  706. }
  707. /**
  708. * Sets an element to be paused by adding the 'amplitude-paused' class
  709. * and removing the 'amplitude-playing' class
  710. *
  711. * @access public
  712. * @param {element} element - The element getting the paused class added.
  713. */
  714. function setElementPause(element) {
  715. element.classList.remove("amplitude-playing");
  716. element.classList.add("amplitude-paused");
  717. }
  718. /**
  719. * Returns the public facing methods
  720. */
  721. return {
  722. sync: sync,
  723. syncGlobal: syncGlobal,
  724. syncPlaylist: syncPlaylist,
  725. syncSong: syncSong,
  726. syncSongInPlaylist: syncSongInPlaylist,
  727. syncToPause: syncToPause
  728. };
  729. }(); /**
  730. * Imports the config module
  731. * @module config
  732. */
  733. exports.default = PlayPauseElements;
  734. module.exports = exports["default"];
  735. /***/ }),
  736. /* 3 */
  737. /***/ (function(module, exports, __webpack_require__) {
  738. "use strict";
  739. Object.defineProperty(exports, "__esModule", {
  740. value: true
  741. });
  742. var _config = __webpack_require__(0);
  743. var _config2 = _interopRequireDefault(_config);
  744. var _core = __webpack_require__(1);
  745. var _core2 = _interopRequireDefault(_core);
  746. var _callbacks = __webpack_require__(9);
  747. var _callbacks2 = _interopRequireDefault(_callbacks);
  748. var _checks = __webpack_require__(5);
  749. var _checks2 = _interopRequireDefault(_checks);
  750. var _playPauseElements = __webpack_require__(2);
  751. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  752. var _songSliderElements = __webpack_require__(14);
  753. var _songSliderElements2 = _interopRequireDefault(_songSliderElements);
  754. var _songPlayedProgressElements = __webpack_require__(20);
  755. var _songPlayedProgressElements2 = _interopRequireDefault(_songPlayedProgressElements);
  756. var _timeElements = __webpack_require__(15);
  757. var _timeElements2 = _interopRequireDefault(_timeElements);
  758. var _metaDataElements = __webpack_require__(7);
  759. var _metaDataElements2 = _interopRequireDefault(_metaDataElements);
  760. var _containerElements = __webpack_require__(49);
  761. var _containerElements2 = _interopRequireDefault(_containerElements);
  762. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  763. /**
  764. * AmplitudeJS Audio Navigation Utility.
  765. *
  766. * @module utilities/AudioNavigation
  767. */
  768. /**
  769. * Meta Data Elements Module
  770. *
  771. * @module visual/MetaDataElements
  772. */
  773. /**
  774. * Imports the Song Played Progress Elements Module
  775. *
  776. * @module visual/SongPlayedProgressElements
  777. */
  778. /**
  779. * Imports the Play Pause Elements Module
  780. *
  781. * @module visual/PlayPauseElements
  782. */
  783. /**
  784. * Imports the Callbacks Module
  785. *
  786. * @module utilities/Callbacks
  787. */
  788. /**
  789. * Imports the config module
  790. * @module config
  791. */
  792. var AudioNavigation = function () {
  793. /**
  794. * Sets the next song
  795. *
  796. * @access public
  797. * @param {boolean} [songEnded=false] If the song ended, this is set to true
  798. * so we take into effect the repeat setting.
  799. */
  800. function setNext() {
  801. var songEnded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  802. /*
  803. Initializes the next index variable. This will be the
  804. index of the song that is next.
  805. */
  806. var nextIndex = null;
  807. var nextSong = {};
  808. /*
  809. Ensure we don't loop in the playlist if config.repeat is not true
  810. */
  811. var endOfList = false;
  812. /*
  813. Determines if we are repeating the song or not. If we are repeating,
  814. the next song will be the same song index.
  815. */
  816. if (_config2.default.repeat_song) {
  817. /*
  818. If the playlist is shuffled, get the now playing index.
  819. */
  820. if (_config2.default.shuffle_on) {
  821. nextIndex = _config2.default.shuffle_list[_config2.default.active_index].index;
  822. nextSong = _config2.default.shuffle_list[nextIndex];
  823. } else {
  824. nextIndex = _config2.default.active_index;
  825. nextSong = _config2.default.songs[nextIndex];
  826. }
  827. } else {
  828. /*
  829. If the shuffle is on, we use the shuffled list of
  830. songs to determine our next song.
  831. */
  832. if (_config2.default.shuffle_on) {
  833. /*
  834. If the active shuffle index + 1 is less than the length, then
  835. we use the next shuffle otherwise we go to the beginning
  836. of the shuffle list.
  837. */
  838. if (parseInt(_config2.default.active_index) + 1 < _config2.default.shuffle_list.length) {
  839. /*
  840. Set the next index to be the index of the song in the shuffle list.
  841. */
  842. nextIndex = parseInt(_config2.default.active_index) + 1;
  843. } else {
  844. nextIndex = 0;
  845. endOfList = true;
  846. }
  847. nextSong = _config2.default.shuffle_list[nextIndex];
  848. } else {
  849. /*
  850. If the active index + 1 is less than the length of the songs, then
  851. we use the next song otherwise we go to the beginning of the
  852. song list.
  853. */
  854. if (parseInt(_config2.default.active_index) + 1 < _config2.default.songs.length) {
  855. nextIndex = parseInt(_config2.default.active_index) + 1;
  856. } else {
  857. nextIndex = 0;
  858. endOfList = true;
  859. }
  860. /*
  861. Sets the next index.
  862. */
  863. nextSong = _config2.default.songs[nextIndex];
  864. }
  865. }
  866. /*
  867. Change the song after the next button has been pressed.
  868. */
  869. changeSong(nextSong, nextIndex);
  870. /*
  871. If it's the end of the list and repeat is not on, do nothing.
  872. */
  873. if (endOfList && !_config2.default.repeat) {} else {
  874. /*
  875. If the song has ended and repeat is on, play the song.
  876. */
  877. if (!(songEnded && !_config2.default.repeat && endOfList)) {
  878. _core2.default.play();
  879. }
  880. }
  881. /*
  882. Sync the play pause elements and run the
  883. after next callback.
  884. */
  885. _playPauseElements2.default.sync();
  886. _callbacks2.default.run("next");
  887. /*
  888. If we repeated the song, run the repeat song callback.
  889. */
  890. if (_config2.default.repeat_song) {
  891. _callbacks2.default.run("song_repeated");
  892. }
  893. }
  894. /**
  895. * Sets the next song in a playlist
  896. *
  897. * @param {string} playlist - The playlist being shuffled
  898. * @param {boolean} [songEnded=false] - If the song ended, this is set to true
  899. * so we take into effect the repeat setting.
  900. */
  901. function setNextPlaylist(playlist) {
  902. var songEnded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  903. /*
  904. Initializes the next index
  905. */
  906. var nextIndex = null;
  907. var nextSong = {};
  908. /*
  909. Ensure we don't loop in the playlist if config.repeat is not true
  910. */
  911. var endOfList = false;
  912. /*
  913. If we are repeating the song, then we just start the song over.
  914. */
  915. if (_config2.default.repeat_song) {
  916. /*
  917. If the playlist is shuffled, get the now playing index.
  918. */
  919. if (_config2.default.playlists[playlist].shuffle) {
  920. nextIndex = _config2.default.playlists[playlist].active_index;
  921. nextSong = _config2.default.playlists[playlist].shuffle_list[nextIndex];
  922. } else {
  923. nextIndex = _config2.default.playlists[playlist].active_index;
  924. nextSong = _config2.default.playlists[playlist].songs[nextIndex];
  925. }
  926. } else {
  927. /*
  928. If the playlist is shuffled we get the next index of the playlist.
  929. */
  930. if (_config2.default.playlists[playlist].shuffle) {
  931. /*
  932. If the active shuffle index + 1 is less than the length of the shuffle list,
  933. then we use the next shuffle otherwise we go to the beginning of the shuffle list.
  934. */
  935. if (parseInt(_config2.default.playlists[playlist].active_index) + 1 < _config2.default.playlists[playlist].shuffle_list.length) {
  936. /*
  937. Set the next index to be the index of the song in the shuffle list.
  938. */
  939. nextIndex = _config2.default.playlists[playlist].active_index + 1;
  940. } else {
  941. nextIndex = 0;
  942. endOfList = true;
  943. }
  944. nextSong = _config2.default.playlists[playlist].shuffle_list[nextIndex];
  945. } else {
  946. /*
  947. If the active index +1 is less than the length of the songs in the playlist,
  948. then we use the next song otherwise we go to the beginning of the playlist.
  949. */
  950. if (parseInt(_config2.default.playlists[playlist].active_index) + 1 < _config2.default.playlists[playlist].songs.length) {
  951. nextIndex = parseInt(_config2.default.playlists[playlist].active_index) + 1;
  952. } else {
  953. nextIndex = 0;
  954. endOfList = true;
  955. }
  956. /*
  957. Sets the next song.
  958. */
  959. nextSong = _config2.default.playlists[playlist].songs[nextIndex];
  960. }
  961. }
  962. /*
  963. Sets the active playlist to the playlist we are on.
  964. */
  965. setActivePlaylist(playlist);
  966. /*
  967. Change the song within the playlist.
  968. */
  969. changeSongPlaylist(playlist, nextSong, nextIndex);
  970. /*
  971. If it's the end of the playlist and we aren't repeating, do nothing.
  972. */
  973. if (endOfList && !_config2.default.repeat) {} else {
  974. if (!(songEnded && !_config2.default.repeat && endOfList)) {
  975. _core2.default.play();
  976. }
  977. }
  978. /*
  979. Sync the play pause buttons.
  980. */
  981. _playPauseElements2.default.sync();
  982. _callbacks2.default.run("next");
  983. /*
  984. Repeat the song.
  985. */
  986. if (_config2.default.repeat_song) {
  987. _callbacks2.default.run("song_repeated");
  988. }
  989. }
  990. /**
  991. * Sets the previous song on the global songs array.
  992. *
  993. * @access private
  994. */
  995. function setPrevious() {
  996. /*
  997. Initializes the previous index
  998. */
  999. var previousIndex = null;
  1000. var previousSong = {};
  1001. /*
  1002. If we are repeating the song, then we just start the song over.
  1003. */
  1004. if (_config2.default.repeat_song) {
  1005. /*
  1006. If the config is shuffled, get the now playing index.
  1007. */
  1008. if (_config2.default.shuffle_on) {
  1009. previousIndex = _config2.default.active_index;
  1010. previousSong = _config2.default.shuffle_list[previousIndex];
  1011. } else {
  1012. previousIndex = _config2.default.active_index;
  1013. previousSong = _config2.default.songs[previousIndex];
  1014. }
  1015. } else {
  1016. /*
  1017. Get the previous index. If the previous index will be less than 0, get the
  1018. last song of the array and continue.
  1019. */
  1020. if (parseInt(_config2.default.active_index) - 1 >= 0) {
  1021. previousIndex = parseInt(_config2.default.active_index - 1);
  1022. } else {
  1023. previousIndex = parseInt(_config2.default.songs.length - 1);
  1024. }
  1025. /*
  1026. If the config is shuffled, we grab the song from the shuffle list
  1027. */
  1028. if (_config2.default.shuffle_on) {
  1029. /*
  1030. Grab song from the shuffle list
  1031. */
  1032. previousSong = _config2.default.shuffle_list[previousIndex];
  1033. } else {
  1034. /*
  1035. Grab song from the songs array
  1036. */
  1037. previousSong = _config2.default.songs[previousIndex];
  1038. }
  1039. }
  1040. /*
  1041. Change the song after the next button has been pressed.
  1042. */
  1043. changeSong(previousSong, previousIndex);
  1044. /*
  1045. Play the newest song.
  1046. */
  1047. _core2.default.play();
  1048. /*
  1049. Sync the play pause elements and run the
  1050. after next callback.
  1051. */
  1052. _playPauseElements2.default.sync();
  1053. _callbacks2.default.run("prev");
  1054. /*
  1055. If we repeated the song, run the repeat song callback.
  1056. */
  1057. if (_config2.default.repeat_song) {
  1058. _callbacks2.default.run("song_repeated");
  1059. }
  1060. }
  1061. /**
  1062. * Sets the previous playlist song.
  1063. *
  1064. * @access private
  1065. *
  1066. * @prop {string} playlist - The playlist we are navigating in.
  1067. */
  1068. function setPreviousPlaylist(playlist) {
  1069. /*
  1070. Initializes the previous index
  1071. */
  1072. var previousIndex = null;
  1073. var previousSong = {};
  1074. /*
  1075. If we are repeating the song, then we just start the song over.
  1076. */
  1077. if (_config2.default.repeat_song) {
  1078. /*
  1079. If the playlist is shuffled, get the now playing index.
  1080. */
  1081. if (_config2.default.playlists[playlist].shuffle) {
  1082. previousIndex = _config2.default.playlists[playlist].active_index;
  1083. previousSong = _config2.default.playlists[playlist].shuffle_list[previousIndex];
  1084. } else {
  1085. previousIndex = _config2.default.playlists[playlist].active_index;
  1086. previousSong = _config2.default.playlists[playlist].songs[previousIndex];
  1087. }
  1088. } else {
  1089. /*
  1090. Get the previous index. If the previous index will be less than 0, get the
  1091. last song of the array and continue.
  1092. */
  1093. if (parseInt(_config2.default.playlists[playlist].active_index) - 1 >= 0) {
  1094. previousIndex = parseInt(_config2.default.playlists[playlist].active_index - 1);
  1095. } else {
  1096. previousIndex = parseInt(_config2.default.playlists[playlist].songs.length - 1);
  1097. }
  1098. /*
  1099. If the playlist is shuffled, we grab the song from the shuffle list
  1100. */
  1101. if (_config2.default.playlists[playlist].shuffle) {
  1102. /*
  1103. Grab song from the shuffle list
  1104. */
  1105. previousSong = _config2.default.playlists[playlist].shuffle_list[previousIndex];
  1106. } else {
  1107. /*
  1108. Grab song from the songs array
  1109. */
  1110. previousSong = _config2.default.playlists[playlist].songs[previousIndex];
  1111. }
  1112. }
  1113. /*
  1114. Sets the active playlist to the playlist we are on.
  1115. */
  1116. setActivePlaylist(playlist);
  1117. /*
  1118. Change the song within the playlist.
  1119. */
  1120. changeSongPlaylist(playlist, previousSong, previousIndex);
  1121. /*
  1122. Plays the song
  1123. */
  1124. _core2.default.play();
  1125. /*
  1126. Sync the play pause buttons.
  1127. */
  1128. _playPauseElements2.default.sync();
  1129. _callbacks2.default.run("prev");
  1130. /*
  1131. Repeat the song.
  1132. */
  1133. if (_config2.default.repeat_song) {
  1134. _callbacks2.default.run("song_repeated");
  1135. }
  1136. }
  1137. /**
  1138. * Change song in the songs array.
  1139. *
  1140. * @access private
  1141. * @prop {object} song - The song we are changing to.
  1142. * @prop {number} index - The index we are changing to.
  1143. * @prop {boolean} direct - Determines if it was a direct click on the song.
  1144. * We then don't care if shuffle is on or not.
  1145. */
  1146. function changeSong(song, index) {
  1147. var direct = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1148. /*
  1149. Prepare the song change.
  1150. */
  1151. prepareSongChange(song);
  1152. /*
  1153. Change the song.
  1154. */
  1155. _config2.default.audio.src = song.url;
  1156. _config2.default.active_metadata = song;
  1157. _config2.default.active_album = song.album;
  1158. _config2.default.active_index = parseInt(index);
  1159. /*
  1160. Set new information now that the song has changed.
  1161. */
  1162. afterSongChange(direct);
  1163. }
  1164. /**
  1165. * Handles a song change in the playlist
  1166. *
  1167. * @access private
  1168. * @prop {string} playlist - The playlist we are changing the song on.
  1169. * @prop {object} song - The song we are changing to in the playlist.
  1170. * @prop {number} index - The inded of the song we are changing to in the playlist.
  1171. * @prop {boolean} direct - Determines if it was a direct click on the song. We
  1172. * then don't care if shuffle is on or not
  1173. */
  1174. function changeSongPlaylist(playlist, song, index) {
  1175. var direct = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1176. /*
  1177. Prepare the song change.
  1178. */
  1179. prepareSongChange(song);
  1180. /*
  1181. Change the song.
  1182. */
  1183. _config2.default.audio.src = song.url;
  1184. _config2.default.active_metadata = song;
  1185. _config2.default.active_album = song.album;
  1186. _config2.default.active_index = null;
  1187. _config2.default.playlists[playlist].active_index = parseInt(index);
  1188. /*
  1189. Set new information now that the song has changed.
  1190. */
  1191. afterSongChange(direct);
  1192. }
  1193. /**
  1194. * Prepares a song change
  1195. *
  1196. * @access private
  1197. * @prop {object} song - The song we change to.
  1198. */
  1199. function prepareSongChange(song) {
  1200. /*
  1201. Stop the current song.
  1202. */
  1203. _core2.default.stop();
  1204. /*
  1205. Sync all of the elements to a stopped song.
  1206. */
  1207. _playPauseElements2.default.syncToPause();
  1208. _songSliderElements2.default.resetElements();
  1209. _songPlayedProgressElements2.default.resetElements();
  1210. _timeElements2.default.resetCurrentTimes();
  1211. /*
  1212. If an album changes, fire an album change.
  1213. */
  1214. if (_checks2.default.newAlbum(song)) {
  1215. _callbacks2.default.run("album_change");
  1216. }
  1217. }
  1218. /**
  1219. * Updates data on the display after a song has changed.
  1220. *
  1221. * @prop {boolean} direct - Determines if it was a direct click on the song.
  1222. * We then don't care if shuffle is on or not.
  1223. *
  1224. * @access private
  1225. */
  1226. function afterSongChange(direct) {
  1227. _metaDataElements2.default.displayMetaData();
  1228. _containerElements2.default.setActive(direct);
  1229. _timeElements2.default.resetDurationTimes();
  1230. /*
  1231. Run the song change callback.
  1232. */
  1233. _callbacks2.default.run("song_change");
  1234. }
  1235. /**
  1236. * Sets the active playlist
  1237. *
  1238. * @access public
  1239. * @param {string} playlist - The string of the playlist being set to active.
  1240. */
  1241. function setActivePlaylist(playlist) {
  1242. /*
  1243. If the active playlist is different than the playlist being set,
  1244. we run the `playlist_changed` callback.
  1245. */
  1246. if (_config2.default.active_playlist != playlist) {
  1247. _callbacks2.default.run("playlist_changed");
  1248. /*
  1249. Set the active playlist to the playlist parameter. Only need to
  1250. set if it's different.
  1251. */
  1252. _config2.default.active_playlist = playlist;
  1253. if (playlist != null) {
  1254. _config2.default.playlists[playlist].active_index = 0;
  1255. }
  1256. }
  1257. }
  1258. /*
  1259. Return the publically facing methods
  1260. */
  1261. return {
  1262. setNext: setNext,
  1263. setNextPlaylist: setNextPlaylist,
  1264. setPrevious: setPrevious,
  1265. setPreviousPlaylist: setPreviousPlaylist,
  1266. changeSong: changeSong,
  1267. changeSongPlaylist: changeSongPlaylist,
  1268. setActivePlaylist: setActivePlaylist
  1269. };
  1270. }();
  1271. /**
  1272. * Container Elements Module
  1273. *
  1274. * @module visual/ContainerElements
  1275. */
  1276. /**
  1277. * Imports the Time Elements Module
  1278. *
  1279. * @module visual/TimeElements
  1280. */
  1281. /**
  1282. * Imports the Song Slider Elements Module
  1283. *
  1284. * @module visual/SongSliderElements
  1285. */
  1286. /**
  1287. * Imports the Checks Module
  1288. *
  1289. * @module utilities/Checks
  1290. */
  1291. /**
  1292. * Imports the Core Module
  1293. *
  1294. * @module core/Core
  1295. */
  1296. exports.default = AudioNavigation;
  1297. module.exports = exports["default"];
  1298. /***/ }),
  1299. /* 4 */
  1300. /***/ (function(module, exports, __webpack_require__) {
  1301. "use strict";
  1302. Object.defineProperty(exports, "__esModule", {
  1303. value: true
  1304. });
  1305. var _config = __webpack_require__(0);
  1306. var _config2 = _interopRequireDefault(_config);
  1307. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1308. /**
  1309. * Handles the debugging of AmplitudeJS
  1310. * @module utilities/Debug
  1311. */
  1312. var Debug = function () {
  1313. /**
  1314. * Writes out debug message to the console if enabled.
  1315. *
  1316. * Public Accessor: Debug.writeMessage( message )
  1317. *
  1318. * @access public
  1319. * @param {string} message - The string that gets printed to alert the user of a debugging error.
  1320. */
  1321. function writeMessage(message) {
  1322. /*
  1323. If the user has flagged AmplitudeJS to debug, we print out a message
  1324. to the console.
  1325. */
  1326. if (_config2.default.debug) {
  1327. console.log(message);
  1328. }
  1329. }
  1330. /*
  1331. Returns the public facing methods
  1332. */
  1333. return {
  1334. writeMessage: writeMessage
  1335. };
  1336. }(); /**
  1337. * Imports the config module
  1338. * @module config
  1339. */
  1340. exports.default = Debug;
  1341. module.exports = exports["default"];
  1342. /***/ }),
  1343. /* 5 */
  1344. /***/ (function(module, exports, __webpack_require__) {
  1345. "use strict";
  1346. Object.defineProperty(exports, "__esModule", {
  1347. value: true
  1348. });
  1349. var _config = __webpack_require__(0);
  1350. var _config2 = _interopRequireDefault(_config);
  1351. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1352. /**
  1353. * AmplitudeJS Checks Module. Checks for new songs, albums, and playlists
  1354. *
  1355. * @module utilities/Checks
  1356. */
  1357. var Checks = function () {
  1358. /**
  1359. * Checks to see if the new song to be played is different than the song
  1360. * that is currently playing. To be true, the user would have selected
  1361. * play on a new song with a new index. To be false, the user would have
  1362. * clicked play/pause on the song that was playing.
  1363. *
  1364. * Public Accessor: Checks.newSong( playlist, songIndex )
  1365. * @access public
  1366. * @param {string} playlist - The playlist we are checking the new song for. Could be null
  1367. * @param {number} songIndex - The index of the new song to be played.
  1368. * @returns {boolean} True if we are setting a new song, false if we are not setting a new song.
  1369. */
  1370. function newSong(playlist, songIndex) {
  1371. /*
  1372. If the playlists don't match, then it's definitely a new song.
  1373. */
  1374. if (_config2.default.active_playlist != playlist) {
  1375. return true;
  1376. } else {
  1377. /*
  1378. If we aren't in a playlist, we check the active index.
  1379. */
  1380. if (_config2.default.active_playlist == null && playlist == null) {
  1381. /*
  1382. If the active indexes don't match, then it's a new song.
  1383. */
  1384. if (_config2.default.active_index != songIndex) {
  1385. return true;
  1386. } else {
  1387. return false;
  1388. }
  1389. } else {
  1390. /*
  1391. If we are in a playlist, then we check to see if the
  1392. new song index matches the active index.
  1393. */
  1394. if (_config2.default.active_playlist == playlist && _config2.default.playlists[playlist].active_index != songIndex) {
  1395. return true;
  1396. } else {
  1397. return false;
  1398. }
  1399. }
  1400. }
  1401. }
  1402. /**
  1403. * Checks to see if there is a new album
  1404. *
  1405. * Public Accessor: Checks.newAlbum( album )
  1406. *
  1407. * @access public
  1408. * @param {string} album - Checks to see if the new song will have a new album.
  1409. * @returns {boolean} True if there is a new album, false if there is not a new ablum.
  1410. */
  1411. function newAlbum(album) {
  1412. if (_config2.default.active_album != album) {
  1413. return true;
  1414. } else {
  1415. return false;
  1416. }
  1417. }
  1418. /**
  1419. * Checks to see if there is a new playlist
  1420. *
  1421. * Public Accessor: Checks.newPlaylist( playlist )
  1422. *
  1423. * @access public
  1424. * @param {string} playlist - The playlist passed in to check against the active playlist.
  1425. * @returns {boolean} True if there is a new playlist, false if there is not a new playlist.
  1426. */
  1427. function newPlaylist(playlist) {
  1428. if (_config2.default.active_playlist != playlist) {
  1429. return true;
  1430. } else {
  1431. return false;
  1432. }
  1433. }
  1434. /**
  1435. * Determines if the string passed in is a URL or not
  1436. *
  1437. * Public Accessor: AmplitudeHelpers.isURL( url )
  1438. *
  1439. * @access public
  1440. * @param {string} url - The string we are testing to see if it's a URL.
  1441. * @returns {boolean} True if the string is a url, false if it is not.
  1442. */
  1443. function isURL(url) {
  1444. /*
  1445. Test the string against the URL pattern and return if it matches
  1446. */
  1447. var pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  1448. return pattern.test(url);
  1449. }
  1450. /**
  1451. * Determines if what is passed in is an integer or not.
  1452. *
  1453. * Public Accessor: AmplitudeHelpers.isInt( int )
  1454. *
  1455. * @access public
  1456. * @param {string|number} int - The variable we are testing to see is an integer or not.
  1457. * @returns {boolean} If the variable is an integer or not.
  1458. */
  1459. function isInt(int) {
  1460. return !isNaN(int) && parseInt(Number(int)) == int && !isNaN(parseInt(int, 10));
  1461. }
  1462. /**
  1463. * Returns public facing methods
  1464. */
  1465. return {
  1466. newSong: newSong,
  1467. newAlbum: newAlbum,
  1468. newPlaylist: newPlaylist,
  1469. isURL: isURL,
  1470. isInt: isInt
  1471. };
  1472. }(); /**
  1473. * Imports the config module
  1474. * @module config
  1475. */
  1476. exports.default = Checks;
  1477. module.exports = exports["default"];
  1478. /***/ }),
  1479. /* 6 */
  1480. /***/ (function(module, exports, __webpack_require__) {
  1481. "use strict";
  1482. Object.defineProperty(exports, "__esModule", {
  1483. value: true
  1484. });
  1485. var _config = __webpack_require__(0);
  1486. var _config2 = _interopRequireDefault(_config);
  1487. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1488. /**
  1489. * Handles the state of the config object.
  1490. *
  1491. * @module utilities/ConfigState
  1492. */
  1493. var ConfigState = function () {
  1494. /**
  1495. * Resets the config to the default state. This is called on initialize
  1496. * to ensure the user's config is what matters.
  1497. *
  1498. * Public Accessor: AmplitudeHelpers.resetConfig()
  1499. *
  1500. * @access public
  1501. */
  1502. function resetConfig() {
  1503. _config2.default.audio = new Audio();
  1504. _config2.default.active_metadata = {};
  1505. _config2.default.active_album = "";
  1506. _config2.default.active_index = 0;
  1507. _config2.default.active_playlist = null;
  1508. _config2.default.playback_speed = 1.0;
  1509. _config2.default.callbacks = {};
  1510. _config2.default.songs = [];
  1511. _config2.default.playlists = {};
  1512. _config2.default.start_song = "";
  1513. _config2.default.starting_playlist = "";
  1514. _config2.default.starting_playlist_song = "";
  1515. _config2.default.repeat = false;
  1516. _config2.default.shuffle_list = {};
  1517. _config2.default.shuffle_on = false;
  1518. _config2.default.default_album_art = "";
  1519. _config2.default.default_playlist_art = "";
  1520. _config2.default.debug = false;
  1521. _config2.default.volume = 0.5;
  1522. _config2.default.pre_mute_volume = 0.5;
  1523. _config2.default.volume_increment = 5;
  1524. _config2.default.volume_decrement = 5;
  1525. _config2.default.soundcloud_client = "";
  1526. _config2.default.soundcloud_use_art = false;
  1527. _config2.default.soundcloud_song_count = 0;
  1528. _config2.default.soundcloud_songs_ready = 0;
  1529. _config2.default.continue_next = true;
  1530. }
  1531. /**
  1532. * Sets the state of the player.
  1533. */
  1534. function setPlayerState() {
  1535. /*
  1536. If paused and the current time is 0 the player is stopped.
  1537. */
  1538. if (_config2.default.audio.paused && _config2.default.audio.currentTime == 0) {
  1539. _config2.default.player_state = "stopped";
  1540. }
  1541. /*
  1542. If paused and the current time is greater than 0 the player is
  1543. paused.
  1544. */
  1545. if (_config2.default.audio.paused && _config2.default.audio.currentTime > 0) {
  1546. _config2.default.player_state = "paused";
  1547. }
  1548. /*
  1549. If playing, the current state is playing.
  1550. */
  1551. if (!_config2.default.audio.paused) {
  1552. _config2.default.player_state = "playing";
  1553. }
  1554. }
  1555. /*
  1556. Returns the public facing methods
  1557. */
  1558. return {
  1559. resetConfig: resetConfig,
  1560. setPlayerState: setPlayerState
  1561. };
  1562. }(); /**
  1563. * Imports the config module
  1564. * @module config
  1565. */
  1566. exports.default = ConfigState;
  1567. module.exports = exports["default"];
  1568. /***/ }),
  1569. /* 7 */
  1570. /***/ (function(module, exports, __webpack_require__) {
  1571. "use strict";
  1572. Object.defineProperty(exports, "__esModule", {
  1573. value: true
  1574. });
  1575. var _config = __webpack_require__(0);
  1576. var _config2 = _interopRequireDefault(_config);
  1577. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1578. /**
  1579. * These methods help display the audio's meta data
  1580. *
  1581. * @module visual/MetaDataElements
  1582. */
  1583. var MetaDataElements = function () {
  1584. /**
  1585. * Displays the active song's metadata. This is called after a song has
  1586. * been changed. This method takes the active song and displays the
  1587. * metadata. So once the new active song is set, we update all of the
  1588. * screen elements.
  1589. *
  1590. * @access public
  1591. */
  1592. function displayMetaData() {
  1593. /*
  1594. Define the image meta data keys. These are managed separately
  1595. since we aren't actually changing the inner HTML of these elements.
  1596. */
  1597. var imageMetaDataKeys = ["cover_art_url", "station_art_url", "podcast_episode_cover_art_url"];
  1598. /*
  1599. Get all of the song info elements
  1600. */
  1601. var songInfoElements = document.querySelectorAll("[data-amplitude-song-info]");
  1602. /*
  1603. Iterate over all of the song info elements. We will either
  1604. set these to the new values, or clear them if the active song
  1605. doesn't have the info set.
  1606. */
  1607. for (var i = 0; i < songInfoElements.length; i++) {
  1608. /*
  1609. Get the info so we can check if the active meta data has the
  1610. key.
  1611. */
  1612. var info = songInfoElements[i].getAttribute("data-amplitude-song-info");
  1613. /*
  1614. Grab the playlist and song index.
  1615. */
  1616. var playlist = songInfoElements[i].getAttribute("data-amplitude-playlist");
  1617. var songIndex = songInfoElements[i].getAttribute("data-amplitude-song-index");
  1618. /*
  1619. Ensure that we don't set any individual elements now. We set this with the
  1620. sync meta data method. The reason we don't set them here is because
  1621. all individual songs would get the now playing artwork. If the playlists
  1622. match or the element is a main element meaning it doesn't
  1623. belong to a playlist or a song, then we set the song info.
  1624. */
  1625. if (songIndex == null && (_config2.default.active_playlist == playlist || playlist == null && songIndex == null)) {
  1626. /*
  1627. If the active metadata has the key, then we set it,
  1628. otherwise we clear it. If it's an image element then
  1629. we default it to the default info if needed.
  1630. */
  1631. var val = _config2.default.active_metadata[info] != undefined ? _config2.default.active_metadata[info] : null;
  1632. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1633. val = val || _config2.default.default_album_art;
  1634. songInfoElements[i].setAttribute("src", val);
  1635. } else {
  1636. val = val || "";
  1637. songInfoElements[i].innerHTML = val;
  1638. }
  1639. }
  1640. }
  1641. }
  1642. /**
  1643. * Displays the playlist meta data.
  1644. */
  1645. function displayPlaylistMetaData() {
  1646. /*
  1647. Define the image meta data keys. These are managed separately
  1648. since we aren't actually changing the inner HTML of these elements.
  1649. */
  1650. var imageMetaDataKeys = ["image_url"];
  1651. /*
  1652. Get all of the playlist info elements
  1653. */
  1654. var playlistInfoElements = document.querySelectorAll("[data-amplitude-playlist-info]");
  1655. /*
  1656. Iterate over all of the playlist info elements. We will either
  1657. set these to the new values, or clear them if the active song
  1658. doesn't have the info set.
  1659. */
  1660. for (var i = 0; i < playlistInfoElements.length; i++) {
  1661. /*
  1662. Get the info so we can check if the active meta data has the
  1663. key.
  1664. */
  1665. var info = playlistInfoElements[i].getAttribute("data-amplitude-playlist-info");
  1666. var playlist = playlistInfoElements[i].getAttribute("data-amplitude-playlist");
  1667. if (_config2.default.playlists[playlist][info] != undefined) {
  1668. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1669. playlistInfoElements[i].setAttribute("src", _config2.default.playlists[playlist][info]);
  1670. } else {
  1671. playlistInfoElements[i].innerHTML = _config2.default.playlists[playlist][info];
  1672. }
  1673. } else {
  1674. /*
  1675. We look for the default album art because
  1676. the actual key didn't exist. If the default album
  1677. art doesn't exist then we set the src attribute
  1678. to null.
  1679. */
  1680. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1681. if (_config2.default.default_playlist_art != "") {
  1682. playlistInfoElements[i].setAttribute("src", _config2.default.default_playlist_art);
  1683. } else {
  1684. playlistInfoElements[i].setAttribute("src", "");
  1685. }
  1686. } else {
  1687. playlistInfoElements[i].innerHTML = "";
  1688. }
  1689. }
  1690. }
  1691. }
  1692. /**
  1693. * Sets the first song in the playlist. This is used to fill in the meta
  1694. * data in the playlist
  1695. *
  1696. * @param {object} song - The song we are setting to be the first song in the playlist
  1697. * @param {string} playlist - Key of the playlist we are setting the first song in
  1698. */
  1699. function setFirstSongInPlaylist(song, playlist) {
  1700. /*
  1701. Define the image meta data keys. These are managed separately
  1702. since we aren't actually changing the inner HTML of these elements.
  1703. */
  1704. var imageMetaDataKeys = ["cover_art_url", "station_art_url", "podcast_episode_cover_art_url"];
  1705. /*
  1706. Get all of the song info elements
  1707. */
  1708. var songInfoElements = document.querySelectorAll('[data-amplitude-song-info][data-amplitude-playlist="' + playlist + '"]');
  1709. /*
  1710. Iterate over all of the song info elements. We will either
  1711. set these to the new values, or clear them if the active song
  1712. doesn't have the info set.
  1713. */
  1714. for (var i = 0; i < songInfoElements.length; i++) {
  1715. /*
  1716. Get the info so we can check if the active meta data has the
  1717. key.
  1718. */
  1719. var info = songInfoElements[i].getAttribute("data-amplitude-song-info");
  1720. /*
  1721. Get the song info element playlist.
  1722. */
  1723. var elementPlaylist = songInfoElements[i].getAttribute("data-amplitude-playlist");
  1724. /*
  1725. If the playlists match or the element is a main element, then
  1726. we set the song info.
  1727. */
  1728. if (elementPlaylist == playlist) {
  1729. /*
  1730. If the active metadata has the key, then we set it,
  1731. otherwise we clear it. If it's an image element then
  1732. we default it to the default info if needed.
  1733. */
  1734. if (song[info] != undefined) {
  1735. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1736. songInfoElements[i].setAttribute("src", song[info]);
  1737. } else {
  1738. songInfoElements[i].innerHTML = song[info];
  1739. }
  1740. } else {
  1741. /*
  1742. We look for the default album art because
  1743. the actual key didn't exist. If the default album
  1744. art doesn't exist then we set the src attribute
  1745. to null.
  1746. */
  1747. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1748. if (song.default_album_art != "") {
  1749. songInfoElements[i].setAttribute("src", song.default_album_art);
  1750. } else {
  1751. songInfoElements[i].setAttribute("src", "");
  1752. }
  1753. } else {
  1754. songInfoElements[i].innerHTML = "";
  1755. }
  1756. }
  1757. }
  1758. }
  1759. }
  1760. /**
  1761. * Sets the meta data for songs loaded in the songs array
  1762. */
  1763. function syncMetaData() {
  1764. /*
  1765. Define the image meta data keys. These are managed separately
  1766. since we aren't actually changing the inner HTML of these elements.
  1767. */
  1768. var imageMetaDataKeys = ["cover_art_url", "station_art_url", "podcast_episode_cover_art_url"];
  1769. /*
  1770. Get all of the song info elements
  1771. */
  1772. var songInfoElements = document.querySelectorAll("[data-amplitude-song-info]");
  1773. /*
  1774. Iterate over all of the song info elements. We will either
  1775. set these to the new values, or clear them if the active song
  1776. doesn't have the info set.
  1777. */
  1778. for (var i = 0; i < songInfoElements.length; i++) {
  1779. var songIndex = songInfoElements[i].getAttribute("data-amplitude-song-index");
  1780. var playlist = songInfoElements[i].getAttribute("data-amplitude-playlist");
  1781. if (songIndex != null && playlist == null) {
  1782. var info = songInfoElements[i].getAttribute("data-amplitude-song-info");
  1783. /*
  1784. Get the song info value referenced on the element. Depending on the type of
  1785. element, we may need to fallback to another value when the direct value
  1786. we want isn't found.
  1787. i.e.
  1788. data-amplitude-song-info="cover_art_url" defaults to using the value
  1789. of "default_album_art" when "cover_art_url" is missing on the song.
  1790. */
  1791. var val = _config2.default.songs[songIndex][info] != undefined ? _config2.default.songs[songIndex][info] : null;
  1792. /*
  1793. If it's an image meta data key, then we set the src attribute of
  1794. the element. Otherwise we set the inner HTML of the element.
  1795. */
  1796. if (imageMetaDataKeys.indexOf(info) >= 0) {
  1797. /*
  1798. If this is an image meta data key and the individual song doesn't
  1799. have the key, use the default_album_art
  1800. */
  1801. val = val || _config2.default.default_album_art;
  1802. songInfoElements[i].setAttribute("src", val);
  1803. } else {
  1804. songInfoElements[i].innerHTML = val;
  1805. }
  1806. }
  1807. /*
  1808. If the song index and playlist are not null, continue.
  1809. */
  1810. if (songIndex != null && playlist != null) {
  1811. /*
  1812. Get the info we are displaying.
  1813. */
  1814. var _info = songInfoElements[i].getAttribute("data-amplitude-song-info");
  1815. /*
  1816. Set the meta data accordingly.
  1817. */
  1818. if (_config2.default.playlists[playlist].songs[songIndex][_info] != undefined) {
  1819. if (imageMetaDataKeys.indexOf(_info) >= 0) {
  1820. songInfoElements[i].setAttribute("src", _config2.default.playlists[playlist].songs[songIndex][_info]);
  1821. } else {
  1822. songInfoElements[i].innerHTML = _config2.default.playlists[playlist].songs[songIndex][_info];
  1823. }
  1824. }
  1825. }
  1826. }
  1827. /*
  1828. Display the playlist meta data.
  1829. */
  1830. displayPlaylistMetaData();
  1831. }
  1832. /**
  1833. * Returns publically facing methods
  1834. */
  1835. return {
  1836. displayMetaData: displayMetaData,
  1837. setFirstSongInPlaylist: setFirstSongInPlaylist,
  1838. syncMetaData: syncMetaData,
  1839. displayPlaylistMetaData: displayPlaylistMetaData
  1840. };
  1841. }(); /**
  1842. * Imports the config module
  1843. * @module config
  1844. */
  1845. exports.default = MetaDataElements;
  1846. module.exports = exports["default"];
  1847. /***/ }),
  1848. /* 8 */
  1849. /***/ (function(module, exports, __webpack_require__) {
  1850. "use strict";
  1851. Object.defineProperty(exports, "__esModule", {
  1852. value: true
  1853. });
  1854. var _config = __webpack_require__(0);
  1855. var _config2 = _interopRequireDefault(_config);
  1856. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1857. /**
  1858. * Handles all of the visual syncing to the state of the config for the repeat
  1859. * elements.
  1860. *
  1861. * @module visual/RepeatElements
  1862. */
  1863. var RepeatElements = function () {
  1864. /**
  1865. * Syncs repeat for all of the repeat buttons. Users
  1866. * can apply styles to the 'amplitude-repeat-on' and
  1867. * 'amplitude-repeat-off' classes. They represent the state
  1868. * of the player.
  1869. */
  1870. function syncRepeat() {
  1871. /*
  1872. Gets all of the repeat classes
  1873. */
  1874. var repeatClasses = document.getElementsByClassName("amplitude-repeat");
  1875. /*
  1876. Iterate over all of the repeat classes. If repeat is on,
  1877. then add the 'amplitude-repeat-on' class and remove the
  1878. 'amplitude-repeat-off' class. If it's off, then do the
  1879. opposite.
  1880. */
  1881. for (var i = 0; i < repeatClasses.length; i++) {
  1882. if (_config2.default.repeat) {
  1883. repeatClasses[i].classList.add("amplitude-repeat-on");
  1884. repeatClasses[i].classList.remove("amplitude-repeat-off");
  1885. } else {
  1886. repeatClasses[i].classList.remove("amplitude-repeat-on");
  1887. repeatClasses[i].classList.add("amplitude-repeat-off");
  1888. }
  1889. }
  1890. }
  1891. /**
  1892. * Syncs repeat for all of the playlist repeat buttons. Users
  1893. * can apply styles to the `amplitude-repeat-on` and `amplitude-repeat-off`
  1894. * classes. They repreent the state of the playlist in the player.
  1895. */
  1896. function syncRepeatPlaylist(playlist) {
  1897. /*
  1898. Gets all of the repeat buttons.
  1899. */
  1900. var repeatButtons = document.getElementsByClassName("amplitude-repeat");
  1901. /*
  1902. Iterate over all of the repeat buttons
  1903. */
  1904. for (var i = 0; i < repeatButtons.length; i++) {
  1905. /*
  1906. Ensure that the repeat button belongs to matches the
  1907. playlist we are syncing the state for.
  1908. */
  1909. if (repeatButtons[i].getAttribute("data-amplitude-playlist") == playlist) {
  1910. /*
  1911. If the state of the playlist is shuffled on, true, then
  1912. we add the 'amplitude-repeat-on' class and remove the
  1913. 'amplitude-repeat-off' class. If the player is not shuffled
  1914. then we do the opposite.
  1915. */
  1916. if (_config2.default.playlists[playlist].repeat) {
  1917. repeatButtons[i].classList.add("amplitude-repeat-on");
  1918. repeatButtons[i].classList.remove("amplitude-repeat-off");
  1919. } else {
  1920. repeatButtons[i].classList.add("amplitude-repeat-off");
  1921. repeatButtons[i].classList.remove("amplitude-repeat-on");
  1922. }
  1923. }
  1924. }
  1925. }
  1926. /**
  1927. * Syncs repeat for all of the repeat song buttons. Users
  1928. * can apply styles to the 'amplitude-repeat-song-on' and
  1929. * 'amplitude-repeat-song-off' classes. They represent the state
  1930. * of the player.
  1931. */
  1932. function syncRepeatSong() {
  1933. /*
  1934. Gets all of the repeat song classes
  1935. */
  1936. var repeatSongClasses = document.getElementsByClassName("amplitude-repeat-song");
  1937. /*
  1938. Iterate over all of the repeat song classes. If repeat is on,
  1939. then add the 'amplitude-repeat-song-on' class and remove the
  1940. 'amplitude-repeat-song-off' class. If it's off, then do the
  1941. opposite.
  1942. */
  1943. for (var i = 0; i < repeatSongClasses.length; i++) {
  1944. if (_config2.default.repeat_song) {
  1945. repeatSongClasses[i].classList.add("amplitude-repeat-song-on");
  1946. repeatSongClasses[i].classList.remove("amplitude-repeat-song-off");
  1947. } else {
  1948. repeatSongClasses[i].classList.remove("amplitude-repeat-song-on");
  1949. repeatSongClasses[i].classList.add("amplitude-repeat-song-off");
  1950. }
  1951. }
  1952. }
  1953. /*
  1954. Returns the publically available methods.
  1955. */
  1956. return {
  1957. syncRepeat: syncRepeat,
  1958. syncRepeatPlaylist: syncRepeatPlaylist,
  1959. syncRepeatSong: syncRepeatSong
  1960. };
  1961. }(); /**
  1962. * Imports the config module
  1963. * @module config
  1964. */
  1965. exports.default = RepeatElements;
  1966. module.exports = exports["default"];
  1967. /***/ }),
  1968. /* 9 */
  1969. /***/ (function(module, exports, __webpack_require__) {
  1970. "use strict";
  1971. Object.defineProperty(exports, "__esModule", {
  1972. value: true
  1973. });
  1974. var _config = __webpack_require__(0);
  1975. var _config2 = _interopRequireDefault(_config);
  1976. var _debug = __webpack_require__(4);
  1977. var _debug2 = _interopRequireDefault(_debug);
  1978. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1979. /**
  1980. * AmplitudeJS Callback Utility
  1981. *
  1982. * @module utilities/callbacks
  1983. */
  1984. /**
  1985. * Imports the config module
  1986. * @module config
  1987. */
  1988. var Callbacks = function () {
  1989. /**
  1990. * Initializes the callbacks for the player.
  1991. */
  1992. function initialize() {
  1993. /*
  1994. Event: abort
  1995. https://www.w3schools.com/tags/av_event_abort.asp
  1996. */
  1997. _config2.default.audio.addEventListener("abort", function () {
  1998. run("abort");
  1999. });
  2000. /*
  2001. Event: error
  2002. https://www.w3schools.com/tags/av_event_error.asp
  2003. */
  2004. _config2.default.audio.addEventListener("error", function () {
  2005. run("error");
  2006. });
  2007. /*
  2008. Event: loadeddata
  2009. https://www.w3schools.com/tags/av_event_loadeddata.asp
  2010. */
  2011. _config2.default.audio.addEventListener("loadeddata", function () {
  2012. run("loadeddata");
  2013. });
  2014. /*
  2015. Event: loadedmetadata
  2016. https://www.w3schools.com/tags/av_event_loadedmetadata.asp
  2017. */
  2018. _config2.default.audio.addEventListener("loadedmetadata", function () {
  2019. run("loadedmetadata");
  2020. });
  2021. /*
  2022. Event: loadstart
  2023. https://www.w3schools.com/tags/av_event_loadstart.asp
  2024. */
  2025. _config2.default.audio.addEventListener("loadstart", function () {
  2026. run("loadstart");
  2027. });
  2028. /*
  2029. Event: pause
  2030. https://www.w3schools.com/tags/av_event_pause.asp
  2031. */
  2032. _config2.default.audio.addEventListener("pause", function () {
  2033. run("pause");
  2034. });
  2035. /*
  2036. Event: playing
  2037. https://www.w3schools.com/tags/av_event_playing.asp
  2038. */
  2039. _config2.default.audio.addEventListener("playing", function () {
  2040. run("playing");
  2041. });
  2042. /*
  2043. Event: play
  2044. https://www.w3schools.com/tags/av_event_play.asp
  2045. */
  2046. _config2.default.audio.addEventListener("play", function () {
  2047. run("play");
  2048. });
  2049. /*
  2050. Event: progress
  2051. https://www.w3schools.com/tags/av_event_progress.asp
  2052. */
  2053. _config2.default.audio.addEventListener("progress", function () {
  2054. run("progress");
  2055. });
  2056. /*
  2057. Event: ratechange
  2058. https://www.w3schools.com/tags/av_event_ratechange.asp
  2059. */
  2060. _config2.default.audio.addEventListener("ratechange", function () {
  2061. run("ratechange");
  2062. });
  2063. /*
  2064. Event: seeked
  2065. https://www.w3schools.com/tags/av_event_seeked.asp
  2066. */
  2067. _config2.default.audio.addEventListener("seeked", function () {
  2068. run("seeked");
  2069. });
  2070. /*
  2071. Event: seeking
  2072. https://www.w3schools.com/tags/av_event_seeking.asp
  2073. */
  2074. _config2.default.audio.addEventListener("seeking", function () {
  2075. run("seeking");
  2076. });
  2077. /*
  2078. Event: stalled
  2079. https://www.w3schools.com/tags/av_event_stalled.asp
  2080. */
  2081. _config2.default.audio.addEventListener("stalled", function () {
  2082. run("stalled");
  2083. });
  2084. /*
  2085. Event: suspend
  2086. https://www.w3schools.com/tags/av_event_suspend.asp
  2087. */
  2088. _config2.default.audio.addEventListener("suspend", function () {
  2089. run("suspend");
  2090. });
  2091. /*
  2092. Event: timeupdate
  2093. https://www.w3schools.com/tags/av_event_timeupdate.asp
  2094. */
  2095. _config2.default.audio.addEventListener("timeupdate", function () {
  2096. run("timeupdate");
  2097. });
  2098. /*
  2099. Event: volumechange
  2100. https://www.w3schools.com/tags/av_event_volumechange.asp
  2101. */
  2102. _config2.default.audio.addEventListener("volumechange", function () {
  2103. run("volumechange");
  2104. });
  2105. /*
  2106. Event: waiting
  2107. https://www.w3schools.com/tags/av_event_waiting.asp
  2108. */
  2109. _config2.default.audio.addEventListener("waiting", function () {
  2110. run("waiting");
  2111. });
  2112. /*
  2113. Event: canplay
  2114. https://www.w3schools.com/tags/av_event_canplay.asp
  2115. */
  2116. _config2.default.audio.addEventListener("canplay", function () {
  2117. run("canplay");
  2118. });
  2119. /*
  2120. Event: canplaythrough
  2121. https://www.w3schools.com/tags/av_event_canplaythrough.asp
  2122. */
  2123. _config2.default.audio.addEventListener("canplaythrough", function () {
  2124. run("canplaythrough");
  2125. });
  2126. /*
  2127. Event: durationchange
  2128. https://www.w3schools.com/tags/av_event_durationchange.asp
  2129. */
  2130. _config2.default.audio.addEventListener("durationchange", function () {
  2131. run("durationchange");
  2132. });
  2133. /*
  2134. Event: ended
  2135. https://www.w3schools.com/tags/av_event_ended.asp
  2136. */
  2137. _config2.default.audio.addEventListener("ended", function () {
  2138. run("ended");
  2139. });
  2140. }
  2141. /**
  2142. * Runs a user defined callback method
  2143. *
  2144. * Public Accessor: Callbacks.run( callbackName )
  2145. *
  2146. * @access public
  2147. * @param {string} callbackName - The name of the callback we are going to run.
  2148. */
  2149. function run(callbackName) {
  2150. /*
  2151. Checks to see if a user defined a callback method for the
  2152. callback we are running.
  2153. */
  2154. if (_config2.default.callbacks[callbackName]) {
  2155. /*
  2156. Build the callback function
  2157. */
  2158. var callbackFunction = _config2.default.callbacks[callbackName];
  2159. /*
  2160. Write a debug message stating the callback we are running
  2161. */
  2162. _debug2.default.writeMessage("Running Callback: " + callbackName);
  2163. /*
  2164. Run the callback function and catch any errors
  2165. */
  2166. try {
  2167. callbackFunction();
  2168. } catch (error) {
  2169. if (error.message == "CANCEL EVENT") {
  2170. throw error;
  2171. } else {
  2172. _debug2.default.writeMessage("Callback error: " + error.message);
  2173. }
  2174. }
  2175. }
  2176. }
  2177. return {
  2178. initialize: initialize,
  2179. run: run
  2180. };
  2181. }();
  2182. /**
  2183. * Imports the debug module
  2184. * @module utilities/debug
  2185. */
  2186. exports.default = Callbacks;
  2187. module.exports = exports["default"];
  2188. /***/ }),
  2189. /* 10 */
  2190. /***/ (function(module, exports, __webpack_require__) {
  2191. "use strict";
  2192. Object.defineProperty(exports, "__esModule", {
  2193. value: true
  2194. });
  2195. /**
  2196. * Handles the visual state for all of the mute elements.
  2197. *
  2198. * @module visual/MuteElements
  2199. */
  2200. var MuteElements = function () {
  2201. /**
  2202. * Syncs mute for all of the mute buttons. This represents the
  2203. * state of the player if it's muted or not.
  2204. *
  2205. * @access public
  2206. * @param {string} state - The muted state of the player.
  2207. */
  2208. function setMuted(state) {
  2209. /*
  2210. Get all of the mute buttons.
  2211. */
  2212. var muteClasses = document.getElementsByClassName("amplitude-mute");
  2213. /*
  2214. Iterate over all of the mute classes. If the state of the player
  2215. is not-muted then we add the amplitude-not-muted classe and remove
  2216. the amplitude muted class otherwise we do the opposite.
  2217. */
  2218. for (var i = 0; i < muteClasses.length; i++) {
  2219. if (!state) {
  2220. muteClasses[i].classList.add("amplitude-not-muted");
  2221. muteClasses[i].classList.remove("amplitude-muted");
  2222. } else {
  2223. muteClasses[i].classList.remove("amplitude-not-muted");
  2224. muteClasses[i].classList.add("amplitude-muted");
  2225. }
  2226. }
  2227. }
  2228. return {
  2229. setMuted: setMuted
  2230. };
  2231. }();
  2232. exports.default = MuteElements;
  2233. module.exports = exports["default"];
  2234. /***/ }),
  2235. /* 11 */
  2236. /***/ (function(module, exports, __webpack_require__) {
  2237. "use strict";
  2238. Object.defineProperty(exports, "__esModule", {
  2239. value: true
  2240. });
  2241. var _config = __webpack_require__(0);
  2242. var _config2 = _interopRequireDefault(_config);
  2243. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2244. /**
  2245. * Keeps the volume slider elements in sync.
  2246. * @module visual/VolumeSliderElements
  2247. */
  2248. var VolumeSliderElements = function () {
  2249. /**
  2250. * Visually syncs the volume sliders so they are all the same if there
  2251. * are more than one.
  2252. *
  2253. * @access public
  2254. */
  2255. function sync() {
  2256. var volumeSliders = document.getElementsByClassName("amplitude-volume-slider");
  2257. /*
  2258. Iterates over all of the volume sliders for the song, setting the value
  2259. to the config value.
  2260. */
  2261. for (var i = 0; i < volumeSliders.length; i++) {
  2262. volumeSliders[i].value = _config2.default.audio.volume * 100;
  2263. }
  2264. }
  2265. /**
  2266. * Returns the public facing methods
  2267. */
  2268. return {
  2269. sync: sync
  2270. };
  2271. }(); /**
  2272. * Imports the config module
  2273. * @module config
  2274. */
  2275. exports.default = VolumeSliderElements;
  2276. module.exports = exports["default"];
  2277. /***/ }),
  2278. /* 12 */
  2279. /***/ (function(module, exports, __webpack_require__) {
  2280. "use strict";
  2281. Object.defineProperty(exports, "__esModule", {
  2282. value: true
  2283. });
  2284. var _config = __webpack_require__(0);
  2285. var _config2 = _interopRequireDefault(_config);
  2286. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2287. /**
  2288. * AmplitudeJS Repeater utility. Handles setting the repeat for all scenarios.
  2289. *
  2290. * @module utilities/Repeater
  2291. */
  2292. var Repeater = function () {
  2293. /**
  2294. * Sets the state of the repeat for a song.
  2295. *
  2296. * @access public
  2297. * @param {boolean} repeat - A boolean representing whether the repeat should be on or off
  2298. */
  2299. function setRepeat(repeat) {
  2300. /*
  2301. Set the global repeat to be toggled
  2302. */
  2303. _config2.default.repeat = repeat;
  2304. }
  2305. /**
  2306. * Sets the state of the repeat for a playlist.
  2307. *
  2308. * @access public
  2309. * @param {boolean} repeat - A boolean representing whether the repeat should be on or off
  2310. * @param {string} playlist - The key of the playlist for repeating
  2311. */
  2312. function setRepeatPlaylist(repeat, playlist) {
  2313. /*
  2314. Set the playlist repeat to be toggled.
  2315. */
  2316. _config2.default.playlists[playlist].repeat = repeat;
  2317. }
  2318. /**
  2319. * Sets the state of the repeat song
  2320. *
  2321. * @access public
  2322. * @param {boolean} repeat - A boolean representing whether the repeat shoudl be on or off for the song.
  2323. */
  2324. function setRepeatSong(repeat) {
  2325. _config2.default.repeat_song = repeat;
  2326. }
  2327. /*
  2328. Returns the public facing methods
  2329. */
  2330. return {
  2331. setRepeat: setRepeat,
  2332. setRepeatPlaylist: setRepeatPlaylist,
  2333. setRepeatSong: setRepeatSong
  2334. };
  2335. }(); /**
  2336. * Imports the config module
  2337. * @module config
  2338. */
  2339. exports.default = Repeater;
  2340. module.exports = exports["default"];
  2341. /***/ }),
  2342. /* 13 */
  2343. /***/ (function(module, exports, __webpack_require__) {
  2344. "use strict";
  2345. Object.defineProperty(exports, "__esModule", {
  2346. value: true
  2347. });
  2348. var _config = __webpack_require__(0);
  2349. var _config2 = _interopRequireDefault(_config);
  2350. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2351. /**
  2352. * AmplitudeJS Shuffle Module. Handles all of the shuffling functionality for
  2353. * AmplitudeJS
  2354. *
  2355. * @module utilities/Shuffler
  2356. */
  2357. var Shuffler = function () {
  2358. /**
  2359. * Sets the shuffle state globally
  2360. *
  2361. * @access public
  2362. * @param {boolean} shuffle - True when we are shuffling, false when we turn it off.
  2363. */
  2364. function setShuffle(shuffle) {
  2365. _config2.default.shuffle_on = shuffle;
  2366. if (shuffle) {
  2367. shuffleSongs();
  2368. } else {
  2369. _config2.default.shuffle_list = [];
  2370. }
  2371. }
  2372. /**
  2373. * Toggles the shuffle status globally.
  2374. *
  2375. * @access public
  2376. */
  2377. function toggleShuffle() {
  2378. /*
  2379. If shuffle is on, we toggle it off. If shuffle is off, we
  2380. toggle on.
  2381. */
  2382. if (_config2.default.shuffle_on) {
  2383. _config2.default.shuffle_on = false;
  2384. _config2.default.shuffle_list = [];
  2385. } else {
  2386. _config2.default.shuffle_on = true;
  2387. shuffleSongs();
  2388. }
  2389. }
  2390. /**
  2391. * Sets the shuffle state for a playlist
  2392. *
  2393. * @access public
  2394. * @param {string} playlist The key of the playlist we are shuffling.
  2395. * @param {boolean} shuffle True when we are shuffling the playlist, false when we turn off shuffle.
  2396. */
  2397. function setShufflePlaylist(playlist, shuffle) {
  2398. _config2.default.playlists[playlist].shuffle = shuffle;
  2399. if (_config2.default.playlists[playlist].shuffle) {
  2400. shufflePlaylistSongs(playlist);
  2401. } else {
  2402. _config2.default.playlists[playlist].shuffle_list = [];
  2403. }
  2404. }
  2405. /**
  2406. * Sets the shuffle state for a playlist
  2407. *
  2408. * @access public
  2409. * @param {string} playlist The key of the playlist we are shuffling.
  2410. */
  2411. function toggleShufflePlaylist(playlist) {
  2412. /*
  2413. If the playlist shuffled is on, we toggle it off. If the
  2414. playlist shuffled is off, we toggle it on.
  2415. */
  2416. if (_config2.default.playlists[playlist].shuffle) {
  2417. _config2.default.playlists[playlist].shuffle = false;
  2418. _config2.default.playlists[playlist].shuffle_list = [];
  2419. } else {
  2420. _config2.default.playlists[playlist].shuffle = true;
  2421. shufflePlaylistSongs(playlist);
  2422. }
  2423. }
  2424. /**
  2425. * Shuffles individual songs in the config
  2426. * Based off of: http://www.codinghorror.com/blog/2007/12/the-danger-of-naivete.html
  2427. *
  2428. * Public Accessor: Shuffle.shuffleSongs()
  2429. *
  2430. * @access public
  2431. */
  2432. function shuffleSongs() {
  2433. /*
  2434. Builds a temporary array with the length of the config.
  2435. */
  2436. var shuffleTemp = new Array(_config2.default.songs.length);
  2437. /*
  2438. Set the temporary array equal to the songs array.
  2439. */
  2440. for (var i = 0; i < _config2.default.songs.length; i++) {
  2441. shuffleTemp[i] = _config2.default.songs[i];
  2442. }
  2443. /*
  2444. Iterate ove rthe songs and generate random numbers to
  2445. swap the indexes of the shuffle array.
  2446. */
  2447. for (var _i = _config2.default.songs.length - 1; _i > 0; _i--) {
  2448. var randNum = Math.floor(Math.random() * _config2.default.songs.length + 1);
  2449. shuffleSwap(shuffleTemp, _i, randNum - 1);
  2450. }
  2451. /*
  2452. Set the shuffle list to the shuffle temp.
  2453. */
  2454. _config2.default.shuffle_list = shuffleTemp;
  2455. }
  2456. /**
  2457. * Shuffle songs in a playlist
  2458. *
  2459. * Public Accessor: Shuffle.shufflePlaylistSongs( playlist )
  2460. *
  2461. * @access public
  2462. * @param {string} playlist - The playlist we are shuffling.
  2463. */
  2464. function shufflePlaylistSongs(playlist) {
  2465. /*
  2466. Builds a temporary array with the length of the playlist songs.
  2467. */
  2468. var shuffleTemp = new Array(_config2.default.playlists[playlist].songs.length);
  2469. /*
  2470. Set the temporary array equal to the playlist array.
  2471. */
  2472. for (var i = 0; i < _config2.default.playlists[playlist].songs.length; i++) {
  2473. shuffleTemp[i] = _config2.default.playlists[playlist].songs[i];
  2474. }
  2475. /*
  2476. Iterate ove rthe songs and generate random numbers to
  2477. swap the indexes of the shuffle array.
  2478. */
  2479. for (var _i2 = _config2.default.playlists[playlist].songs.length - 1; _i2 > 0; _i2--) {
  2480. var randNum = Math.floor(Math.random() * _config2.default.playlists[playlist].songs.length + 1);
  2481. shuffleSwap(shuffleTemp, _i2, randNum - 1);
  2482. }
  2483. /*
  2484. Set the shuffle list to the shuffle temp.
  2485. */
  2486. _config2.default.playlists[playlist].shuffle_list = shuffleTemp;
  2487. }
  2488. /**
  2489. * Swaps and randomizes the song shuffle.
  2490. *
  2491. * @access private
  2492. * @param {object} shuffleList - The list of songs that is going to be shuffled
  2493. * @param {number} original - The original index of he song in the songs array
  2494. * @param {number} random - The randomized index that will be the new index of the song in the shuffle array.
  2495. */
  2496. function shuffleSwap(shuffleList, original, random) {
  2497. var temp = shuffleList[original];
  2498. shuffleList[original] = shuffleList[random];
  2499. shuffleList[random] = temp;
  2500. }
  2501. /**
  2502. * Returns public facing methods
  2503. */
  2504. return {
  2505. setShuffle: setShuffle,
  2506. toggleShuffle: toggleShuffle,
  2507. setShufflePlaylist: setShufflePlaylist,
  2508. toggleShufflePlaylist: toggleShufflePlaylist,
  2509. shuffleSongs: shuffleSongs,
  2510. shufflePlaylistSongs: shufflePlaylistSongs
  2511. };
  2512. }(); /**
  2513. * Imports the config module
  2514. * @module config
  2515. */
  2516. exports.default = Shuffler;
  2517. module.exports = exports["default"];
  2518. /***/ }),
  2519. /* 14 */
  2520. /***/ (function(module, exports, __webpack_require__) {
  2521. "use strict";
  2522. Object.defineProperty(exports, "__esModule", {
  2523. value: true
  2524. });
  2525. var _config = __webpack_require__(0);
  2526. var _config2 = _interopRequireDefault(_config);
  2527. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2528. /**
  2529. * Defines the visual representation of AmplitudeJS song slider elements.
  2530. * @module visual/SongSliderElements
  2531. */
  2532. var SongSliderElements = function () {
  2533. /**
  2534. * Syncs all of the song slider elements.
  2535. *
  2536. * @access public
  2537. * @param {number} location - The location of the song as a percentage.
  2538. * @param {string} playlist - The playlist we are setting the song slider for.
  2539. * @param {number} songIndex - The index of the song we are adjusting the song slider for.
  2540. */
  2541. function sync(location, playlist, songIndex) {
  2542. syncMain(location);
  2543. syncPlaylist(location, playlist);
  2544. syncSong(location, songIndex);
  2545. syncSongInPlaylist(location, playlist);
  2546. }
  2547. /**
  2548. * Syncs the main slider location
  2549. *
  2550. * @access public
  2551. * @param {number} location - The location of the song as a percentage.
  2552. */
  2553. function syncMain(location) {
  2554. /*
  2555. Ensure we have a location that's a number
  2556. */
  2557. location = !isNaN(location) ? location : 0;
  2558. /*
  2559. Gets the main song sliders
  2560. */
  2561. var mainSongSliders = document.querySelectorAll(".amplitude-song-slider");
  2562. /*
  2563. Iterates over all of the main sliders and sets the value to the
  2564. percentage of the song played.
  2565. */
  2566. for (var i = 0; i < mainSongSliders.length; i++) {
  2567. /*
  2568. Grab the playlist and song attributes from the element.
  2569. */
  2570. var playlist = mainSongSliders[i].getAttribute("data-amplitude-playlist");
  2571. var song = mainSongSliders[i].getAttribute("data-amplitude-song-index");
  2572. /*
  2573. This method is responsible for only the global elements,
  2574. so we make sure there are no playlist or songs defined on
  2575. the element.
  2576. */
  2577. if (playlist == null && song == null) {
  2578. mainSongSliders[i].value = location;
  2579. }
  2580. }
  2581. }
  2582. /**
  2583. * Syncs playlist song slider locations
  2584. *
  2585. * @access public
  2586. * @param {number} location - The location of the song as a percentage.
  2587. * @param {string} playlist - The playlist we are setting the song slider for.
  2588. */
  2589. function syncPlaylist(location, playlist) {
  2590. /*
  2591. Ensure we have a location that's a number
  2592. */
  2593. location = !isNaN(location) ? location : 0;
  2594. /*
  2595. Gets the playlist song sliders
  2596. */
  2597. var playlistSongSliders = document.querySelectorAll('.amplitude-song-slider[data-amplitude-playlist="' + playlist + '"]');
  2598. /*
  2599. Iterates over all of the playlist sliders and sets the value to the
  2600. percentage of the song played.
  2601. */
  2602. for (var i = 0; i < playlistSongSliders.length; i++) {
  2603. /*
  2604. Grab the playlist and song attributes from the element.
  2605. */
  2606. var playlistAttribute = playlistSongSliders[i].getAttribute("data-amplitude-playlist");
  2607. var songAttribute = playlistSongSliders[i].getAttribute("data-amplitude-song-index");
  2608. /*
  2609. This method is responsible for only the playlist elements,
  2610. so we make sure the playlist attribute matches what is passed
  2611. in.
  2612. */
  2613. if (playlistAttribute == playlist && songAttribute == null) {
  2614. playlistSongSliders[i].value = location;
  2615. }
  2616. }
  2617. }
  2618. /**
  2619. * Syncs individual song slider locations
  2620. *
  2621. * @access public
  2622. * @param {number} location - The location of the song as a percentage.
  2623. * @param {number} songIndex - The index of the song we are adjusting the song slider for.
  2624. */
  2625. function syncSong(location, songIndex) {
  2626. /*
  2627. We only want to sync song sliders if the playlist is null.
  2628. */
  2629. if (_config2.default.active_playlist == null) {
  2630. /*
  2631. Ensure we have a location that's a number
  2632. */
  2633. location = !isNaN(location) ? location : 0;
  2634. /*
  2635. Gets the individual song sliders
  2636. */
  2637. var songSliders = document.querySelectorAll('.amplitude-song-slider[data-amplitude-song-index="' + songIndex + '"]');
  2638. /*
  2639. Iterates over all of the individual song sliders and sets the value
  2640. to the percentage of the song played.
  2641. */
  2642. for (var i = 0; i < songSliders.length; i++) {
  2643. /*
  2644. Grab the playlist and song attributes from the element.
  2645. */
  2646. var playlistAttribute = songSliders[i].getAttribute("data-amplitude-playlist");
  2647. var songAttribute = songSliders[i].getAttribute("data-amplitude-song-index");
  2648. /*
  2649. This method is responsible for only the playlist elements,
  2650. so we make sure the playlist attribute matches what is passed
  2651. in.
  2652. */
  2653. if (playlistAttribute == null && songAttribute == songIndex) {
  2654. songSliders[i].value = location;
  2655. }
  2656. }
  2657. }
  2658. }
  2659. /**
  2660. * Syncs individual song slider locations
  2661. *
  2662. * @access public
  2663. * @param {number} location - The location of the song as a percentage.
  2664. * @param {string} playlist - The playlist we are setting the song slider for.
  2665. */
  2666. function syncSongInPlaylist(location, playlist) {
  2667. /*
  2668. Ensure we have a location that's a number
  2669. */
  2670. location = !isNaN(location) ? location : 0;
  2671. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  2672. /*
  2673. Gets the song in playlist sliders
  2674. */
  2675. var songInPlaylistSliders = document.querySelectorAll('.amplitude-song-slider[data-amplitude-playlist="' + playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  2676. /*
  2677. Iterates over all of the song in playlist sliders and sets the value
  2678. to the percentage of the song played.
  2679. */
  2680. for (var i = 0; i < songInPlaylistSliders.length; i++) {
  2681. songInPlaylistSliders[i].value = location;
  2682. }
  2683. }
  2684. /**
  2685. * Visually syncs the song sliders back to 0. This usually happens when
  2686. * a song has changed, we ensure that all song sliders get reset.
  2687. *
  2688. * @access public
  2689. */
  2690. function resetElements() {
  2691. var songSliders = document.getElementsByClassName("amplitude-song-slider");
  2692. /*
  2693. Iterate over all of the song sliders and set them to
  2694. 0 essentially resetting them.
  2695. */
  2696. for (var i = 0; i < songSliders.length; i++) {
  2697. songSliders[i].value = 0;
  2698. }
  2699. }
  2700. /**
  2701. * Returns the public facing methods
  2702. */
  2703. return {
  2704. sync: sync,
  2705. syncMain: syncMain,
  2706. syncPlaylist: syncPlaylist,
  2707. syncSong: syncSong,
  2708. syncSongInPlaylist: syncSongInPlaylist,
  2709. resetElements: resetElements
  2710. };
  2711. }(); /**
  2712. * Imports the config module
  2713. * @module config
  2714. */
  2715. exports.default = SongSliderElements;
  2716. module.exports = exports["default"];
  2717. /***/ }),
  2718. /* 15 */
  2719. /***/ (function(module, exports, __webpack_require__) {
  2720. "use strict";
  2721. Object.defineProperty(exports, "__esModule", {
  2722. value: true
  2723. });
  2724. var _currentTimeElements = __webpack_require__(53);
  2725. var _currentTimeElements2 = _interopRequireDefault(_currentTimeElements);
  2726. var _currentHourElements = __webpack_require__(50);
  2727. var _currentHourElements2 = _interopRequireDefault(_currentHourElements);
  2728. var _currentMinuteElements = __webpack_require__(51);
  2729. var _currentMinuteElements2 = _interopRequireDefault(_currentMinuteElements);
  2730. var _currentSecondElements = __webpack_require__(52);
  2731. var _currentSecondElements2 = _interopRequireDefault(_currentSecondElements);
  2732. var _durationCountDownTimeElements = __webpack_require__(54);
  2733. var _durationCountDownTimeElements2 = _interopRequireDefault(_durationCountDownTimeElements);
  2734. var _durationHourElements = __webpack_require__(55);
  2735. var _durationHourElements2 = _interopRequireDefault(_durationHourElements);
  2736. var _durationMinuteElements = __webpack_require__(56);
  2737. var _durationMinuteElements2 = _interopRequireDefault(_durationMinuteElements);
  2738. var _durationSecondElements = __webpack_require__(57);
  2739. var _durationSecondElements2 = _interopRequireDefault(_durationSecondElements);
  2740. var _durationTimeElements = __webpack_require__(58);
  2741. var _durationTimeElements2 = _interopRequireDefault(_durationTimeElements);
  2742. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2743. /**
  2744. * Time Elements Interface. This allows us to update all of the sub time elements
  2745. * through one central point.
  2746. * @module visual/TimeElements
  2747. */
  2748. /**
  2749. * Imports the AmplitudeJS Duration Second Elements
  2750. * @module visual/time/DurationSecondElements
  2751. */
  2752. /**
  2753. * Imports the AmplitudeJS Duration Hour Elements
  2754. * @module visual/time/DurationHourElements
  2755. */
  2756. /**
  2757. * Imports the AmplitudeJS Current Second Elements
  2758. * @module visual/time/CurrentTimeElements
  2759. */
  2760. /**
  2761. * Imports the AmplitudeJS Current Hour Elements
  2762. * @module visual/time/CurrentHourElements
  2763. */
  2764. var TimeElements = function () {
  2765. /**
  2766. * Resets the current times.
  2767. */
  2768. function resetCurrentTimes() {
  2769. _currentTimeElements2.default.resetTimes();
  2770. _currentHourElements2.default.resetTimes();
  2771. _currentMinuteElements2.default.resetTimes();
  2772. _currentSecondElements2.default.resetTimes();
  2773. }
  2774. /**
  2775. * Syncs the current time elements to the time provided.
  2776. *
  2777. * @param {Object} currentTime - An object representing the current time of the audio.
  2778. */
  2779. function syncCurrentTimes(currentTime) {
  2780. _currentTimeElements2.default.sync(currentTime);
  2781. _currentHourElements2.default.sync(currentTime.hours);
  2782. _currentMinuteElements2.default.sync(currentTime.minutes);
  2783. _currentSecondElements2.default.sync(currentTime.seconds);
  2784. }
  2785. /**
  2786. * Resets the duration times.
  2787. */
  2788. function resetDurationTimes() {
  2789. _durationCountDownTimeElements2.default.resetTimes();
  2790. _durationHourElements2.default.resetTimes();
  2791. _durationMinuteElements2.default.resetTimes();
  2792. _durationSecondElements2.default.resetTimes();
  2793. _durationTimeElements2.default.resetTimes();
  2794. }
  2795. /**
  2796. * Syncs the duration times to the times provided.
  2797. *
  2798. * @param {Object} currentTime - An object representing the current time of the audio.
  2799. * @param {Object} songDuration - An object representing the duration of the audio
  2800. */
  2801. function syncDurationTimes(currentTime, songDuration) {
  2802. _durationCountDownTimeElements2.default.sync(currentTime, songDuration);
  2803. _durationTimeElements2.default.sync(songDuration);
  2804. _durationHourElements2.default.sync(songDuration.hours);
  2805. _durationMinuteElements2.default.sync(songDuration.minutes);
  2806. _durationSecondElements2.default.sync(songDuration.seconds);
  2807. }
  2808. /**
  2809. * Returns the publically accessible methods.
  2810. */
  2811. return {
  2812. resetCurrentTimes: resetCurrentTimes,
  2813. syncCurrentTimes: syncCurrentTimes,
  2814. resetDurationTimes: resetDurationTimes,
  2815. syncDurationTimes: syncDurationTimes
  2816. };
  2817. }();
  2818. /**
  2819. * Imports the AmplitudeJS Duration Time Elements
  2820. * @module visual/time/DurationTimeElements
  2821. */
  2822. /**
  2823. * Imports the AmplitudeJS Duration Minute Elements
  2824. * @module visual/time/DurationMinuteElements
  2825. */
  2826. /**
  2827. * Imports the AmplitudeJS Duration Count Down Time Elements
  2828. * @module visual/time/DurationCountDownTimeElements
  2829. */
  2830. /**
  2831. * Imports the AmplitudeJS Current Minute Elements
  2832. * @module visual/time/CurrentMinuteElements
  2833. */
  2834. /**
  2835. * Imports the AmplitudeJS Current Time
  2836. * @module visual/time/CurrentTimeElements
  2837. */
  2838. exports.default = TimeElements;
  2839. module.exports = exports["default"];
  2840. /***/ }),
  2841. /* 16 */
  2842. /***/ (function(module, exports, __webpack_require__) {
  2843. "use strict";
  2844. Object.defineProperty(exports, "__esModule", {
  2845. value: true
  2846. });
  2847. var _config = __webpack_require__(0);
  2848. var _config2 = _interopRequireDefault(_config);
  2849. var _debug = __webpack_require__(4);
  2850. var _debug2 = _interopRequireDefault(_debug);
  2851. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2852. /**
  2853. * Handles the visualizations elements.
  2854. *
  2855. * @module Visualizations
  2856. */
  2857. /**
  2858. * Imports the config module
  2859. * @module config
  2860. */
  2861. var Visualizations = function () {
  2862. /**
  2863. * Runs all of the visualizations on the screen.
  2864. */
  2865. function run() {
  2866. /*
  2867. Get all of the visualization elements on the page
  2868. */
  2869. var visualizationElements = document.querySelectorAll(".amplitude-visualization");
  2870. /*
  2871. If the web audio API is available, we display the visualizations.
  2872. */
  2873. if (_config2.default.web_audio_api_available) {
  2874. /*
  2875. If the visualization has not started, there are visualizations available,
  2876. and we have at least one visualization element, then we continue.
  2877. */
  2878. if (Object.keys(_config2.default.visualizations.available).length > 0 && visualizationElements.length > 0) {
  2879. /*
  2880. Iterate over all of the visualizations on the page and activate the
  2881. ones we need.
  2882. */
  2883. for (var i = 0; i < visualizationElements.length; i++) {
  2884. /*
  2885. Grab the playlist and song attributes from the visualization to
  2886. determine which one we run.
  2887. */
  2888. var playlist = visualizationElements[i].getAttribute("data-amplitude-playlist");
  2889. var song = visualizationElements[i].getAttribute("data-amplitude-song-index");
  2890. /*
  2891. If the playlist and song are null, it's a global visualization element.
  2892. */
  2893. if (playlist == null && song == null) {
  2894. runGlobalVisualization(visualizationElements[i]);
  2895. }
  2896. /*
  2897. if the playlist is not null and the song is null it's a playlist visualization
  2898. element.
  2899. */
  2900. if (playlist != null && song == null) {
  2901. runPlaylistVisualization(visualizationElements[i], playlist);
  2902. }
  2903. /*
  2904. If the playlist is null and the song is not null it's a song visualization element.
  2905. */
  2906. if (playlist == null && song != null) {
  2907. runSongVisualization(visualizationElements[i], song);
  2908. }
  2909. /*
  2910. If the playlist and song are not null then it's a song in playlist visualization
  2911. element.
  2912. */
  2913. if (playlist != null && song != null) {
  2914. runSongInPlaylistVisualization(visualizationElements[i], playlist, song);
  2915. }
  2916. }
  2917. }
  2918. } else {
  2919. displayBackups();
  2920. }
  2921. }
  2922. /**
  2923. * Runs a global visualization
  2924. *
  2925. * @param {Node} element The container element that handles the visualization.
  2926. */
  2927. function runGlobalVisualization(element) {
  2928. /*
  2929. Gets the global visualization index and the active song visualization indexes
  2930. so we know which visualization to use. The song will override the global
  2931. */
  2932. var globalVisualizationIndex = _config2.default.visualization;
  2933. var activeSongVisualizationIndex = _config2.default.active_index != null ? _config2.default.songs[_config2.default.active_index].visualization : _config2.default.playlists[_config2.default.active_playlist].songs[_config2.default.playlists[_config2.default.active_playlist].active_index].visualization;
  2934. /*
  2935. If the active song visualization is defined and the visualization exists,
  2936. use that visualization.
  2937. */
  2938. if (activeSongVisualizationIndex != undefined && _config2.default.visualizations.available[activeSongVisualizationIndex] != undefined) {
  2939. addToActiveVisualizations(activeSongVisualizationIndex, element);
  2940. /*
  2941. If the user defined a global visualization, use that one.
  2942. */
  2943. } else if (globalVisualizationIndex != undefined && _config2.default.visualizations.available[globalVisualizationIndex] != undefined) {
  2944. addToActiveVisualizations(globalVisualizationIndex, element);
  2945. /*
  2946. If the user didn't define a global visualization, use the first visualization
  2947. registered if there is one.
  2948. */
  2949. } else {
  2950. /*
  2951. Grab the first registered visualization. If it exists, use that one.
  2952. */
  2953. var firstVisualization = Object.keys(_config2.default.visualizations.available).length > 0 ? Object.keys(_config2.default.visualizations.available)[0] : null;
  2954. if (firstVisualization != null) {
  2955. addToActiveVisualizations(firstVisualization, element);
  2956. }
  2957. }
  2958. }
  2959. /**
  2960. * Run a specific playlist visualization.
  2961. *
  2962. * @param {Node} element The container element that handles the visualization.
  2963. * @param {string} playlist The key of the playlist we are running the visualization for.
  2964. */
  2965. function runPlaylistVisualization(element, playlist) {
  2966. /*
  2967. If the playlist is equal to the active playlist, then we continue.
  2968. */
  2969. if (playlist == _config2.default.active_playlist) {
  2970. /*
  2971. Checks if the song has a visualization and that visualization exists,
  2972. run that visualization.
  2973. */
  2974. var activeSongVisualizationIndex = _config2.default.playlists[_config2.default.active_playlist].songs[_config2.default.playlists[_config2.default.active_playlist].active_index].visualization;
  2975. var activePlaylistVisualizationIndex = _config2.default.playlists[_config2.default.active_playlist].visualization;
  2976. var globalVisualizationIndex = _config2.default.visualization;
  2977. /*
  2978. If the actual song has a visualization, we run that.
  2979. */
  2980. if (activeSongVisualizationIndex != undefined && _config2.default.visualizations.available[activeSongVisualizationIndex] != undefined) {
  2981. addToActiveVisualizations(activeSongVisualizationIndex, element);
  2982. /*
  2983. If the actual playlist has a visualization, run that.
  2984. */
  2985. } else if (activePlaylistVisualizationIndex != undefined && _config2.default.visualizations.available[activePlaylistVisualizationIndex] != undefined) {
  2986. addToActiveVisualizations(activePlaylistVisualizationIndex, element);
  2987. /*
  2988. If a global visualization is defined, run that.
  2989. */
  2990. } else if (globalVisualizationIndex != undefined && _config2.default.visualizations.available[globalVisualizationIndex] != undefined) {
  2991. addToActiveVisualizations(globalVisualizationIndex, element);
  2992. } else {
  2993. /*
  2994. Grab the first registered visualization. If it exists, use that one.
  2995. */
  2996. var firstVisualization = Object.keys(_config2.default.visualizations.available).length > 0 ? Object.keys(_config2.default.visualizations.available)[0] : null;
  2997. if (firstVisualization != null) {
  2998. addToActiveVisualizations(firstVisualization, element);
  2999. }
  3000. }
  3001. }
  3002. }
  3003. /**
  3004. * Run a song specific visualization.
  3005. *
  3006. * @param {Node} element The container element that handles the visualization.
  3007. * @param {string} song The song index that we are running the visualization for.
  3008. */
  3009. function runSongVisualization(element, song) {
  3010. /*
  3011. If the song is equal to the active song, then we continue.
  3012. */
  3013. if (song == _config2.default.active_index) {
  3014. /*
  3015. Get the indexes of the song
  3016. */
  3017. var activeSongVisualizationIndex = _config2.default.songs[_config2.default.active_index].visualization;
  3018. var globalVisualizationIndex = _config2.default.visualization;
  3019. /*
  3020. If the song has a visualization, run that.
  3021. */
  3022. if (activeSongVisualizationIndex != undefined && _config2.default.visualizations.available[activeSongVisualizationIndex] != undefined) {
  3023. addToActiveVisualizations(activeSongVisualizationIndex, element);
  3024. /*
  3025. If the global visualization is set, use that.
  3026. */
  3027. } else if (globalVisualizationIndex != undefined && _config2.default.visualizations.available[globalVisualizationIndex] != undefined) {
  3028. addToActiveVisualizations(globalVisualizationIndex, element);
  3029. } else {
  3030. /*
  3031. Grab the first registered visualization. If it exists, use that one.
  3032. */
  3033. var firstVisualization = Object.keys(_config2.default.visualizations.available).length > 0 ? Object.keys(_config2.default.visualizations.available)[0] : null;
  3034. if (firstVisualization != null) {
  3035. addToActiveVisualizations(firstVisualization, element);
  3036. }
  3037. }
  3038. }
  3039. }
  3040. /**
  3041. * Run a song in playlist visualization.
  3042. *
  3043. * @param {Node} element - The element containing the visualization.
  3044. * @param {string} playlist - The string of the playlist key.
  3045. * @param {index} song - The index of the song in the playlist.
  3046. */
  3047. function runSongInPlaylistVisualization(element, playlist, song) {
  3048. /*
  3049. If the playlist is the same as the active playlist and the active
  3050. index of the song is the same as the song, then we continue.
  3051. */
  3052. if (playlist == _config2.default.active_playlist && _config2.default.playlists[playlist].active_index == song) {
  3053. /*
  3054. Checks if the song has a visualization and that visualization exists,
  3055. run that visualization.
  3056. */
  3057. var activeSongVisualizationIndex = _config2.default.playlists[_config2.default.active_playlist].songs[_config2.default.playlists[_config2.default.active_playlist].active_index].visualization;
  3058. var activePlaylistVisualizationIndex = _config2.default.playlists[_config2.default.active_playlist].visualization;
  3059. var globalVisualizationIndex = _config2.default.visualization;
  3060. /*
  3061. If the active song has a visualization, we use that.
  3062. */
  3063. if (activeSongVisualizationIndex != undefined && _config2.default.visualizations.available[activeSongVisualizationIndex] != undefined) {
  3064. addToActiveVisualizations(activeSongVisualizationIndex, element);
  3065. /*
  3066. If the active playlist has a visualization, we use that.
  3067. */
  3068. } else if (activePlaylistVisualizationIndex != undefined && _config2.default.visualizations.available[activePlaylistVisualizationIndex] != undefined) {
  3069. addToActiveVisualizations(activePlaylistVisualizationIndex, element);
  3070. /*
  3071. If the global visualization has been set, we use that.
  3072. */
  3073. } else if (globalVisualizationIndex != undefined && _config2.default.visualizations.available[globalVisualizationIndex] != undefined) {
  3074. addToActiveVisualizations(globalVisualizationIndex, element);
  3075. } else {
  3076. /*
  3077. Grab the first registered visualization. If it exists, use that one.
  3078. */
  3079. var firstVisualization = Object.keys(_config2.default.visualizations.available).length > 0 ? Object.keys(_config2.default.visualizations.available)[0] : null;
  3080. if (firstVisualization != null) {
  3081. addToActiveVisualizations(firstVisualization, element);
  3082. }
  3083. }
  3084. }
  3085. }
  3086. /**
  3087. * Add a visualization to the array of active visualizations.
  3088. *
  3089. * @param {string} key - The key of the active visualization.
  3090. * @param {Node} element - The element that the visualization will be applied to.
  3091. */
  3092. function addToActiveVisualizations(key, element) {
  3093. var visualization = new _config2.default.visualizations.available[key]["object"]();
  3094. visualization.setPreferences(_config2.default.visualizations.available[key]["preferences"]);
  3095. visualization.startVisualization(element);
  3096. _config2.default.visualizations.active.push(visualization);
  3097. }
  3098. /**
  3099. * Stops all active visualizations.
  3100. */
  3101. function stop() {
  3102. /*
  3103. Iterates over all of the visualizations and stop the visualization.
  3104. */
  3105. for (var i = 0; i < _config2.default.visualizations.active.length; i++) {
  3106. _config2.default.visualizations.active[i].stopVisualization();
  3107. }
  3108. /*
  3109. Clear the active visualizations.
  3110. */
  3111. _config2.default.visualizations.active = [];
  3112. }
  3113. /**
  3114. * Registers any visualization we can use.
  3115. *
  3116. * @param {object} visualization The visualization object itself
  3117. * @param {object} preferences User preferences overrides.
  3118. */
  3119. function register(visualization, preferences) {
  3120. /*
  3121. Initialize the new visualization.
  3122. */
  3123. var newVisualization = new visualization();
  3124. /*
  3125. Adds the visualization to the global config so it knows
  3126. it can be used when playing songs.
  3127. getID is a public function for getting a visualization's id.
  3128. It becomes the key to access the visualization.
  3129. */
  3130. _config2.default.visualizations.available[newVisualization.getID()] = new Array();
  3131. _config2.default.visualizations.available[newVisualization.getID()]["object"] = visualization;
  3132. _config2.default.visualizations.available[newVisualization.getID()]["preferences"] = preferences;
  3133. }
  3134. /**
  3135. * Displays the backups for the visualizations.
  3136. */
  3137. function displayBackups() {
  3138. /*
  3139. Get all of the visualization elements on the page
  3140. */
  3141. var visualizationElements = document.querySelectorAll(".amplitude-visualization");
  3142. if (visualizationElements.length > 0) {
  3143. for (var x = 0; x < visualizationElements.length; x++) {
  3144. /*
  3145. Grab the playlist and song attributes from the visualization to
  3146. determine which one we run.
  3147. */
  3148. var playlist = visualizationElements[x].getAttribute("data-amplitude-playlist");
  3149. var song = visualizationElements[x].getAttribute("data-amplitude-song-index");
  3150. /*
  3151. If the playlist and song are null, it's a global visualization element.
  3152. */
  3153. if (playlist == null && song == null) {
  3154. displayGlobalBackup(visualizationElements[x]);
  3155. }
  3156. /*
  3157. if the playlist is not null and the song is null it's a playlist visualization
  3158. element.
  3159. */
  3160. if (playlist != null && song == null) {
  3161. displayPlaylistBackup(visualizationElements[x], playlist);
  3162. }
  3163. /*
  3164. If the playlist is null and the song is not null it's a song visualization element.
  3165. */
  3166. if (playlist == null && song != null) {
  3167. displaySongBackup(visualizationElements[x], song);
  3168. }
  3169. /*
  3170. If the playlist and song are not null then it's a song in playlist visualization
  3171. element.
  3172. */
  3173. if (playlist != null && song != null) {
  3174. displaySongInPlaylistBackup(visualizationElements[x], playlist, song);
  3175. }
  3176. }
  3177. }
  3178. }
  3179. /**
  3180. * Displays the global backup which is the cover art of the image in the
  3181. * visualization container.
  3182. *
  3183. * @param {node} element - The element we are adding the background image to.
  3184. */
  3185. function displayGlobalBackup(element) {
  3186. element.style.backgroundImage = "url(" + _config2.default.active_metadata.cover_art_url + ")";
  3187. }
  3188. /**
  3189. * Displays the playlist backup which is the cover art of the image in the
  3190. * visualization container.
  3191. *
  3192. * @param {node} element - The element we are adding the background image to.
  3193. */
  3194. function displayPlaylistBackup(element, playlist) {
  3195. if (_config2.default.active_playlist == playlist) {
  3196. element.style.backgroundImage = "url(" + _config2.default.active_metadata.cover_art_url + ")";
  3197. }
  3198. }
  3199. /**
  3200. * Displays the song backup which is the cover art of the image in the
  3201. * visualization container.
  3202. *
  3203. * @param {node} element - The element we are adding the background image to.
  3204. */
  3205. function displaySongBackup(element, song) {
  3206. if (_config2.default.active_index == song) {
  3207. element.style.backgroundImage = "url(" + _config2.default.active_metadata.cover_art_url + ")";
  3208. }
  3209. }
  3210. /**
  3211. * Displays the song in playlist backup which is the cover art of the image in the
  3212. * visualization container.
  3213. *
  3214. * @param {node} element - The element we are adding the background image to.
  3215. */
  3216. function displaySongInPlaylistBackup(element, playlist, song) {
  3217. if (_config2.default.active_playlist == playlist && _config2.default.playlists[active_playlist].active_index == song) {
  3218. element.style.backgroundImage = "url(" + _config2.default.active_metadata.cover_art_url + ")";
  3219. }
  3220. }
  3221. /*
  3222. Returns the public facing methods
  3223. */
  3224. return {
  3225. run: run,
  3226. stop: stop,
  3227. register: register
  3228. };
  3229. }();
  3230. /**
  3231. * Imports the debug module
  3232. * @module utilities/Debug
  3233. */
  3234. exports.default = Visualizations;
  3235. module.exports = exports["default"];
  3236. /***/ }),
  3237. /* 17 */
  3238. /***/ (function(module, exports, __webpack_require__) {
  3239. "use strict";
  3240. Object.defineProperty(exports, "__esModule", {
  3241. value: true
  3242. });
  3243. var _config = __webpack_require__(0);
  3244. var _config2 = _interopRequireDefault(_config);
  3245. var _init = __webpack_require__(21);
  3246. var _init2 = _interopRequireDefault(_init);
  3247. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3248. /**
  3249. * These helpers wrap around the basic methods of the Soundcloud API
  3250. * and get the information we need from SoundCloud to make the songs
  3251. * streamable through Amplitude
  3252. *
  3253. * @module soundcloud/SoundCloud
  3254. */
  3255. /**
  3256. * Imports the config module
  3257. * @module config
  3258. */
  3259. var SoundCloud = function () {
  3260. /**
  3261. * Defines the temporary user config used while we configure soundcloud
  3262. * @type {object}
  3263. */
  3264. var tempUserConfig = {};
  3265. /**
  3266. * Loads the soundcloud SDK for use with Amplitude so the user doesn't have
  3267. * to load it themselves.
  3268. * With help from: http://stackoverflow.com/questions/950087/include-a-javascript-file-in-another-javascript-file
  3269. *
  3270. * @access public
  3271. * @param {object} userConfig - The config defined by the user for AmplitudeJS
  3272. */
  3273. function loadSoundCloud(userConfig) {
  3274. /*
  3275. Sets the temporary config to the config passed by the user so we can make changes
  3276. and not break the actual config.
  3277. */
  3278. tempUserConfig = userConfig;
  3279. /*
  3280. Gets the head tag for the document and create a script element.
  3281. */
  3282. var head = document.getElementsByTagName("head")[0];
  3283. var script = document.createElement("script");
  3284. script.type = "text/javascript";
  3285. /*
  3286. URL to the remote soundcloud SDK
  3287. */
  3288. script.src = "https://connect.soundcloud.com/sdk.js";
  3289. script.onreadystatechange = initSoundcloud;
  3290. script.onload = initSoundcloud;
  3291. /*
  3292. Add the script to the head of the document.
  3293. */
  3294. head.appendChild(script);
  3295. }
  3296. /**
  3297. * Initializes soundcloud with the key provided.
  3298. *
  3299. * @access private
  3300. */
  3301. function initSoundcloud() {
  3302. /*
  3303. Calls the SoundCloud initialize function
  3304. from their API and sends it the client_id
  3305. that the user passed in.
  3306. */
  3307. SC.initialize({
  3308. client_id: _config2.default.soundcloud_client
  3309. });
  3310. /*
  3311. Gets the streamable URLs to run through Amplitue. This is
  3312. VERY important since Amplitude can't stream the copy and pasted
  3313. link from the SoundCloud page, but can resolve the streaming
  3314. URLs from the link.
  3315. */
  3316. getStreamableURLs();
  3317. }
  3318. /**
  3319. * Gets the streamable URL from the URL provided for
  3320. * all of the soundcloud links. This will loop through
  3321. * and set all of the information for the soundcloud
  3322. * urls.
  3323. *
  3324. * @access private
  3325. */
  3326. function getStreamableURLs() {
  3327. /*
  3328. Define the regex to find the soundcloud URLs
  3329. */
  3330. var soundcloud_regex = /^https?:\/\/(soundcloud.com|snd.sc)\/(.*)$/;
  3331. for (var i = 0; i < _config2.default.songs.length; i++) {
  3332. /*
  3333. If the URL matches soundcloud, we grab
  3334. that url and get the streamable link
  3335. if there is one.
  3336. */
  3337. if (_config2.default.songs[i].url.match(soundcloud_regex)) {
  3338. _config2.default.soundcloud_song_count++;
  3339. resolveStreamable(_config2.default.songs[i].url, i);
  3340. }
  3341. }
  3342. }
  3343. /**
  3344. * Resolves an individual streamable URL.
  3345. *
  3346. * @param {string} url - The URL of the SoundCloud song to get the streamable URL from.
  3347. * @param {string} playlist - The playlist we are getting the streamable URL for.
  3348. * @param {Integer} index - The index of the song in the playlist or the songs array.
  3349. * @param {boolean} addToShuffleList - Whether we add to the shuffle list for the songs or playlist.
  3350. *
  3351. */
  3352. function resolveIndividualStreamableURL(url, playlist, index) {
  3353. var addToShuffleList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3354. SC.get("/resolve/?url=" + url, function (sound) {
  3355. /*
  3356. If streamable we get the url and bind the client ID to the end
  3357. so Amplitude can just stream the song normally. We then overwrite
  3358. the url the user provided with the streamable URL.
  3359. */
  3360. if (sound.streamable) {
  3361. if (playlist != null) {
  3362. _config2.default.playlists[playlist].songs[index].url = sound.stream_url + "?client_id=" + _config2.default.soundcloud_client;
  3363. if (addToShuffleList) {
  3364. _config2.default.playlists[playlist].shuffle_list[index].url = sound.stream_url + "?client_id=" + _config2.default.soundcloud_client;
  3365. }
  3366. /*
  3367. If the user want's to use soundcloud art, we overwrite the
  3368. cover_art_url with the soundcloud artwork url.
  3369. */
  3370. if (_config2.default.soundcloud_use_art) {
  3371. _config2.default.playlists[playlist].songs[index].cover_art_url = sound.artwork_url;
  3372. if (addToShuffleList) {
  3373. _config2.default.playlists[playlist].shuffle_list[index].cover_art_url = sound.artwork_url;
  3374. }
  3375. }
  3376. /*
  3377. Grab the extra metadata from soundcloud and bind it to the
  3378. song. The user can get this through the public function:
  3379. getActiveSongMetadata
  3380. */
  3381. _config2.default.playlists[playlist].songs[index].soundcloud_data = sound;
  3382. if (addToShuffleList) {
  3383. _config2.default.playlists[playlist].shuffle_list[index].soundcloud_data = sound;
  3384. }
  3385. } else {
  3386. _config2.default.songs[index].url = sound.stream_url + "?client_id=" + _config2.default.soundcloud_client;
  3387. if (addToShuffleList) {
  3388. _config2.default.shuffle_list[index].stream_url + "?client_id=" + _config2.default.soundcloud_client;
  3389. }
  3390. /*
  3391. If the user want's to use soundcloud art, we overwrite the
  3392. cover_art_url with the soundcloud artwork url.
  3393. */
  3394. if (_config2.default.soundcloud_use_art) {
  3395. _config2.default.songs[index].cover_art_url = sound.artwork_url;
  3396. if (addToShuffleList) {
  3397. _config2.default.shuffle_list[index].cover_art_url = sound.artwork_url;
  3398. }
  3399. }
  3400. /*
  3401. Grab the extra metadata from soundcloud and bind it to the
  3402. song. The user can get this through the public function:
  3403. getActiveSongMetadata
  3404. */
  3405. _config2.default.songs[index].soundcloud_data = sound;
  3406. if (addToShuffleList) {
  3407. _config2.default.shuffle_list[index].soundcloud_data = sound;
  3408. }
  3409. }
  3410. } else {
  3411. if (playlist != null) {
  3412. AmplitudeHelpers.writeDebugMessage(_config2.default.playlists[playlist].songs[index].name + " by " + _config2.default.playlists[playlist].songs[index].artist + " is not streamable by the Soundcloud API");
  3413. } else {
  3414. /*
  3415. If not streamable, then we print a message to the user stating
  3416. that the song with name X and artist X is not streamable. This
  3417. gets printed ONLY if they have debug turned on.
  3418. */
  3419. AmplitudeHelpers.writeDebugMessage(_config2.default.songs[index].name + " by " + _config2.default.songs[index].artist + " is not streamable by the Soundcloud API");
  3420. }
  3421. }
  3422. });
  3423. }
  3424. /**
  3425. * Due to Soundcloud SDK being asynchronous, we need to scope the
  3426. * index of the song in another function. The privateGetSoundcloudStreamableURLs
  3427. * function does the actual iteration and scoping.
  3428. *
  3429. * @access private
  3430. * @param {string} url - URL of the soundcloud song
  3431. * @param {number} index - The index of the soundcloud song in the songs array.
  3432. */
  3433. function resolveStreamable(url, index) {
  3434. SC.get("/resolve/?url=" + url, function (sound) {
  3435. /*
  3436. If streamable we get the url and bind the client ID to the end
  3437. so Amplitude can just stream the song normally. We then overwrite
  3438. the url the user provided with the streamable URL.
  3439. */
  3440. if (sound.streamable) {
  3441. _config2.default.songs[index].url = sound.stream_url + "?client_id=" + _config2.default.soundcloud_client;
  3442. /*
  3443. If the user want's to use soundcloud art, we overwrite the
  3444. cover_art_url with the soundcloud artwork url.
  3445. */
  3446. if (_config2.default.soundcloud_use_art) {
  3447. _config2.default.songs[index].cover_art_url = sound.artwork_url;
  3448. }
  3449. /*
  3450. Grab the extra metadata from soundcloud and bind it to the
  3451. song. The user can get this through the public function:
  3452. getActiveSongMetadata
  3453. */
  3454. _config2.default.songs[index].soundcloud_data = sound;
  3455. } else {
  3456. /*
  3457. If not streamable, then we print a message to the user stating
  3458. that the song with name X and artist X is not streamable. This
  3459. gets printed ONLY if they have debug turned on.
  3460. */
  3461. AmplitudeHelpers.writeDebugMessage(_config2.default.songs[index].name + " by " + _config2.default.songs[index].artist + " is not streamable by the Soundcloud API");
  3462. }
  3463. /*
  3464. Increments the song ready counter.
  3465. */
  3466. _config2.default.soundcloud_songs_ready++;
  3467. /*
  3468. When all songs are accounted for, then amplitude is ready
  3469. to rock and we set the rest of the config.
  3470. */
  3471. if (_config2.default.soundcloud_songs_ready == _config2.default.soundcloud_song_count) {
  3472. _init2.default.setConfig(tempUserConfig);
  3473. }
  3474. });
  3475. }
  3476. /**
  3477. * Determines if a given URL is a SoundCloud URL.
  3478. *
  3479. * @param {string} url - The URL to test if it's a SoundCloud URL.
  3480. */
  3481. function isSoundCloudURL(url) {
  3482. var soundcloud_regex = /^https?:\/\/(soundcloud.com|snd.sc)\/(.*)$/;
  3483. return url.match(soundcloud_regex);
  3484. }
  3485. /*
  3486. Returns the publically accessible methods
  3487. */
  3488. return {
  3489. loadSoundCloud: loadSoundCloud,
  3490. resolveIndividualStreamableURL: resolveIndividualStreamableURL,
  3491. isSoundCloudURL: isSoundCloudURL
  3492. };
  3493. }();
  3494. /**
  3495. * Imports the initializer
  3496. * @module init/AmplitudeInitializer
  3497. */
  3498. exports.default = SoundCloud;
  3499. module.exports = exports["default"];
  3500. /***/ }),
  3501. /* 18 */
  3502. /***/ (function(module, exports, __webpack_require__) {
  3503. "use strict";
  3504. Object.defineProperty(exports, "__esModule", {
  3505. value: true
  3506. });
  3507. var _config = __webpack_require__(0);
  3508. var _config2 = _interopRequireDefault(_config);
  3509. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3510. /**
  3511. * Defines the Playback Speed Visual Elements Handler
  3512. * @module visual/PlaybackSpeedElements
  3513. */
  3514. var PlaybackSpeedElements = function () {
  3515. /**
  3516. * Sets all of the visual playback speed buttons to have the right class
  3517. * to display the background image that represents the current playback
  3518. * speed.
  3519. *
  3520. * @access public
  3521. */
  3522. function sync() {
  3523. /*
  3524. Gets all of the playback speed classes.
  3525. */
  3526. var playbackSpeedClasses = document.getElementsByClassName("amplitude-playback-speed");
  3527. /*
  3528. Iterates over all of the playback speed classes
  3529. applying the right speed class for visual purposes.
  3530. */
  3531. for (var i = 0; i < playbackSpeedClasses.length; i++) {
  3532. /*
  3533. Removes all of the old playback speed classes.
  3534. */
  3535. playbackSpeedClasses[i].classList.remove("amplitude-playback-speed-10");
  3536. playbackSpeedClasses[i].classList.remove("amplitude-playback-speed-15");
  3537. playbackSpeedClasses[i].classList.remove("amplitude-playback-speed-20");
  3538. /*
  3539. Switch the current playback speed and apply the appropriate
  3540. speed class.
  3541. */
  3542. switch (_config2.default.playback_speed) {
  3543. case 1:
  3544. playbackSpeedClasses[i].classList.add("amplitude-playback-speed-10");
  3545. break;
  3546. case 1.5:
  3547. playbackSpeedClasses[i].classList.add("amplitude-playback-speed-15");
  3548. break;
  3549. case 2:
  3550. playbackSpeedClasses[i].classList.add("amplitude-playback-speed-20");
  3551. break;
  3552. }
  3553. }
  3554. }
  3555. /**
  3556. * Returns the public facing methods
  3557. */
  3558. return {
  3559. sync: sync
  3560. };
  3561. }(); /**
  3562. * Imports the config module
  3563. * @module config
  3564. */
  3565. exports.default = PlaybackSpeedElements;
  3566. module.exports = exports["default"];
  3567. /***/ }),
  3568. /* 19 */
  3569. /***/ (function(module, exports, __webpack_require__) {
  3570. "use strict";
  3571. Object.defineProperty(exports, "__esModule", {
  3572. value: true
  3573. });
  3574. var _config = __webpack_require__(0);
  3575. var _config2 = _interopRequireDefault(_config);
  3576. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3577. /**
  3578. * Handles all of the shuffle elements
  3579. * @module visual/ShuffleElements
  3580. */
  3581. var ShuffleElements = function () {
  3582. /**
  3583. * Syncs the global shuffle button visual state.
  3584. *
  3585. * @access public
  3586. */
  3587. function syncMain() {
  3588. /*
  3589. Gets the shuffle buttons.
  3590. */
  3591. var shuffleButtons = document.getElementsByClassName("amplitude-shuffle");
  3592. /*
  3593. Iterate over all of the shuffle buttons.
  3594. */
  3595. for (var i = 0; i < shuffleButtons.length; i++) {
  3596. /*
  3597. Ensure the shuffle button doesn't belong to a playlist. We have
  3598. a separate method for that.
  3599. */
  3600. if (shuffleButtons[i].getAttribute("data-amplitude-playlist") == null) {
  3601. /*
  3602. If the state of the player is shuffled on, true, then
  3603. we add the 'amplitude-shuffle-on' class and remove the
  3604. 'amplitude-shuffle-off' class. If the player is not shuffled
  3605. then we do the opposite.
  3606. */
  3607. if (_config2.default.shuffle_on) {
  3608. shuffleButtons[i].classList.add("amplitude-shuffle-on");
  3609. shuffleButtons[i].classList.remove("amplitude-shuffle-off");
  3610. } else {
  3611. shuffleButtons[i].classList.add("amplitude-shuffle-off");
  3612. shuffleButtons[i].classList.remove("amplitude-shuffle-on");
  3613. }
  3614. }
  3615. }
  3616. }
  3617. /**
  3618. * Syncs the playlist shuffle button visual state.
  3619. *
  3620. * @access public
  3621. * @param {string} playlist - The playlist string the shuffle button belongs to.
  3622. */
  3623. function syncPlaylist(playlist) {
  3624. /*
  3625. Gets all of the shuffle buttons.
  3626. */
  3627. var shuffleButtons = document.querySelectorAll('.amplitude-shuffle[data-amplitude-playlist="' + playlist + '"]');
  3628. /*
  3629. Iterate over all of the shuffle buttons
  3630. */
  3631. for (var i = 0; i < shuffleButtons.length; i++) {
  3632. /*
  3633. If the state of the playlist is shuffled on, true, then
  3634. we add the 'amplitude-shuffle-on' class and remove the
  3635. 'amplitude-shuffle-off' class. If the player is not shuffled
  3636. then we do the opposite.
  3637. */
  3638. if (_config2.default.playlists[playlist].shuffle) {
  3639. shuffleButtons[i].classList.add("amplitude-shuffle-on");
  3640. shuffleButtons[i].classList.remove("amplitude-shuffle-off");
  3641. } else {
  3642. shuffleButtons[i].classList.add("amplitude-shuffle-off");
  3643. shuffleButtons[i].classList.remove("amplitude-shuffle-on");
  3644. }
  3645. }
  3646. }
  3647. /**
  3648. * Returns public facing methods
  3649. */
  3650. return {
  3651. syncMain: syncMain,
  3652. syncPlaylist: syncPlaylist
  3653. };
  3654. }(); /**
  3655. * Imports the config module
  3656. * @module config
  3657. */
  3658. exports.default = ShuffleElements;
  3659. module.exports = exports["default"];
  3660. /***/ }),
  3661. /* 20 */
  3662. /***/ (function(module, exports, __webpack_require__) {
  3663. "use strict";
  3664. Object.defineProperty(exports, "__esModule", {
  3665. value: true
  3666. });
  3667. var _config = __webpack_require__(0);
  3668. var _config2 = _interopRequireDefault(_config);
  3669. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3670. /**
  3671. * Handles the syncing of the song played progress elements.
  3672. *
  3673. * @module visual/SongPlayedProgressElements
  3674. */
  3675. var SongPlayedProgressElements = function () {
  3676. /**
  3677. * Syncs the song played progress bars. These are HTML5 progress elements.
  3678. *
  3679. * @access private
  3680. * @param {number} songPlayedPercentage - The percentage of the song that has been played.
  3681. */
  3682. function sync(songPlayedPercentage) {
  3683. syncGlobal(songPlayedPercentage);
  3684. syncPlaylist(songPlayedPercentage);
  3685. syncSong(songPlayedPercentage);
  3686. syncSongInPlaylist(songPlayedPercentage);
  3687. }
  3688. /**
  3689. * Sync how much has been played with a progress bar. This is the global progress bar.
  3690. *
  3691. * @access private
  3692. * @param {number} songPlayedPercentage - The percent of the song completed.
  3693. */
  3694. function syncGlobal(percentage) {
  3695. /*
  3696. Ensure that the song completion percentage is a number
  3697. */
  3698. if (!isNaN(percentage)) {
  3699. /*
  3700. Get all of the song progress bars
  3701. */
  3702. var songPlayedProgressBars = document.querySelectorAll(".amplitude-song-played-progress");
  3703. for (var i = 0; i < songPlayedProgressBars.length; i++) {
  3704. var playlist = songPlayedProgressBars[i].getAttribute("data-amplitude-playlist");
  3705. var songIndex = songPlayedProgressBars[i].getAttribute("data-amplitude-song-index");
  3706. if (playlist == null && songIndex == null) {
  3707. var max = songPlayedProgressBars[i].max;
  3708. songPlayedProgressBars[i].value = percentage / 100 * max;
  3709. }
  3710. }
  3711. }
  3712. }
  3713. /**
  3714. * Sync how much has been played with a progress bar. This is the playlist progress bar.
  3715. *
  3716. * @access public
  3717. * @param {number} songPlayedPercentage - The percent of the song completed.
  3718. */
  3719. function syncPlaylist(percentage) {
  3720. /*
  3721. Ensure that the song completion percentage is a number
  3722. */
  3723. if (!isNaN(percentage)) {
  3724. /*
  3725. Get all of the song progress bars
  3726. */
  3727. var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  3728. for (var i = 0; i < songPlayedProgressBars.length; i++) {
  3729. var song = songPlayedProgressBars[i].getAttribute("data-amplitude-song-index");
  3730. if (song == null) {
  3731. var max = songPlayedProgressBars[i].max;
  3732. songPlayedProgressBars[i].value = percentage / 100 * max;
  3733. }
  3734. }
  3735. }
  3736. }
  3737. /**
  3738. * Sync how much has been played with a progress bar. This is for an individual song.
  3739. *
  3740. * @access private
  3741. * @param {number} songPlayedPercentage - The percent of the song completed.
  3742. */
  3743. function syncSong(percentage) {
  3744. if (_config2.default.active_playlist == null) {
  3745. /*
  3746. Ensure that the song completion percentage is a number
  3747. */
  3748. if (!isNaN(percentage)) {
  3749. /*
  3750. Get all of the song progress bars
  3751. */
  3752. var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  3753. for (var i = 0; i < songPlayedProgressBars.length; i++) {
  3754. var playlist = songPlayedProgressBars[i].getAttribute("data-amplitude-playlist");
  3755. if (playlist == null) {
  3756. var max = songPlayedProgressBars[i].max;
  3757. songPlayedProgressBars[i].value = percentage / 100 * max;
  3758. }
  3759. }
  3760. }
  3761. }
  3762. }
  3763. /**
  3764. * Sync how much has been played with a progress bar. This is for an individual song in playlist.
  3765. *
  3766. * @access private
  3767. * @param {number} songPlayedPercentage - The percent of the song completed.
  3768. */
  3769. function syncSongInPlaylist(percentage) {
  3770. /*
  3771. Ensure that the song completion percentage is a number
  3772. */
  3773. if (!isNaN(percentage)) {
  3774. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  3775. /*
  3776. Get all of the song progress bars
  3777. */
  3778. var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  3779. /*
  3780. Iterates over all of the song played progress elements
  3781. and sets them accordingly.
  3782. */
  3783. for (var i = 0; i < songPlayedProgressBars.length; i++) {
  3784. var playlist = songPlayedProgressBars[i].getAttribute("data-amplitude-playlist");
  3785. var songIndex = songPlayedProgressBars[i].getAttribute("data-amplitude-song-index");
  3786. if (playlist != null && songIndex != null) {
  3787. var max = songPlayedProgressBars[i].max;
  3788. songPlayedProgressBars[i].value = percentage / 100 * max;
  3789. }
  3790. }
  3791. }
  3792. }
  3793. /**
  3794. * Sets all of the song played progress bars to 0
  3795. *
  3796. * @access public
  3797. */
  3798. function resetElements() {
  3799. var songPlayedProgressBars = document.getElementsByClassName("amplitude-song-played-progress");
  3800. for (var i = 0; i < songPlayedProgressBars.length; i++) {
  3801. songPlayedProgressBars[i].value = 0;
  3802. }
  3803. }
  3804. return {
  3805. sync: sync,
  3806. resetElements: resetElements
  3807. };
  3808. }(); /**
  3809. * Imports the config module
  3810. * @module config
  3811. */
  3812. exports.default = SongPlayedProgressElements;
  3813. module.exports = exports["default"];
  3814. /***/ }),
  3815. /* 21 */
  3816. /***/ (function(module, exports, __webpack_require__) {
  3817. "use strict";
  3818. Object.defineProperty(exports, "__esModule", {
  3819. value: true
  3820. });
  3821. var _typeof = 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; }; /**
  3822. * Imports the config module
  3823. * @module config
  3824. */
  3825. /**
  3826. * AmplitudeJS Core Module
  3827. * @module core/Core
  3828. */
  3829. /**
  3830. * AmplitudeJS SoundCloud Module
  3831. * @module soundcloud/SoundCloud
  3832. */
  3833. /**
  3834. * Imports the utilities used by the main module.
  3835. */
  3836. /**
  3837. * AmplitudeJS Config State Module
  3838. * @module utilities/ConfigState
  3839. */
  3840. /**
  3841. * AmplitudeJS Debug Module
  3842. * @module utilities/Debug
  3843. */
  3844. /**
  3845. * AmplitudeJS Checks Module
  3846. * @module utilities/Checks
  3847. */
  3848. /**
  3849. * AmplitudeJS Shuffler Module
  3850. * @module utilities/Shuffler
  3851. */
  3852. /**
  3853. * AmplitudeJS Events Module
  3854. * @module events/Events
  3855. */
  3856. /**
  3857. * AmplitudeJS FX Module
  3858. * @module fx/Fx
  3859. */
  3860. /**
  3861. * AmplitudeJS Visualizations Module
  3862. * @module fx/Visualizations
  3863. */
  3864. /**
  3865. * AmplitudeJS WaveForm Module
  3866. * @module fx/WaveForm
  3867. */
  3868. /**
  3869. * AmplitudeJS Audio Navigation Module.
  3870. * @module utilities/AudioNavigation
  3871. */
  3872. /**
  3873. * AmplitudeJS Callbacks Module
  3874. * @module utilities/Callbacks
  3875. */
  3876. /**
  3877. * AmplitudeJS Playlists Initializer Module
  3878. * @module init/Playlists
  3879. */
  3880. /**
  3881. * Imports the AmplitudeJS Shuffle Elements
  3882. * @module visual/ShuffleElements
  3883. */
  3884. /**
  3885. * Imports the AmplitudeJS Mute Elements
  3886. * @module visual/MuteElements
  3887. */
  3888. /**
  3889. * Imports the AmplitudeJS Volume Slider
  3890. * @module visual/VolumeSliderElements
  3891. */
  3892. /**
  3893. * Imports the AmplitudeJS Time Elements
  3894. * @module visual/TimeElements
  3895. */
  3896. /**
  3897. * Imports the AmplitudeJS Play/Pause Elements Module.
  3898. * @module visual/PlayPauseElements
  3899. */
  3900. /**
  3901. * Imports the AmplitudeJS MetaData Elements Module.
  3902. * @module visual/MetaDataElements
  3903. */
  3904. /**
  3905. * Imports the AmplitudeJS PlaybackSpeedElements Module.
  3906. * @module visual/PlayBackSpeedElements
  3907. */
  3908. /**
  3909. * Imports the AmplitudeJS Repeat Element
  3910. * @module visual/RepeatElements
  3911. */
  3912. var _config = __webpack_require__(0);
  3913. var _config2 = _interopRequireDefault(_config);
  3914. var _core = __webpack_require__(1);
  3915. var _core2 = _interopRequireDefault(_core);
  3916. var _soundcloud = __webpack_require__(17);
  3917. var _soundcloud2 = _interopRequireDefault(_soundcloud);
  3918. var _configState = __webpack_require__(6);
  3919. var _configState2 = _interopRequireDefault(_configState);
  3920. var _debug = __webpack_require__(4);
  3921. var _debug2 = _interopRequireDefault(_debug);
  3922. var _checks = __webpack_require__(5);
  3923. var _checks2 = _interopRequireDefault(_checks);
  3924. var _shuffler = __webpack_require__(13);
  3925. var _shuffler2 = _interopRequireDefault(_shuffler);
  3926. var _events = __webpack_require__(26);
  3927. var _events2 = _interopRequireDefault(_events);
  3928. var _fx = __webpack_require__(46);
  3929. var _fx2 = _interopRequireDefault(_fx);
  3930. var _visualizations = __webpack_require__(16);
  3931. var _visualizations2 = _interopRequireDefault(_visualizations);
  3932. var _waveform = __webpack_require__(22);
  3933. var _waveform2 = _interopRequireDefault(_waveform);
  3934. var _audioNavigation = __webpack_require__(3);
  3935. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  3936. var _callbacks = __webpack_require__(9);
  3937. var _callbacks2 = _interopRequireDefault(_callbacks);
  3938. var _playlists = __webpack_require__(48);
  3939. var _playlists2 = _interopRequireDefault(_playlists);
  3940. var _shuffleElements = __webpack_require__(19);
  3941. var _shuffleElements2 = _interopRequireDefault(_shuffleElements);
  3942. var _muteElements = __webpack_require__(10);
  3943. var _muteElements2 = _interopRequireDefault(_muteElements);
  3944. var _volumeSliderElements = __webpack_require__(11);
  3945. var _volumeSliderElements2 = _interopRequireDefault(_volumeSliderElements);
  3946. var _timeElements = __webpack_require__(15);
  3947. var _timeElements2 = _interopRequireDefault(_timeElements);
  3948. var _playPauseElements = __webpack_require__(2);
  3949. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  3950. var _metaDataElements = __webpack_require__(7);
  3951. var _metaDataElements2 = _interopRequireDefault(_metaDataElements);
  3952. var _playbackSpeedElements = __webpack_require__(18);
  3953. var _playbackSpeedElements2 = _interopRequireDefault(_playbackSpeedElements);
  3954. var _repeatElements = __webpack_require__(8);
  3955. var _repeatElements2 = _interopRequireDefault(_repeatElements);
  3956. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3957. /**
  3958. * AmplitudeJS Initializer Module. Helps with the handling of all of the
  3959. * initialization for AmplitudeJS.
  3960. *
  3961. * @module init/Initializer
  3962. */
  3963. var Initializer = function () {
  3964. /**
  3965. * The main init function. The user will call this through
  3966. * Amplitude.init({}) and pass in their settings.
  3967. *
  3968. * Public Accessor: Amplitude.init( user_config_json )
  3969. * @access public
  3970. * @param {object} userConfig - A JSON object of user defined values that help configure and initialize AmplitudeJS.
  3971. */
  3972. function initialize(userConfig) {
  3973. var ready = false;
  3974. /*
  3975. Reset the config on init so we have a clean slate. This is if the
  3976. user has to re-init.
  3977. */
  3978. _configState2.default.resetConfig();
  3979. /*
  3980. Initialize event handlers on init. This will clear any old
  3981. event handlers on the amplitude element and re-bind what is
  3982. necessary.
  3983. */
  3984. _events2.default.initialize();
  3985. /*
  3986. Initialize the callbacks we listen to for the audio object.
  3987. */
  3988. _callbacks2.default.initialize();
  3989. /*
  3990. Initializes debugging right away so we can use it for the rest
  3991. of the configuration.
  3992. */
  3993. _config2.default.debug = userConfig.debug != undefined ? userConfig.debug : false;
  3994. /*
  3995. Set default artwork, if specified.
  3996. */
  3997. setArt(userConfig);
  3998. /*
  3999. Checks to see if the user has songs defined.
  4000. */
  4001. if (userConfig.songs) {
  4002. /*
  4003. Checks to see if the user has some songs in the songs array.
  4004. */
  4005. if (userConfig.songs.length != 0) {
  4006. /*
  4007. Copies over the user defined songs. and prepares
  4008. Amplitude for the rest of the configuration.
  4009. */
  4010. _config2.default.songs = userConfig.songs;
  4011. /*
  4012. Flag amplitude as ready.
  4013. */
  4014. ready = true;
  4015. } else {
  4016. _debug2.default.writeMessage("Please add some songs, to your songs object!");
  4017. }
  4018. } else {
  4019. _debug2.default.writeMessage("Please provide a songs object for AmplitudeJS to run!");
  4020. }
  4021. /*
  4022. Initializes the audio context. In this method it checks to see if the
  4023. user wants to use visualizations or not before proceeding.
  4024. */
  4025. if (_fx2.default.webAudioAPIAvailable()) {
  4026. if (_fx2.default.determineUsingAnyFX()) {
  4027. /*
  4028. Configure the Web Audio API If It's available.
  4029. */
  4030. _fx2.default.configureWebAudioAPI();
  4031. /*
  4032. Activates the audio context after an event for the user.
  4033. */
  4034. document.documentElement.addEventListener("mousedown", function () {
  4035. if (_config2.default.context.state !== "running") {
  4036. _config2.default.context.resume();
  4037. }
  4038. });
  4039. document.documentElement.addEventListener("keydown", function () {
  4040. if (_config2.default.context.state !== "running") {
  4041. _config2.default.context.resume();
  4042. }
  4043. });
  4044. document.documentElement.addEventListener("keyup", function () {
  4045. if (_config2.default.context.state !== "running") {
  4046. _config2.default.context.resume();
  4047. }
  4048. });
  4049. /*
  4050. Set the user waveform settings if provided.
  4051. */
  4052. if (userConfig.waveforms != undefined && userConfig.waveforms.sample_rate != undefined) {
  4053. _config2.default.waveforms.sample_rate = userConfig.waveforms.sample_rate;
  4054. }
  4055. /*
  4056. Initialize the waveform.
  4057. */
  4058. _waveform2.default.init();
  4059. /*
  4060. If the user is registering visualizations on init,
  4061. we set them right away.
  4062. */
  4063. if (userConfig.visualizations != undefined && userConfig.visualizations.length > 0) {
  4064. /*
  4065. Iterate over all of the visualizations and
  4066. register them in our player.
  4067. */
  4068. for (var i = 0; i < userConfig.visualizations.length; i++) {
  4069. _visualizations2.default.register(userConfig.visualizations[i].object, userConfig.visualizations[i].params);
  4070. }
  4071. }
  4072. }
  4073. } else {
  4074. _debug2.default.writeMessage("The Web Audio API is not available on this platform. We are using your defined backups!");
  4075. }
  4076. /*
  4077. Initialize default live settings
  4078. */
  4079. initializeDefaultLiveSettings();
  4080. /*
  4081. Initialize default song indexes
  4082. */
  4083. initializeDefaultSongIndexes();
  4084. /*
  4085. When the preliminary config is ready, we are ready to proceed.
  4086. */
  4087. if (ready) {
  4088. /*
  4089. Copies over the soundcloud information to the global config
  4090. which will determine where we go from there.
  4091. */
  4092. _config2.default.soundcloud_client = userConfig.soundcloud_client != undefined ? userConfig.soundcloud_client : "";
  4093. /*
  4094. Checks if we want to use the art loaded from soundcloud.
  4095. */
  4096. _config2.default.soundcloud_use_art = userConfig.soundcloud_use_art != undefined ? userConfig.soundcloud_use_art : "";
  4097. /*
  4098. If the user provides a soundcloud client then we assume that
  4099. there are URLs in their songs that will reference SoundCloud.
  4100. We then copy over the user config they provided to the
  4101. temp_user_config so we don't mess up the global or their configs
  4102. and load the soundcloud information.
  4103. */
  4104. var tempUserConfig = {};
  4105. /*
  4106. If there's a soundcloud_client key set, we load the SoundCloud data
  4107. for all of the songs in the array.
  4108. */
  4109. if (_config2.default.soundcloud_client != "") {
  4110. tempUserConfig = userConfig;
  4111. /*
  4112. Load up SoundCloud for use with AmplitudeJS.
  4113. */
  4114. _soundcloud2.default.loadSoundCloud(tempUserConfig);
  4115. } else {
  4116. /*
  4117. The user is not using Soundcloud with Amplitude at this point
  4118. so we just finish the configuration with the users's preferences.
  4119. */
  4120. setConfig(userConfig);
  4121. }
  4122. }
  4123. /*
  4124. Debug out what was initialized with AmplitudeJS.
  4125. */
  4126. _debug2.default.writeMessage("Initialized With: ");
  4127. _debug2.default.writeMessage(_config2.default);
  4128. }
  4129. /**
  4130. * Rebinds all of the elements in the display.
  4131. *
  4132. * Public Accessor: Amplitude.rebindDisplay()
  4133. * @access public
  4134. */
  4135. function rebindDisplay() {
  4136. _events2.default.initialize();
  4137. _metaDataElements2.default.displayMetaData();
  4138. }
  4139. /**
  4140. * Finishes the initalization of the config. Takes all of the user defined
  4141. * parameters and makes sure they override the defaults. The important
  4142. * config information is assigned in the publicInit() function.
  4143. *
  4144. * This function can be called from 2 different locations:
  4145. * 1. Right away on init after the important settings are defined.
  4146. *
  4147. * 2. After all of the Soundcloud URLs are resolved properly and
  4148. * soundcloud is configured. We will need the proper URLs from Soundcloud
  4149. * to stream through Amplitude so we get those right away before we
  4150. * set the information and the active song
  4151. *
  4152. * @access public
  4153. * @param {object} userConfig - A JSON object of user defined values that help configure and initialize AmplitudeJS.
  4154. */
  4155. function setConfig(userConfig) {
  4156. /*
  4157. Checks if the user has any playlists defined. If they do
  4158. we have to initialize the functionality for the playlists.
  4159. */
  4160. if (userConfig.playlists && countPlaylists(userConfig.playlists) > 0) {
  4161. _playlists2.default.initialize(userConfig.playlists);
  4162. }
  4163. /*
  4164. Check to see if the user entered a start song
  4165. */
  4166. if (userConfig.start_song != undefined && !userConfig.starting_playlist) {
  4167. /*
  4168. Ensure what has been entered is an integer.
  4169. */
  4170. if (_checks2.default.isInt(userConfig.start_song)) {
  4171. _audioNavigation2.default.changeSong(_config2.default.songs[userConfig.start_song], userConfig.start_song);
  4172. } else {
  4173. _debug2.default.writeMessage("You must enter an integer index for the start song.");
  4174. }
  4175. } else {
  4176. _audioNavigation2.default.changeSong(_config2.default.songs[0], 0);
  4177. }
  4178. /*
  4179. If the shuffle is on by default, shuffle the songs and
  4180. switch to the shuffled song.
  4181. */
  4182. if (userConfig.shuffle_on != undefined && userConfig.shuffle_on) {
  4183. _config2.default.shuffle_on = true;
  4184. _shuffler2.default.shuffleSongs();
  4185. _audioNavigation2.default.changeSong(_config2.default.shuffle_list[0], 0);
  4186. }
  4187. /*
  4188. Allows the user to set whether they want to continue to the next song
  4189. when the current song finishes or not. In any scenario that's not a playlist,
  4190. contining to the next song may not be desired.
  4191. */
  4192. _config2.default.continue_next = userConfig.continue_next != undefined ? userConfig.continue_next : true;
  4193. /*
  4194. If the user defined a playback speed, we copy over their
  4195. preference here, otherwise we default to normal playback
  4196. speed of 1.0.
  4197. */
  4198. _config2.default.playback_speed = userConfig.playback_speed != undefined ? userConfig.playback_speed : 1.0;
  4199. /*
  4200. Sets the audio playback speed.
  4201. */
  4202. _core2.default.setPlaybackSpeed(_config2.default.playback_speed);
  4203. /*
  4204. If the user wants the song to be pre-loaded for instant
  4205. playback, they set it to true. By default it's set to just
  4206. load the metadata.
  4207. */
  4208. _config2.default.audio.preload = userConfig.preload != undefined ? userConfig.preload : "auto";
  4209. /*
  4210. Initializes the user defined callbacks. This should be a JSON
  4211. object that contains a key->value store of the callback name
  4212. and the name of the function the user needs to call.
  4213. */
  4214. _config2.default.callbacks = userConfig.callbacks != undefined ? userConfig.callbacks : {};
  4215. /*
  4216. Initializes the user defined key bindings. This should be a JSON
  4217. object that contains a key->value store of the key event number
  4218. pressed and the method to be run.
  4219. */
  4220. _config2.default.bindings = userConfig.bindings != undefined ? userConfig.bindings : {};
  4221. /*
  4222. The user can define a starting volume in a range of 0-100 with
  4223. 0 being muted and 100 being the loudest. After the config is set
  4224. Amplitude sets the active song's volume to the volume defined
  4225. by the user.
  4226. */
  4227. _config2.default.volume = userConfig.volume != undefined ? userConfig.volume : 50;
  4228. /*
  4229. Sets the delay between songs if the user has it set. This should be in MS.
  4230. */
  4231. _config2.default.delay = userConfig.delay != undefined ? userConfig.delay : 0;
  4232. /*
  4233. The user can set the volume increment and decrement values between 1 and 100
  4234. for when the volume up or down button is pressed. The default is an increase
  4235. or decrease of 5.
  4236. */
  4237. _config2.default.volume_increment = userConfig.volume_increment != undefined ? userConfig.volume_increment : 5;
  4238. _config2.default.volume_decrement = userConfig.volume_decrement != undefined ? userConfig.volume_decrement : 5;
  4239. /*
  4240. Set the volume to what is defined in the config. The user can define this,
  4241. so we should set it up that way.
  4242. */
  4243. _core2.default.setVolume(_config2.default.volume);
  4244. /*
  4245. Set default artwork, if specified
  4246. */
  4247. setArt(userConfig);
  4248. /*
  4249. Initialize the visual elements
  4250. */
  4251. initializeElements();
  4252. /*
  4253. If the user has selected a starting playlist, we need to set the starting playlist
  4254. and sync the visuals
  4255. */
  4256. if (userConfig.starting_playlist != undefined && userConfig.starting_playlist != "") {
  4257. /*
  4258. Set the active playlist to the starting playlist by the user
  4259. */
  4260. _config2.default.active_playlist = userConfig.starting_playlist;
  4261. /*
  4262. Check if the user defined a song to start with in the playlist.
  4263. */
  4264. if (userConfig.starting_playlist_song != undefined && userConfig.starting_playlist_song != "") {
  4265. /*
  4266. Ensure the song is a valid index.
  4267. */
  4268. if (_typeof(userConfig.playlists[userConfig.starting_playlist].songs[parseInt(userConfig.starting_playlist_song)]) != undefined) {
  4269. /*
  4270. Set the player to the song defined by the user.
  4271. */
  4272. _audioNavigation2.default.changeSongPlaylist(_config2.default.active_playlist, userConfig.playlists[userConfig.starting_playlist].songs[parseInt(userConfig.starting_playlist_song)], parseInt(userConfig.starting_playlist_song));
  4273. } else {
  4274. /*
  4275. Set the player to the first song in the playlist
  4276. */
  4277. _audioNavigation2.default.changeSongPlaylist(_config2.default.active_playlist, userConfig.playlists[userConfig.starting_playlist].songs[0], 0);
  4278. /*
  4279. Debug that the song index doesn't exist
  4280. */
  4281. _debug2.default.writeMessage("The index of " + userConfig.starting_playlist_song + " does not exist in the playlist " + userConfig.starting_playlist);
  4282. }
  4283. } else {
  4284. /*
  4285. Set the player to the first song in the playlist
  4286. */
  4287. _audioNavigation2.default.changeSong(_config2.default.active_playlist, userConfig.playlists[userConfig.starting_playlist].songs[0], 0);
  4288. }
  4289. /*
  4290. Sync the main and song play pause buttons.
  4291. */
  4292. _playPauseElements2.default.sync();
  4293. }
  4294. /*
  4295. Run after init callback
  4296. */
  4297. _callbacks2.default.run("initialized");
  4298. }
  4299. /**
  4300. * Sets the default_album_art and default_playlist_art from the
  4301. * user supplied configuration.
  4302. *
  4303. * @access public
  4304. * @param {object} userConfig - A JSON object of user defined values that help configure and initialize AmplitudeJS.
  4305. */
  4306. function setArt(userConfig) {
  4307. /*
  4308. If the user defines default album art, this image will display if the active
  4309. song doesn't have album art defined.
  4310. */
  4311. if (userConfig.default_album_art != undefined) {
  4312. _config2.default.default_album_art = userConfig.default_album_art;
  4313. } else {
  4314. _config2.default.default_album_art = "";
  4315. }
  4316. /*
  4317. If the user defines default playlist art, this image will display if the user
  4318. tries to set up a playlist meta data image tag but doesn't have one defined.
  4319. */
  4320. if (userConfig.default_playlist_art != undefined) {
  4321. _config2.default.default_playlist_art = userConfig.default_playlist_art;
  4322. } else {
  4323. _config2.default.default_playlist_art = "";
  4324. }
  4325. }
  4326. /**
  4327. * Initializes all of the elements on the page to the default starting point
  4328. * to build from there.
  4329. *
  4330. * @access private
  4331. */
  4332. function initializeElements() {
  4333. /*
  4334. Visually sync the shuffle statuses
  4335. */
  4336. _shuffleElements2.default.syncMain();
  4337. /*
  4338. Sync Mute Elements.
  4339. */
  4340. _muteElements2.default.setMuted(_config2.default.volume == 0 ? true : false);
  4341. /*
  4342. Sync Volume Slider Elements
  4343. */
  4344. _volumeSliderElements2.default.sync();
  4345. /*
  4346. Syncs all of the playback speed elements.
  4347. */
  4348. _playbackSpeedElements2.default.sync();
  4349. /*
  4350. Syncs all of the visual time elements to 00.
  4351. */
  4352. _timeElements2.default.resetCurrentTimes();
  4353. /*
  4354. Sets all of the play pause buttons to pause.
  4355. */
  4356. _playPauseElements2.default.syncToPause();
  4357. /*
  4358. Sets the meta data for the songs automatically.
  4359. */
  4360. _metaDataElements2.default.syncMetaData();
  4361. /*
  4362. Sets the repeat buttons automatically.
  4363. */
  4364. _repeatElements2.default.syncRepeatSong();
  4365. }
  4366. /**
  4367. * Counts the number of playlists the user has configured. This ensures
  4368. * that the user has at least 1 playlist so we can validate the songs
  4369. * defined in the playlist are correct and they didn't enter an invalid
  4370. * ID.
  4371. *
  4372. * @access private
  4373. * @param {object} playlists -
  4374. */
  4375. function countPlaylists(playlists) {
  4376. /*
  4377. Initialize the placeholders to iterate through the playlists
  4378. and find out how many we have to account for.
  4379. */
  4380. var size = 0,
  4381. key = void 0;
  4382. /*
  4383. Iterate over playlists and if the user has the playlist defined,
  4384. increment the size of playlists.
  4385. */
  4386. for (key in playlists) {
  4387. if (playlists.hasOwnProperty(key)) {
  4388. size++;
  4389. }
  4390. }
  4391. /*
  4392. Debug how many playlists are in the config.
  4393. */
  4394. _debug2.default.writeMessage("You have " + size + " playlist(s) in your config");
  4395. /*
  4396. Return the number of playlists in the config.
  4397. */
  4398. return size;
  4399. }
  4400. /**
  4401. * Intializes the default live settings for all of the songs.
  4402. *
  4403. * @access private
  4404. */
  4405. function initializeDefaultLiveSettings() {
  4406. for (var i = 0; i < _config2.default.songs.length; i++) {
  4407. if (_config2.default.songs[i].live == undefined) {
  4408. _config2.default.songs[i].live = false;
  4409. }
  4410. }
  4411. }
  4412. /**
  4413. * Initializes the index of the song in the songs array so
  4414. * we can reference it if needed
  4415. *
  4416. * @access private
  4417. */
  4418. function initializeDefaultSongIndexes() {
  4419. for (var i = 0; i < _config2.default.songs.length; i++) {
  4420. _config2.default.songs[i].index = i;
  4421. }
  4422. }
  4423. /*
  4424. Returns the publicly accessible methods
  4425. */
  4426. return {
  4427. initialize: initialize,
  4428. setConfig: setConfig,
  4429. rebindDisplay: rebindDisplay
  4430. };
  4431. }();
  4432. exports.default = Initializer;
  4433. module.exports = exports["default"];
  4434. /***/ }),
  4435. /* 22 */
  4436. /***/ (function(module, exports, __webpack_require__) {
  4437. "use strict";
  4438. Object.defineProperty(exports, "__esModule", {
  4439. value: true
  4440. });
  4441. var _config = __webpack_require__(0);
  4442. var _config2 = _interopRequireDefault(_config);
  4443. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4444. /**
  4445. * Builds a waveform for the current audio.
  4446. * Help from: https://robots.thoughtbot.com/javascript-audio-api
  4447. * https://stackoverflow.com/questions/21347833/html-svg-not-drawing-works-in-other-pages
  4448. */
  4449. var WaveForm = function () {
  4450. /*
  4451. Initialize the local variables used in the Waveform.
  4452. */
  4453. var buffer = "";
  4454. var sampleRate = "";
  4455. var peaks = "";
  4456. function init() {
  4457. sampleRate = _config2.default.waveforms.sample_rate;
  4458. /*
  4459. Grabs all of the waveform elements on the page.
  4460. */
  4461. var waveforms = document.querySelectorAll(".amplitude-wave-form");
  4462. /*
  4463. If there are waveforms, we iterate over them and set them up to display
  4464. properly.
  4465. */
  4466. if (waveforms.length > 0) {
  4467. /*
  4468. Iterate over all of the waveforms and build the SVG parts.
  4469. */
  4470. for (var i = 0; i < waveforms.length; i++) {
  4471. /*
  4472. Clear the inner HTML of the element if we are replacing the waveform.
  4473. */
  4474. waveforms[i].innerHTML = "";
  4475. /*
  4476. Inserts an SVG into the element.
  4477. */
  4478. var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  4479. svg.setAttribute("viewBox", "0 -1 " + sampleRate + " 2");
  4480. svg.setAttribute("preserveAspectRatio", "none");
  4481. /*
  4482. Add a g component to the SVG
  4483. */
  4484. var g = document.createElementNS("http://www.w3.org/2000/svg", "g");
  4485. svg.appendChild(g);
  4486. /*
  4487. Add a path component to the g
  4488. */
  4489. var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
  4490. path.setAttribute("d", "");
  4491. path.setAttribute("id", "waveform");
  4492. g.appendChild(path);
  4493. /*
  4494. Append the SVG to the waveform.
  4495. */
  4496. waveforms[i].appendChild(svg);
  4497. }
  4498. }
  4499. }
  4500. /**
  4501. * Builds each waveform for the page.
  4502. */
  4503. function build() {
  4504. if (_config2.default.web_audio_api_available) {
  4505. /*
  4506. If we don't have the wave form built, we need to build the waveform by loading
  4507. the src with an array buffer.
  4508. */
  4509. if (_config2.default.waveforms.built[Math.abs(_config2.default.audio.src.split("").reduce(function (a, b) {
  4510. a = (a << 5) - a + b.charCodeAt(0);
  4511. return a & a;
  4512. }, 0))] == undefined) {
  4513. /*
  4514. Initializes a new XML Http Request.
  4515. */
  4516. var req = new XMLHttpRequest();
  4517. /*
  4518. Opens the src parameter for the audio file to read in.
  4519. */
  4520. req.open("GET", _config2.default.audio.src, true);
  4521. req.responseType = "arraybuffer";
  4522. /*
  4523. When the ready state changes, check to see if we can render the
  4524. wave form.
  4525. */
  4526. req.onreadystatechange = function (e) {
  4527. /*
  4528. When the request is complete, then we begin decoding the
  4529. audio to build the waveform.
  4530. */
  4531. if (req.readyState == 4) {
  4532. /*
  4533. If the status is 200 means the response is a success and
  4534. we decode the audio data.
  4535. */
  4536. if (req.status == 200) {
  4537. /*
  4538. Decode the audio data and process the waveform.
  4539. */
  4540. _config2.default.context.decodeAudioData(req.response, function (bufferedAudio) {
  4541. /*
  4542. Set the buffer to the audio returned.
  4543. */
  4544. buffer = bufferedAudio;
  4545. /*
  4546. Get the peaks in the audio.
  4547. */
  4548. peaks = getPeaks(sampleRate, buffer);
  4549. /*
  4550. Build the SVG
  4551. */
  4552. process(sampleRate, buffer, peaks);
  4553. });
  4554. }
  4555. }
  4556. };
  4557. req.send();
  4558. } else {
  4559. /*
  4560. If we already have a waveform, we grab the waveform that
  4561. was created for the song and display it. We do a simple hash
  4562. of the song URL so it's already unique.
  4563. */
  4564. displayWaveForms(_config2.default.waveforms.built[Math.abs(_config2.default.audio.src.split("").reduce(function (a, b) {
  4565. a = (a << 5) - a + b.charCodeAt(0);
  4566. return a & a;
  4567. }, 0))]);
  4568. }
  4569. }
  4570. }
  4571. /**
  4572. * Processes the audio and generates the waveform.
  4573. *
  4574. * @param {sampleRate} sampleRate - The rate we should sample the audio.
  4575. * @param {arraybuffer} buffer - The Web Audio API
  4576. * @param {array} peaks - The peaks in the audio.
  4577. */
  4578. function process(sampleRate, buffer, peaks) {
  4579. /*
  4580. If we have a buffer, we find the peaks in the audio.
  4581. */
  4582. if (buffer) {
  4583. /*
  4584. Get the total peaks in the song.
  4585. */
  4586. var totalPeaks = peaks.length;
  4587. /*
  4588. Figure out the depth of the peak.
  4589. */
  4590. var d = "";
  4591. for (var peakNumber = 0; peakNumber < totalPeaks; peakNumber++) {
  4592. if (peakNumber % 2 === 0) {
  4593. d += " M" + ~~(peakNumber / 2) + ", " + peaks.shift();
  4594. } else {
  4595. d += " L" + ~~(peakNumber / 2) + ", " + peaks.shift();
  4596. }
  4597. }
  4598. /*
  4599. Add the waveform to the built waveforms array.
  4600. */
  4601. _config2.default.waveforms.built[Math.abs(_config2.default.audio.src.split("").reduce(function (a, b) {
  4602. a = (a << 5) - a + b.charCodeAt(0);
  4603. return a & a;
  4604. }, 0))] = d;
  4605. /*
  4606. Display the waveform.
  4607. */
  4608. displayWaveForms(_config2.default.waveforms.built[Math.abs(_config2.default.audio.src.split("").reduce(function (a, b) {
  4609. a = (a << 5) - a + b.charCodeAt(0);
  4610. return a & a;
  4611. }, 0))]);
  4612. }
  4613. }
  4614. /**
  4615. * Get the peaks of the audio for the waveform.
  4616. *
  4617. * @param {number} length - The sample size of the audio.
  4618. * @param {array} buffer - The array buffer used to find the peaks in the audio.
  4619. */
  4620. function getPeaks(length, buffer) {
  4621. /*
  4622. Set the parameters needed to build the SVG.
  4623. */
  4624. var sampleSize = buffer.length / length;
  4625. var sampleStep = ~~(sampleSize / 10) || 1;
  4626. var numberOfChannels = buffer.numberOfChannels;
  4627. var mergedPeaks = [];
  4628. /*
  4629. Iterate over the channels and find the peaks.
  4630. */
  4631. for (var channelNumber = 0; channelNumber < numberOfChannels; channelNumber++) {
  4632. /*
  4633. Initialize the peaks array and set the channel data to what
  4634. the buffer has in its channel data.
  4635. */
  4636. var _peaks = [];
  4637. var channelData = buffer.getChannelData(channelNumber);
  4638. /*
  4639. Iterate over peaks with respect to the sample size.
  4640. */
  4641. for (var peakNumber = 0; peakNumber < length; peakNumber++) {
  4642. /*
  4643. Gt the start and end peak.
  4644. */
  4645. var start = ~~(peakNumber * sampleSize);
  4646. var end = ~~(start + sampleSize);
  4647. /*
  4648. Set min and max to the channel data first peak.
  4649. */
  4650. var min = channelData[0];
  4651. var max = channelData[0];
  4652. /*
  4653. Iterate over the parts of the song starting to the
  4654. ending to display the waveform.
  4655. */
  4656. for (var sampleIndex = start; sampleIndex < end; sampleIndex += sampleStep) {
  4657. var value = channelData[sampleIndex];
  4658. if (value > max) {
  4659. max = value;
  4660. }
  4661. if (value < min) {
  4662. min = value;
  4663. }
  4664. }
  4665. /*
  4666. Set the max and min for the peak.
  4667. */
  4668. _peaks[2 * peakNumber] = max;
  4669. _peaks[2 * peakNumber + 1] = min;
  4670. /*
  4671. Merge the peaks
  4672. */
  4673. if (channelNumber === 0 || max > mergedPeaks[2 * peakNumber]) {
  4674. mergedPeaks[2 * peakNumber] = max;
  4675. }
  4676. if (channelNumber === 0 || min < mergedPeaks[2 * peakNumber + 1]) {
  4677. mergedPeaks[2 * peakNumber + 1] = min;
  4678. }
  4679. }
  4680. }
  4681. /*
  4682. Returns the merged peaks.
  4683. */
  4684. return mergedPeaks;
  4685. }
  4686. /**
  4687. * Displays all of the waveforms necessary.
  4688. *
  4689. * @param {path} svg - The drawing of the waveform.
  4690. */
  4691. function displayWaveForms(svg) {
  4692. var waveformElements = document.querySelectorAll(".amplitude-wave-form");
  4693. /*
  4694. Iterate over all of the waveform elements and
  4695. display the waveform.
  4696. */
  4697. for (var i = 0; i < waveformElements.length; i++) {
  4698. /*
  4699. Get the playlist attribute of the waveform element.
  4700. */
  4701. var playlist = waveformElements[i].getAttribute("data-amplitude-playlist");
  4702. /*
  4703. Get the song index attribute of the waveform element.
  4704. */
  4705. var song = waveformElements[i].getAttribute("data-amplitude-song-index");
  4706. /*
  4707. If the playlist is null and the song is null it's a global element.
  4708. */
  4709. if (playlist == null && song == null) {
  4710. displayGlobalWaveform(waveformElements[i], svg);
  4711. }
  4712. /*
  4713. If the playlist is defined but the song is null it's a playlist element.
  4714. */
  4715. if (playlist != null && song == null) {
  4716. displayPlaylistWaveform(waveformElements[i], svg, playlist);
  4717. }
  4718. /*
  4719. If the playlist is not defined and the song is not null it's a song
  4720. element.
  4721. */
  4722. if (playlist == null && song != null) {
  4723. displaySongWaveform(waveformElements[i], svg, song);
  4724. }
  4725. /*
  4726. If the playlist and song are defined it's a song in the playlist element.
  4727. */
  4728. if (playlist != null && song != null) {
  4729. displaySongInPlaylistWaveform(waveformElements[i], svg, playlist, song);
  4730. }
  4731. }
  4732. }
  4733. /**
  4734. * Displays a global wave form.
  4735. *
  4736. * @param {Node} element - Element to display the waveform in.
  4737. * @param {SVG} svg - The waveform path.
  4738. */
  4739. function displayGlobalWaveform(element, svg) {
  4740. var waveformPath = element.querySelector("svg g path");
  4741. waveformPath.setAttribute("d", svg);
  4742. }
  4743. /**
  4744. * Displays a playlist wave form.
  4745. *
  4746. * @param {Node} element - Element to display the waveform in.
  4747. * @param {SVG} svg - The waveform path.
  4748. * @param {string} playlist - The playlist we are displaying the waveform for.
  4749. */
  4750. function displayPlaylistWaveform(element, svg, playlist) {
  4751. /*
  4752. Ensure the playlist is the active playlist.
  4753. */
  4754. if (_config2.default.active_playlist == playlist) {
  4755. var waveformPath = element.querySelector("svg g path");
  4756. waveformPath.setAttribute("d", svg);
  4757. }
  4758. }
  4759. /**
  4760. * Displays a song wave form.
  4761. *
  4762. * @param {Node} element - Element to display the waveform in.
  4763. * @param {SVG} svg - The waveform path.
  4764. * @param {Integer} song - The index of the song we are displaying the
  4765. * waveform for.
  4766. */
  4767. function displaySongWaveform(element, svg, song) {
  4768. /*
  4769. Ensure it's the active song being displayed.
  4770. */
  4771. if (_config2.default.active_index == song) {
  4772. var waveformPath = element.querySelector("svg g path");
  4773. waveformPath.setAttribute("d", svg);
  4774. }
  4775. }
  4776. /**
  4777. * Displays a song in playlist waveform.
  4778. *
  4779. * @param {Node} element - Element to display the waveform in.
  4780. * @param {SVG} svg - The waveform path.
  4781. * @param {String} playlist - The playlist the waveform is in.
  4782. * @param {Integer} song - The index of the song we are displaying the waveform for.
  4783. */
  4784. function displaySongInPlaylistWaveform(element, svg, playlist, song) {
  4785. /*
  4786. Ensure it's the active song in the active playlist.
  4787. */
  4788. if (_config2.default.active_playlist == playlist && _config2.default.playlists[_config2.default.active_playlist].active_index == song) {
  4789. var waveformPath = element.querySelector("svg g path");
  4790. waveformPath.setAttribute("d", svg);
  4791. }
  4792. }
  4793. /**
  4794. * Determines if the user is using waveforms
  4795. */
  4796. function determineIfUsingWaveforms() {
  4797. var waveforms = document.querySelectorAll(".amplitude-wave-form");
  4798. if (waveforms.length > 0) {
  4799. return true;
  4800. } else {
  4801. return false;
  4802. }
  4803. }
  4804. /*
  4805. Return the public methods.
  4806. */
  4807. return {
  4808. init: init,
  4809. build: build,
  4810. determineIfUsingWaveforms: determineIfUsingWaveforms
  4811. };
  4812. }(); /**
  4813. * Imports the config module
  4814. * @module config
  4815. */
  4816. exports.default = WaveForm;
  4817. module.exports = exports["default"];
  4818. /***/ }),
  4819. /* 23 */
  4820. /***/ (function(module, exports, __webpack_require__) {
  4821. "use strict";
  4822. Object.defineProperty(exports, "__esModule", {
  4823. value: true
  4824. });
  4825. var _config = __webpack_require__(0);
  4826. var _config2 = _interopRequireDefault(_config);
  4827. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4828. /**
  4829. * The utility to handle the computation of time in AmplitudeJS.
  4830. * @module utilities/Time
  4831. */
  4832. var Time = function () {
  4833. /**
  4834. * Computes the current song time. Breaks down where the song is into
  4835. * hours, minutes, seconds and formats it to be displayed to the user.
  4836. *
  4837. * @access public
  4838. */
  4839. function computeCurrentTimes() {
  4840. /*
  4841. Initialize the current time object that will be returned.
  4842. */
  4843. var currentTime = {};
  4844. /*
  4845. Computes the current seconds for the song.
  4846. */
  4847. var currentSeconds = (Math.floor(_config2.default.audio.currentTime % 60) < 10 ? "0" : "") + Math.floor(_config2.default.audio.currentTime % 60);
  4848. /*
  4849. Computes the current minutes for the song.
  4850. */
  4851. var currentMinutes = Math.floor(_config2.default.audio.currentTime / 60);
  4852. /*
  4853. Initialize the current hours variable.
  4854. */
  4855. var currentHours = "00";
  4856. /*
  4857. If the current minutes is less than 10, we add a leading 0.
  4858. */
  4859. if (currentMinutes < 10) {
  4860. currentMinutes = "0" + currentMinutes;
  4861. }
  4862. /*
  4863. If the user is more than 60 minutes into the song, then
  4864. we extract the hours.
  4865. */
  4866. if (currentMinutes >= 60) {
  4867. currentHours = Math.floor(currentMinutes / 60);
  4868. currentMinutes = currentMinutes % 60;
  4869. /*
  4870. If the user is less than 10 minutes in, we append the
  4871. additional 0 to the minutes.
  4872. */
  4873. if (currentMinutes < 10) {
  4874. currentMinutes = "0" + currentMinutes;
  4875. }
  4876. }
  4877. /*
  4878. Build a clean current time object and send back the appropriate information.
  4879. */
  4880. currentTime.seconds = currentSeconds;
  4881. currentTime.minutes = currentMinutes;
  4882. currentTime.hours = currentHours;
  4883. return currentTime;
  4884. }
  4885. /**
  4886. * Computes the current song duration. Breaks down where the song is into
  4887. * hours, minutes, seconds and formats it to be displayed to the user.
  4888. *
  4889. * @access public
  4890. */
  4891. function computeSongDuration() {
  4892. /*
  4893. Initialize the song duration object that will be returned.
  4894. */
  4895. var songDuration = {};
  4896. /*
  4897. Computes the duration of the song's seconds.
  4898. */
  4899. var songDurationSeconds = (Math.floor(_config2.default.audio.duration % 60) < 10 ? "0" : "") + Math.floor(_config2.default.audio.duration % 60);
  4900. /*
  4901. Computes the duration of the song's minutes.
  4902. */
  4903. var songDurationMinutes = Math.floor(_config2.default.audio.duration / 60);
  4904. /*
  4905. Initialize the hours duration variable.
  4906. */
  4907. var songDurationHours = "00";
  4908. /*
  4909. If the song duration minutes is less than 10, we add a leading 0.
  4910. */
  4911. if (songDurationMinutes < 10) {
  4912. songDurationMinutes = "0" + songDurationMinutes;
  4913. }
  4914. /*
  4915. If there is more than 60 minutes in the song, then we
  4916. extract the hours.
  4917. */
  4918. if (songDurationMinutes >= 60) {
  4919. songDurationHours = Math.floor(songDurationMinutes / 60);
  4920. songDurationMinutes = songDurationMinutes % 60;
  4921. /*
  4922. If the song duration minutes is less than 10 we append
  4923. the additional 0.
  4924. */
  4925. if (songDurationMinutes < 10) {
  4926. songDurationMinutes = "0" + songDurationMinutes;
  4927. }
  4928. }
  4929. /*
  4930. Build a clean song duration object and send back the appropriate information.
  4931. */
  4932. songDuration.seconds = isNaN(songDurationSeconds) ? "00" : songDurationSeconds;
  4933. songDuration.minutes = isNaN(songDurationMinutes) ? "00" : songDurationMinutes;
  4934. songDuration.hours = isNaN(songDurationHours) ? "00" : songDurationHours.toString();
  4935. return songDuration;
  4936. }
  4937. /**
  4938. * Computes the song completion percentage.
  4939. *
  4940. * @access public
  4941. */
  4942. function computeSongCompletionPercentage() {
  4943. return _config2.default.audio.currentTime / _config2.default.audio.duration * 100;
  4944. }
  4945. /**
  4946. * Sets the current time for the audio.
  4947. *
  4948. * @access public
  4949. */
  4950. function setCurrentTime(time) {
  4951. /*
  4952. If the song is not live, we can set the current time.
  4953. */
  4954. if (!_config2.default.active_metadata.live) {
  4955. /*
  4956. Makes sure the number is finite to set the time.
  4957. */
  4958. if (isFinite(time)) {
  4959. _config2.default.audio.currentTime = time;
  4960. }
  4961. }
  4962. }
  4963. /**
  4964. * Defines what is returned by the module
  4965. */
  4966. return {
  4967. computeCurrentTimes: computeCurrentTimes,
  4968. computeSongDuration: computeSongDuration,
  4969. computeSongCompletionPercentage: computeSongCompletionPercentage,
  4970. setCurrentTime: setCurrentTime
  4971. };
  4972. }(); /**
  4973. * Imports the config module
  4974. * @module config
  4975. */
  4976. exports.default = Time;
  4977. module.exports = exports["default"];
  4978. /***/ }),
  4979. /* 24 */
  4980. /***/ (function(module, exports, __webpack_require__) {
  4981. "use strict";
  4982. Object.defineProperty(exports, "__esModule", {
  4983. value: true
  4984. });
  4985. var _config = __webpack_require__(0);
  4986. var _config2 = _interopRequireDefault(_config);
  4987. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4988. /**
  4989. * AmplitudeJS Visual Handler for Buffered Progress Elements
  4990. *
  4991. * @module visual/BufferedProgressElements
  4992. */
  4993. var BufferedProgressElements = function () {
  4994. /**
  4995. * Syncs the buffered progress bars to the current percentage in the config
  4996. *
  4997. * @access public
  4998. */
  4999. function sync() {
  5000. syncGlobal();
  5001. syncPlaylist();
  5002. syncSong();
  5003. syncSongInPlaylist();
  5004. }
  5005. /**
  5006. * Sync the global song buffered progress elements.
  5007. */
  5008. function syncGlobal() {
  5009. /*
  5010. Gets all of the song buffered progress bars.
  5011. */
  5012. var songBufferedProgressBars = document.getElementsByClassName("amplitude-buffered-progress");
  5013. /*
  5014. Iterate over all of the song buffered progress bar and
  5015. set them to 0 which is like re-setting them.
  5016. */
  5017. for (var i = 0; i < songBufferedProgressBars.length; i++) {
  5018. var playlist = songBufferedProgressBars[i].getAttribute("data-amplitude-playlist");
  5019. var song = songBufferedProgressBars[i].getAttribute("data-amplitude-song-index");
  5020. if (playlist == null && song == null && !isNaN(_config2.default.buffered)) {
  5021. songBufferedProgressBars[i].value = parseFloat(parseFloat(_config2.default.buffered) / 100);
  5022. }
  5023. }
  5024. }
  5025. /**
  5026. * Sync the playlist song buffered progress elements.
  5027. */
  5028. function syncPlaylist() {
  5029. /*
  5030. Gets all of the song buffered progress bars.
  5031. */
  5032. var songBufferedProgressBarsPlaylist = document.querySelectorAll('.amplitude-buffered-progress[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  5033. /*
  5034. Iterate over all of the song buffered progress bar and
  5035. set them to 0 which is like re-setting them.
  5036. */
  5037. for (var i = 0; i < songBufferedProgressBarsPlaylist.length; i++) {
  5038. var song = songBufferedProgressBarsPlaylist[i].getAttribute("data-amplitude-song-index");
  5039. if (song == null && !isNaN(_config2.default.buffered)) {
  5040. songBufferedProgressBarsPlaylist[i].value = parseFloat(parseFloat(_config2.default.buffered) / 100);
  5041. }
  5042. }
  5043. }
  5044. /**
  5045. * Sync the song song buffered progress elements.
  5046. */
  5047. function syncSong() {
  5048. /*
  5049. Gets all of the song buffered progress bars.
  5050. */
  5051. var songBufferedProgressBarsSongs = document.querySelectorAll('.amplitude-buffered-progress[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  5052. /*
  5053. Iterate over all of the song buffered progress bar and
  5054. set them to 0 which is like re-setting them.
  5055. */
  5056. for (var i = 0; i < songBufferedProgressBarsSongs.length; i++) {
  5057. var playlist = songBufferedProgressBarsSongs[i].getAttribute("data-amplitude-playlist");
  5058. if (playlist == null && !isNaN(_config2.default.buffered)) {
  5059. songBufferedProgressBarsSongs[i].value = parseFloat(parseFloat(_config2.default.buffered) / 100);
  5060. }
  5061. }
  5062. }
  5063. /**
  5064. * Sync the song in playlist song buffered progress elements.
  5065. */
  5066. function syncSongInPlaylist() {
  5067. var activePlaylistIndex = _config2.default.active_playlist != null && _config2.default.active_playlist != "" ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  5068. /*
  5069. Gets all of the song buffered progress bars.
  5070. */
  5071. var songBufferedProgressBarsSongsInPlaylist = document.querySelectorAll('.amplitude-buffered-progress[data-amplitude-song-index="' + activePlaylistIndex + '"][data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  5072. /*
  5073. Iterate over all of the song buffered progress bar and
  5074. set them to 0 which is like re-setting them.
  5075. */
  5076. for (var i = 0; i < songBufferedProgressBarsSongsInPlaylist.length; i++) {
  5077. if (!isNaN(_config2.default.buffered)) {
  5078. songBufferedProgressBarsSongsInPlaylist[i].value = parseFloat(parseFloat(_config2.default.buffered) / 100);
  5079. }
  5080. }
  5081. }
  5082. /**
  5083. * Sets all of the song buffered progress bars to 0
  5084. *
  5085. * @access public
  5086. */
  5087. function reset() {
  5088. /*
  5089. Gets all of the song buffered progress bars.
  5090. */
  5091. var songBufferedProgressBars = document.getElementsByClassName("amplitude-buffered-progress");
  5092. /*
  5093. Iterate over all of the song buffered progress bar and
  5094. set them to 0 which is like re-setting them.
  5095. */
  5096. for (var i = 0; i < songBufferedProgressBars.length; i++) {
  5097. songBufferedProgressBars[i].value = 0;
  5098. }
  5099. }
  5100. /**
  5101. * Returns the public facing methods
  5102. */
  5103. return {
  5104. sync: sync,
  5105. reset: reset
  5106. };
  5107. }(); /**
  5108. * Imports the config module
  5109. * @module config
  5110. */
  5111. exports.default = BufferedProgressElements;
  5112. module.exports = exports["default"];
  5113. /***/ }),
  5114. /* 25 */
  5115. /***/ (function(module, exports, __webpack_require__) {
  5116. "use strict";
  5117. Object.defineProperty(exports, "__esModule", {
  5118. value: true
  5119. });
  5120. var _config = __webpack_require__(0);
  5121. var _config2 = _interopRequireDefault(_config);
  5122. var _audioNavigation = __webpack_require__(3);
  5123. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  5124. var _core = __webpack_require__(1);
  5125. var _core2 = _interopRequireDefault(_core);
  5126. var _playPauseElements = __webpack_require__(2);
  5127. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  5128. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5129. /**
  5130. * AmplitudeJS Ended Module. Handles the ended event on the audio.
  5131. *
  5132. * @module events/Ended
  5133. */
  5134. /**
  5135. * Imports the AmplitudeJS Core Methods
  5136. * @module core/Core
  5137. */
  5138. /**
  5139. * Imports the config module
  5140. * @module config
  5141. */
  5142. var Ended = function () {
  5143. /**
  5144. * When the song has ended, handles what to do next
  5145. *
  5146. * HANDLER FOR: ended
  5147. *
  5148. * @access public
  5149. */
  5150. function handle() {
  5151. /*
  5152. Sets the time out for song ended. This determines if
  5153. we should go to the next song or delay between songs.
  5154. */
  5155. setTimeout(function () {
  5156. /*
  5157. If we continue next, we should move to the next song in the playlist.
  5158. */
  5159. if (_config2.default.continue_next) {
  5160. /*
  5161. If the active playlist is not set, we set the
  5162. next song that's in the songs array.
  5163. */
  5164. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  5165. _audioNavigation2.default.setNext(true);
  5166. } else {
  5167. _audioNavigation2.default.setNextPlaylist(_config2.default.active_playlist, true);
  5168. }
  5169. } else {
  5170. if (!_config2.default.is_touch_moving) {
  5171. /*
  5172. Stops the active song.
  5173. */
  5174. _core2.default.stop();
  5175. /*
  5176. Sync the play pause elements.
  5177. */
  5178. _playPauseElements2.default.sync();
  5179. }
  5180. }
  5181. }, _config2.default.delay);
  5182. }
  5183. /*
  5184. Returns the public facing methods.
  5185. */
  5186. return {
  5187. handle: handle
  5188. };
  5189. }();
  5190. /**
  5191. * Imports the AmplitudeJS Play Pause Elements
  5192. * @module visual/PlayPauseElements
  5193. */
  5194. /**
  5195. * Imports the Audio Navigation Utility
  5196. * @module utilities/AudioNavigation
  5197. */
  5198. exports.default = Ended;
  5199. module.exports = exports["default"];
  5200. /***/ }),
  5201. /* 26 */
  5202. /***/ (function(module, exports, __webpack_require__) {
  5203. "use strict";
  5204. Object.defineProperty(exports, "__esModule", {
  5205. value: true
  5206. });
  5207. var _config = __webpack_require__(0);
  5208. var _config2 = _interopRequireDefault(_config);
  5209. var _keydown = __webpack_require__(27);
  5210. var _keydown2 = _interopRequireDefault(_keydown);
  5211. var _timeUpdate = __webpack_require__(42);
  5212. var _timeUpdate2 = _interopRequireDefault(_timeUpdate);
  5213. var _ended = __webpack_require__(25);
  5214. var _ended2 = _interopRequireDefault(_ended);
  5215. var _progress = __webpack_require__(35);
  5216. var _progress2 = _interopRequireDefault(_progress);
  5217. var _play = __webpack_require__(31);
  5218. var _play2 = _interopRequireDefault(_play);
  5219. var _pause = __webpack_require__(30);
  5220. var _pause2 = _interopRequireDefault(_pause);
  5221. var _playPause = __webpack_require__(32);
  5222. var _playPause2 = _interopRequireDefault(_playPause);
  5223. var _stop = __webpack_require__(41);
  5224. var _stop2 = _interopRequireDefault(_stop);
  5225. var _mute = __webpack_require__(28);
  5226. var _mute2 = _interopRequireDefault(_mute);
  5227. var _volumeUp = __webpack_require__(45);
  5228. var _volumeUp2 = _interopRequireDefault(_volumeUp);
  5229. var _volumeDown = __webpack_require__(43);
  5230. var _volumeDown2 = _interopRequireDefault(_volumeDown);
  5231. var _songSlider = __webpack_require__(40);
  5232. var _songSlider2 = _interopRequireDefault(_songSlider);
  5233. var _volumeSlider = __webpack_require__(44);
  5234. var _volumeSlider2 = _interopRequireDefault(_volumeSlider);
  5235. var _next = __webpack_require__(29);
  5236. var _next2 = _interopRequireDefault(_next);
  5237. var _prev = __webpack_require__(34);
  5238. var _prev2 = _interopRequireDefault(_prev);
  5239. var _repeat = __webpack_require__(36);
  5240. var _repeat2 = _interopRequireDefault(_repeat);
  5241. var _repeatSong = __webpack_require__(37);
  5242. var _repeatSong2 = _interopRequireDefault(_repeatSong);
  5243. var _playbackSpeed = __webpack_require__(33);
  5244. var _playbackSpeed2 = _interopRequireDefault(_playbackSpeed);
  5245. var _shuffle = __webpack_require__(38);
  5246. var _shuffle2 = _interopRequireDefault(_shuffle);
  5247. var _skipTo = __webpack_require__(39);
  5248. var _skipTo2 = _interopRequireDefault(_skipTo);
  5249. var _waveform = __webpack_require__(22);
  5250. var _waveform2 = _interopRequireDefault(_waveform);
  5251. var _debug = __webpack_require__(4);
  5252. var _debug2 = _interopRequireDefault(_debug);
  5253. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5254. /**
  5255. * AmplitudeJS Events Module. Handles all of the events we listen to in
  5256. * AmplitudeJS.
  5257. *
  5258. * @module events/Events
  5259. */
  5260. /**
  5261. * Imports all of the handler objects used by the events.
  5262. */
  5263. var Events = function () {
  5264. /**
  5265. * Initializes the handlers for the events listened to by Amplitude
  5266. *
  5267. * @access public
  5268. */
  5269. function initialize() {
  5270. /*
  5271. Write out debug message
  5272. */
  5273. _debug2.default.writeMessage("Beginning initialization of event handlers..");
  5274. /*
  5275. Sets flag that the screen is moving and not a tap
  5276. */
  5277. document.addEventListener("touchmove", function () {
  5278. _config2.default.is_touch_moving = true;
  5279. });
  5280. /*
  5281. On touch end if it was a touch move event, set moving to
  5282. false
  5283. */
  5284. document.addEventListener("touchend", function () {
  5285. if (_config2.default.is_touch_moving) {
  5286. _config2.default.is_touch_moving = false;
  5287. }
  5288. });
  5289. /*
  5290. On time update for the audio element, update visual displays that
  5291. represent the time on either a visualized element or time display.
  5292. */
  5293. bindTimeUpdate();
  5294. /*
  5295. Binds key down event handlers for matching key codes to functions.
  5296. */
  5297. bindKeyDownEventHandlers();
  5298. /*
  5299. When the audio element has ended playing, we handle the song
  5300. ending. In a single song or multiple modular song instance,
  5301. this just synchronizes the visuals for time and song time
  5302. visualization, but for a playlist it determines whether
  5303. it should play the next song or not.
  5304. */
  5305. bindSongEnded();
  5306. /*
  5307. Binds progress event so we can see how much of the song is loaded.
  5308. */
  5309. bindProgress();
  5310. /*
  5311. Binds 'amplitude-play' event handlers
  5312. */
  5313. bindPlay();
  5314. /*
  5315. Binds 'amplitude-pause' event handlers.
  5316. */
  5317. bindPause();
  5318. /*
  5319. Binds 'amplitude-play-pause' event handlers.
  5320. */
  5321. bindPlayPause();
  5322. /*
  5323. Binds 'amplitude-stop' event handlers.
  5324. */
  5325. bindStop();
  5326. /*
  5327. Binds 'amplitude-mute' event handlers.
  5328. */
  5329. bindMute();
  5330. /*
  5331. Binds 'amplitude-volume-up' event handlers
  5332. */
  5333. bindVolumeUp();
  5334. /*
  5335. Binds 'amplitude-volume-down' event handlers
  5336. */
  5337. bindVolumeDown();
  5338. /*
  5339. Binds 'amplitude-song-slider' event handlers
  5340. */
  5341. bindSongSlider();
  5342. /*
  5343. Binds 'amplitude-volume-slider' event handlers.
  5344. */
  5345. bindVolumeSlider();
  5346. /*
  5347. Binds 'amplitude-next' event handlers.
  5348. */
  5349. bindNext();
  5350. /*
  5351. Binds 'amplitude-prev' event handlers.
  5352. */
  5353. bindPrev();
  5354. /*
  5355. Binds 'amplitude-shuffle' event handlers.
  5356. */
  5357. bindShuffle();
  5358. /*
  5359. Binds 'amplitude-repeat' event handlers.
  5360. */
  5361. bindRepeat();
  5362. /*
  5363. Binds 'amplitude-repeat-song' event handlers.
  5364. */
  5365. bindRepeatSong();
  5366. /*
  5367. Binds 'amplitude-playback-speed' event handlers.
  5368. */
  5369. bindPlaybackSpeed();
  5370. /*
  5371. Binds 'amplitude-skip-to' event handlers.
  5372. */
  5373. bindSkipTo();
  5374. /*
  5375. Binds `canplaythrough` event to build the waveform.
  5376. */
  5377. bindCanPlayThrough();
  5378. }
  5379. /**
  5380. * On time update for the audio element, update visual displays that
  5381. * represent the time on either a visualized element or time display.
  5382. *
  5383. * @access private
  5384. */
  5385. function bindTimeUpdate() {
  5386. /*
  5387. Bind for time update
  5388. */
  5389. _config2.default.audio.removeEventListener("timeupdate", _timeUpdate2.default.handle);
  5390. _config2.default.audio.addEventListener("timeupdate", _timeUpdate2.default.handle);
  5391. /*
  5392. Bind for duration change
  5393. */
  5394. _config2.default.audio.removeEventListener("durationchange", _timeUpdate2.default.handle);
  5395. _config2.default.audio.addEventListener("durationchange", _timeUpdate2.default.handle);
  5396. }
  5397. /**
  5398. * On keydown, we listen to what key got pressed so we can map the key to
  5399. * a function. This allows the user to map pause and play, next, etc. to key
  5400. * presses.
  5401. *
  5402. * @access private
  5403. */
  5404. function bindKeyDownEventHandlers() {
  5405. document.removeEventListener("keydown", _keydown2.default.handle);
  5406. document.addEventListener("keydown", _keydown2.default.handle);
  5407. }
  5408. /**
  5409. * When the audio element has ended playing, we handle the song
  5410. * ending. In a single song or multiple modular song instance,
  5411. * this just synchronizes the visuals for time and song time
  5412. * visualization, but for a playlist it determines whether
  5413. * it should play the next song or not.
  5414. *
  5415. * @access private
  5416. */
  5417. function bindSongEnded() {
  5418. _config2.default.audio.removeEventListener("ended", _ended2.default.handle);
  5419. _config2.default.audio.addEventListener("ended", _ended2.default.handle);
  5420. }
  5421. /**
  5422. * As the audio is loaded, the progress event gets fired. We bind into this
  5423. * to grab the buffered percentage of the song. We can then add more elements
  5424. * to show the buffered amount.
  5425. *
  5426. * @access private
  5427. */
  5428. function bindProgress() {
  5429. _config2.default.audio.removeEventListener("progress", _progress2.default.handle);
  5430. _config2.default.audio.addEventListener("progress", _progress2.default.handle);
  5431. }
  5432. /**
  5433. * Binds click and touchend events for AmplitudeJS play buttons
  5434. *
  5435. * @access private
  5436. */
  5437. function bindPlay() {
  5438. /*
  5439. Gets all of the elements with the class amplitude-play
  5440. */
  5441. var play_classes = document.getElementsByClassName("amplitude-play");
  5442. /*
  5443. Iterates over all of the play classes and binds the event interaction
  5444. method to the element. If the browser is mobile, then the event is touchend
  5445. otherwise it is click.
  5446. */
  5447. for (var i = 0; i < play_classes.length; i++) {
  5448. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5449. play_classes[i].removeEventListener("touchend", _play2.default.handle);
  5450. play_classes[i].addEventListener("touchend", _play2.default.handle);
  5451. } else {
  5452. play_classes[i].removeEventListener("click", _play2.default.handle);
  5453. play_classes[i].addEventListener("click", _play2.default.handle);
  5454. }
  5455. }
  5456. }
  5457. /**
  5458. * Binds click and touchend events for AmplitudeJS pause buttons.
  5459. *
  5460. * @access private
  5461. */
  5462. function bindPause() {
  5463. /*
  5464. Gets all of the elements with the class amplitude-pause
  5465. */
  5466. var pause_classes = document.getElementsByClassName("amplitude-pause");
  5467. /*
  5468. Iterates over all of the pause classes and binds the event interaction
  5469. method to the element. If the browser is mobile, then the event is touchend
  5470. otherwise it is click.
  5471. */
  5472. for (var i = 0; i < pause_classes.length; i++) {
  5473. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5474. pause_classes[i].removeEventListener("touchend", _pause2.default.handle);
  5475. pause_classes[i].addEventListener("touchend", _pause2.default.handle);
  5476. } else {
  5477. pause_classes[i].removeEventListener("click", _pause2.default.handle);
  5478. pause_classes[i].addEventListener("click", _pause2.default.handle);
  5479. }
  5480. }
  5481. }
  5482. /**
  5483. * Binds click and touchend events for AmplitudeJS play pause buttons
  5484. *
  5485. * @access private
  5486. */
  5487. function bindPlayPause() {
  5488. /*
  5489. Gets all of the elements with the class amplitude-play-pause
  5490. */
  5491. var play_pause_classes = document.getElementsByClassName("amplitude-play-pause");
  5492. /*
  5493. Iterates over all of the play/pause classes and binds the event interaction
  5494. method to the element. If the browser is mobile, then the event is touchend
  5495. otherwise it is click.
  5496. */
  5497. for (var i = 0; i < play_pause_classes.length; i++) {
  5498. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5499. play_pause_classes[i].removeEventListener("touchend", _playPause2.default.handle);
  5500. play_pause_classes[i].addEventListener("touchend", _playPause2.default.handle);
  5501. } else {
  5502. play_pause_classes[i].removeEventListener("click", _playPause2.default.handle);
  5503. play_pause_classes[i].addEventListener("click", _playPause2.default.handle);
  5504. }
  5505. }
  5506. }
  5507. /**
  5508. * Binds click and touchend events for AmplitudeJS stop buttons
  5509. *
  5510. * @access private
  5511. */
  5512. function bindStop() {
  5513. /*
  5514. Gets all of the elements with the class amplitude-stop
  5515. */
  5516. var stop_classes = document.getElementsByClassName("amplitude-stop");
  5517. /*
  5518. Iterates over all of the stop classes and binds the event interaction
  5519. method to the element. If the browser is mobile, then the event is touchend
  5520. otherwise it is click.
  5521. */
  5522. for (var i = 0; i < stop_classes.length; i++) {
  5523. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5524. stop_classes[i].removeEventListener("touchend", _stop2.default.handle);
  5525. stop_classes[i].addEventListener("touchend", _stop2.default.handle);
  5526. } else {
  5527. stop_classes[i].removeEventListener("click", _stop2.default.handle);
  5528. stop_classes[i].addEventListener("click", _stop2.default.handle);
  5529. }
  5530. }
  5531. }
  5532. /**
  5533. * Binds click and touchend events for AmplitudeJS mute buttons
  5534. *
  5535. * @access private
  5536. */
  5537. function bindMute() {
  5538. /*
  5539. Gets all of the elements with the class amplitue-mute
  5540. */
  5541. var mute_classes = document.getElementsByClassName("amplitude-mute");
  5542. /*
  5543. Iterates over all of the mute classes and binds the event interaction
  5544. method to the element. If the browser is mobile, then the event is touchend
  5545. otherwise it is click.
  5546. */
  5547. for (var i = 0; i < mute_classes.length; i++) {
  5548. /*
  5549. WARNING: If iOS, we don't do anything because iOS does not allow the
  5550. volume to be adjusted through anything except the buttons on the side of
  5551. the device.
  5552. */
  5553. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5554. /*
  5555. Checks for an iOS device and displays an error message if debugging
  5556. is turned on.
  5557. */
  5558. if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  5559. _debug2.default.writeMessage("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4");
  5560. } else {
  5561. mute_classes[i].removeEventListener("touchend", _mute2.default.handle);
  5562. mute_classes[i].addEventListener("touchend", _mute2.default.handle);
  5563. }
  5564. } else {
  5565. mute_classes[i].removeEventListener("click", _mute2.default.handle);
  5566. mute_classes[i].addEventListener("click", _mute2.default.handle);
  5567. }
  5568. }
  5569. }
  5570. /**
  5571. * Binds click and touchend events for AmplitudeJS Volume Up Buttons
  5572. *
  5573. * @access private
  5574. */
  5575. function bindVolumeUp() {
  5576. /*
  5577. Gets all of the elements with the class amplitude-volume-up
  5578. */
  5579. var volume_up_classes = document.getElementsByClassName("amplitude-volume-up");
  5580. /*
  5581. Iterates over all of the volume up classes and binds the event interaction
  5582. methods to the element. If the browser is mobile, then the event is touchend
  5583. otherwise it is click.
  5584. */
  5585. for (var i = 0; i < volume_up_classes.length; i++) {
  5586. /*
  5587. WARNING: If iOS, we don't do anything because iOS does not allow the
  5588. volume to be adjusted through anything except the buttons on the side of
  5589. the device.
  5590. */
  5591. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5592. /*
  5593. Checks for an iOS device and displays an error message if debugging
  5594. is turned on.
  5595. */
  5596. if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  5597. _debug2.default.writeMessage("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4");
  5598. } else {
  5599. volume_up_classes[i].removeEventListener("touchend", _volumeUp2.default.handle);
  5600. volume_up_classes[i].addEventListener("touchend", _volumeUp2.default.handle);
  5601. }
  5602. } else {
  5603. volume_up_classes[i].removeEventListener("click", _volumeUp2.default.handle);
  5604. volume_up_classes[i].addEventListener("click", _volumeUp2.default.handle);
  5605. }
  5606. }
  5607. }
  5608. /**
  5609. * Binds click and touchend events for AmplitudeJS Volume Down Buttons
  5610. *
  5611. * @access private
  5612. */
  5613. function bindVolumeDown() {
  5614. /*
  5615. Gets all of the elements with the class amplitude-volume-down
  5616. */
  5617. var volume_down_classes = document.getElementsByClassName("amplitude-volume-down");
  5618. /*
  5619. Iterates over all of the volume down classes and binds the event interaction
  5620. methods to the element. If the browser is mobile, then the event is touchend
  5621. otherwise it is click.
  5622. */
  5623. for (var i = 0; i < volume_down_classes.length; i++) {
  5624. /*
  5625. WARNING: If iOS, we don't do anything because iOS does not allow the
  5626. volume to be adjusted through anything except the buttons on the side of
  5627. the device.
  5628. */
  5629. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5630. /*
  5631. Checks for an iOS device and displays an error message if debugging
  5632. is turned on.
  5633. */
  5634. if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  5635. _debug2.default.writeMessage("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4");
  5636. } else {
  5637. volume_down_classes[i].removeEventListener("touchend", _volumeDown2.default.handle);
  5638. volume_down_classes[i].addEventListener("touchend", _volumeDown2.default.handle);
  5639. }
  5640. } else {
  5641. volume_down_classes[i].removeEventListener("click", _volumeDown2.default.handle);
  5642. volume_down_classes[i].addEventListener("click", _volumeDown2.default.handle);
  5643. }
  5644. }
  5645. }
  5646. /**
  5647. * Binds change and input events for AmplitudeJS Song Slider Inputs
  5648. *
  5649. * @access private
  5650. */
  5651. function bindSongSlider() {
  5652. /*
  5653. Gets browser so if we need to apply overrides, like we usually
  5654. have to do for anything cool in IE, we can do that.
  5655. */
  5656. var ua = window.navigator.userAgent;
  5657. var msie = ua.indexOf("MSIE ");
  5658. /*
  5659. Gets all of the elements with the class amplitude-song-slider
  5660. */
  5661. var song_sliders = document.getElementsByClassName("amplitude-song-slider");
  5662. /*
  5663. Iterates over all of the song slider classes and binds the event interaction
  5664. methods to the element. If the browser is IE we listen to the change event
  5665. where if it is anything else, it's the input method.
  5666. */
  5667. for (var i = 0; i < song_sliders.length; i++) {
  5668. if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
  5669. song_sliders[i].removeEventListener("change", _songSlider2.default.handle);
  5670. song_sliders[i].addEventListener("change", _songSlider2.default.handle);
  5671. } else {
  5672. song_sliders[i].removeEventListener("input", _songSlider2.default.handle);
  5673. song_sliders[i].addEventListener("input", _songSlider2.default.handle);
  5674. }
  5675. }
  5676. }
  5677. /**
  5678. * Binds change and input events fro AmplitudeJS Volume Slider inputs
  5679. *
  5680. * @access private
  5681. */
  5682. function bindVolumeSlider() {
  5683. /*
  5684. Gets browser so if we need to apply overrides, like we usually
  5685. have to do for anything cool in IE, we can do that.
  5686. */
  5687. var ua = window.navigator.userAgent;
  5688. var msie = ua.indexOf("MSIE ");
  5689. /*
  5690. Gets all of the elements with the class amplitude-volume-slider
  5691. */
  5692. var volume_sliders = document.getElementsByClassName("amplitude-volume-slider");
  5693. /*
  5694. Iterates over all of the volume slider classes and binds the event interaction
  5695. methods to the element. If the browser is IE we listen to the change event
  5696. where if it is anything else, it's the input method.
  5697. */
  5698. for (var i = 0; i < volume_sliders.length; i++) {
  5699. /*
  5700. WARNING: If iOS, we don't do anything because iOS does not allow the
  5701. volume to be adjusted through anything except the buttons on the side of
  5702. the device.
  5703. */
  5704. if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  5705. _debug2.default.writeMessage("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4");
  5706. } else {
  5707. if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
  5708. volume_sliders[i].removeEventListener("change", _volumeSlider2.default.handle);
  5709. volume_sliders[i].addEventListener("change", _volumeSlider2.default.handle);
  5710. } else {
  5711. volume_sliders[i].removeEventListener("input", _volumeSlider2.default.handle);
  5712. volume_sliders[i].addEventListener("input", _volumeSlider2.default.handle);
  5713. }
  5714. }
  5715. }
  5716. }
  5717. /**
  5718. * Binds click and touchend events fro AmplitudeJS Next buttons
  5719. *
  5720. * @access private
  5721. */
  5722. function bindNext() {
  5723. /*
  5724. Gets all of the elements with the class amplitude-next
  5725. */
  5726. var next_classes = document.getElementsByClassName("amplitude-next");
  5727. /*
  5728. Iterates over all of the next classes and binds the event interaction
  5729. methods to the element. If the browser is mobile, then the event is touchend
  5730. otherwise it is click.
  5731. */
  5732. for (var i = 0; i < next_classes.length; i++) {
  5733. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5734. next_classes[i].removeEventListener("touchend", _next2.default.handle);
  5735. next_classes[i].addEventListener("touchend", _next2.default.handle);
  5736. } else {
  5737. next_classes[i].removeEventListener("click", _next2.default.handle);
  5738. next_classes[i].addEventListener("click", _next2.default.handle);
  5739. }
  5740. }
  5741. }
  5742. /**
  5743. * Binds click and touchend events for AmplitudeJS prev buttons.
  5744. *
  5745. * @access private
  5746. */
  5747. function bindPrev() {
  5748. /*
  5749. Gets all of the elements with the class amplitude-prev
  5750. */
  5751. var prev_classes = document.getElementsByClassName("amplitude-prev");
  5752. /*
  5753. Iterates over all of the prev classes and binds the event interaction
  5754. methods to the element. If the browser is mobile, then the event is touchend
  5755. otherwise it is click.
  5756. */
  5757. for (var i = 0; i < prev_classes.length; i++) {
  5758. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5759. prev_classes[i].removeEventListener("touchend", _prev2.default.handle);
  5760. prev_classes[i].addEventListener("touchend", _prev2.default.handle);
  5761. } else {
  5762. prev_classes[i].removeEventListener("click", _prev2.default.handle);
  5763. prev_classes[i].addEventListener("click", _prev2.default.handle);
  5764. }
  5765. }
  5766. }
  5767. /**
  5768. * Binds click and touchend events for AmplitudeJS shuffle buttons.
  5769. *
  5770. * @access private
  5771. */
  5772. function bindShuffle() {
  5773. /*
  5774. Gets all of the elements with the class amplitude-shuffle
  5775. */
  5776. var shuffle_classes = document.getElementsByClassName("amplitude-shuffle");
  5777. /*
  5778. Iterates over all of the shuffle classes and binds the event interaction
  5779. methods to the element. If the browser is mobile, then the event is touchend
  5780. otherwise it is click.
  5781. */
  5782. for (var i = 0; i < shuffle_classes.length; i++) {
  5783. /*
  5784. Since we are re-binding everything we remove any classes that signify
  5785. a state of the shuffle control.
  5786. */
  5787. shuffle_classes[i].classList.remove("amplitude-shuffle-on");
  5788. shuffle_classes[i].classList.add("amplitude-shuffle-off");
  5789. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5790. shuffle_classes[i].removeEventListener("touchend", _shuffle2.default.handle);
  5791. shuffle_classes[i].addEventListener("touchend", _shuffle2.default.handle);
  5792. } else {
  5793. shuffle_classes[i].removeEventListener("click", _shuffle2.default.handle);
  5794. shuffle_classes[i].addEventListener("click", _shuffle2.default.handle);
  5795. }
  5796. }
  5797. }
  5798. /**
  5799. * Binds click and touchend events for AmplitudeJS repeat buttons.
  5800. *
  5801. * @access private
  5802. */
  5803. function bindRepeat() {
  5804. /*
  5805. Gets all of the elements with the class amplitude-repeat
  5806. */
  5807. var repeat_classes = document.getElementsByClassName("amplitude-repeat");
  5808. /*
  5809. Iterates over all of the repeat classes and binds the event interaction
  5810. methods to the element. If the browser is mobile, then the event is touchend
  5811. otherwise it is click.
  5812. */
  5813. for (var i = 0; i < repeat_classes.length; i++) {
  5814. /*
  5815. Since we are re-binding everything we remove any classes that signify
  5816. a state of the repeat control.
  5817. */
  5818. repeat_classes[i].classList.remove("amplitude-repeat-on");
  5819. repeat_classes[i].classList.add("amplitude-repeat-off");
  5820. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5821. repeat_classes[i].removeEventListener("touchend", _repeat2.default.handle);
  5822. repeat_classes[i].addEventListener("touchend", _repeat2.default.handle);
  5823. } else {
  5824. repeat_classes[i].removeEventListener("click", _repeat2.default.handle);
  5825. repeat_classes[i].addEventListener("click", _repeat2.default.handle);
  5826. }
  5827. }
  5828. }
  5829. /**
  5830. * Binds click and touchend events for AmplitudeJS repeat song buttons.
  5831. *
  5832. * @access private
  5833. */
  5834. function bindRepeatSong() {
  5835. /*
  5836. Gets all of the elements with the class amplitude-repeat-song
  5837. */
  5838. var repeat_song_classes = document.getElementsByClassName("amplitude-repeat-song");
  5839. /*
  5840. Iterates over all of the repeat song classes and binds the event interaction
  5841. methods to the element. If the browser is mobile, then the event is touchend
  5842. otherwise it is click.
  5843. */
  5844. for (var i = 0; i < repeat_song_classes.length; i++) {
  5845. /*
  5846. Since we are re-binding everything we remove any classes that signify
  5847. a state of the repeat control.
  5848. */
  5849. repeat_song_classes[i].classList.remove("amplitude-repeat-on");
  5850. repeat_song_classes[i].classList.add("amplitude-repeat-off");
  5851. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5852. repeat_song_classes[i].removeEventListener("touchend", _repeatSong2.default.handle);
  5853. repeat_song_classes[i].addEventListener("touchend", _repeatSong2.default.handle);
  5854. } else {
  5855. repeat_song_classes[i].removeEventListener("click", _repeatSong2.default.handle);
  5856. repeat_song_classes[i].addEventListener("click", _repeatSong2.default.handle);
  5857. }
  5858. }
  5859. }
  5860. /**
  5861. * Binds click and touchend events for AmplitudeJS playback speed buttons
  5862. *
  5863. * @access private
  5864. */
  5865. function bindPlaybackSpeed() {
  5866. /*
  5867. Gets all of the elements with the class amplitude-playback-speed
  5868. */
  5869. var playback_speed_classes = document.getElementsByClassName("amplitude-playback-speed");
  5870. /*
  5871. Iterates over all of the playback speed classes and binds the event interaction
  5872. methods to the element. If the browser is mobile, then the event is touchend
  5873. otherwise it is click.
  5874. */
  5875. for (var i = 0; i < playback_speed_classes.length; i++) {
  5876. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5877. playback_speed_classes[i].removeEventListener("touchend", _playbackSpeed2.default.handle);
  5878. playback_speed_classes[i].addEventListener("touchend", _playbackSpeed2.default.handle);
  5879. } else {
  5880. playback_speed_classes[i].removeEventListener("click", _playbackSpeed2.default.handle);
  5881. playback_speed_classes[i].addEventListener("click", _playbackSpeed2.default.handle);
  5882. }
  5883. }
  5884. }
  5885. /**
  5886. * Binds click and touchend events for AmplitudeJS skip to buttons.
  5887. *
  5888. * @access private
  5889. */
  5890. function bindSkipTo() {
  5891. /*
  5892. Gets all of the skip to elements with the class 'amplitude-skip-to'
  5893. */
  5894. var skipToClasses = document.getElementsByClassName("amplitude-skip-to");
  5895. /*
  5896. Iterates over all of the skip to classes and binds the event interaction
  5897. methods to the element. If the browser is mobile, then the event is touchend
  5898. otherwise it's a click.
  5899. */
  5900. for (var i = 0; i < skipToClasses.length; i++) {
  5901. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  5902. skipToClasses[i].removeEventListener("touchend", _skipTo2.default.handle);
  5903. skipToClasses[i].addEventListener("touchend", _skipTo2.default.handle);
  5904. } else {
  5905. skipToClasses[i].removeEventListener("click", _skipTo2.default.handle);
  5906. skipToClasses[i].addEventListener("click", _skipTo2.default.handle);
  5907. }
  5908. }
  5909. }
  5910. /**
  5911. * Binds can play through to a song.
  5912. *
  5913. * @access private
  5914. */
  5915. function bindCanPlayThrough() {
  5916. if (_waveform2.default.determineIfUsingWaveforms()) {
  5917. _config2.default.audio.removeEventListener("canplaythrough", _waveform2.default.build);
  5918. _config2.default.audio.addEventListener("canplaythrough", _waveform2.default.build);
  5919. }
  5920. }
  5921. /*
  5922. Returns the public facing functions.
  5923. */
  5924. return {
  5925. initialize: initialize
  5926. };
  5927. }();
  5928. /**
  5929. * Imports the utility classes used by the evnets.
  5930. */
  5931. /*
  5932. Import the necessary classes and config to use
  5933. with the events.
  5934. */
  5935. exports.default = Events;
  5936. module.exports = exports["default"];
  5937. /***/ }),
  5938. /* 27 */
  5939. /***/ (function(module, exports, __webpack_require__) {
  5940. "use strict";
  5941. Object.defineProperty(exports, "__esModule", {
  5942. value: true
  5943. });
  5944. var _config = __webpack_require__(0);
  5945. var _config2 = _interopRequireDefault(_config);
  5946. var _core = __webpack_require__(1);
  5947. var _core2 = _interopRequireDefault(_core);
  5948. var _shuffler = __webpack_require__(13);
  5949. var _shuffler2 = _interopRequireDefault(_shuffler);
  5950. var _repeater = __webpack_require__(12);
  5951. var _repeater2 = _interopRequireDefault(_repeater);
  5952. var _audioNavigation = __webpack_require__(3);
  5953. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  5954. var _repeatElements = __webpack_require__(8);
  5955. var _repeatElements2 = _interopRequireDefault(_repeatElements);
  5956. var _playPauseElements = __webpack_require__(2);
  5957. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  5958. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5959. /**
  5960. * AmplitudeJS Key Down event handler
  5961. *
  5962. * @module events/KeyDown
  5963. */
  5964. /**
  5965. * Imports the Repeat Elements Visual Handler
  5966. * @module visual/RepeatElements
  5967. */
  5968. /**
  5969. * Imports the Repeater Utility
  5970. * @module utilities/Repeater
  5971. */
  5972. /**
  5973. * Imports the core of AmplitudeJS
  5974. * @module core/Core
  5975. */
  5976. var KeyDown = function () {
  5977. /**
  5978. * When the keydown event is fired, we determine which function should be run
  5979. * based on what was passed in.
  5980. *
  5981. * HANDLER FOR: keydown
  5982. *
  5983. * @access public
  5984. * @prop {object} event The event object being passed in.
  5985. */
  5986. function handle(event) {
  5987. runKeyEvent(event.which);
  5988. }
  5989. /**
  5990. * Runs an event on key down
  5991. *
  5992. * @access public
  5993. * @param {number} key - The key code the event is bound to.
  5994. */
  5995. function runKeyEvent(key) {
  5996. /*
  5997. Checks to see if the user bound an event to the code pressed.
  5998. */
  5999. if (_config2.default.bindings[key] != undefined) {
  6000. /*
  6001. Determine which event should be run if bound.
  6002. */
  6003. switch (_config2.default.bindings[key]) {
  6004. /*
  6005. Fires a play pause event.
  6006. */
  6007. case "play_pause":
  6008. runPlayPauseKeyDownEvent();
  6009. break;
  6010. /*
  6011. Fires a next event.
  6012. */
  6013. case "next":
  6014. runNextKeyDownEvent();
  6015. break;
  6016. /*
  6017. Fires a previous event.
  6018. */
  6019. case "prev":
  6020. runPrevKeyDownEvent();
  6021. break;
  6022. /*
  6023. Fires a stop event.
  6024. */
  6025. case "stop":
  6026. runStopKeyDownEvent();
  6027. break;
  6028. /*
  6029. Fires a shuffle event.
  6030. */
  6031. case "shuffle":
  6032. runShuffleKeyDownEvent();
  6033. break;
  6034. /*
  6035. Fires a repeat event.
  6036. */
  6037. case "repeat":
  6038. runRepeatKeyDownEvent();
  6039. break;
  6040. }
  6041. }
  6042. }
  6043. /**
  6044. * Runs the play pause method for key down.
  6045. */
  6046. function runPlayPauseKeyDownEvent() {
  6047. /*
  6048. If the song is paused, we play the song. If the song is playing,
  6049. we pause the song.
  6050. */
  6051. if (_config2.default.audio.paused) {
  6052. _core2.default.play();
  6053. } else {
  6054. _core2.default.pause();
  6055. }
  6056. /*
  6057. Now we sync all the elements to match the state of the audio.
  6058. We don't need to do any checks on new songs or changed playlists
  6059. in the global since it's whatever song is playing.
  6060. */
  6061. _playPauseElements2.default.sync();
  6062. }
  6063. /**
  6064. * Runs the next method for key down.
  6065. */
  6066. function runNextKeyDownEvent() {
  6067. /*
  6068. Check to see if the current state of the player
  6069. is in playlist mode or not playlist mode.
  6070. */
  6071. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  6072. _audioNavigation2.default.setNext();
  6073. } else {
  6074. _audioNavigation2.default.setNextPlaylist(_config2.default.active_playlist);
  6075. }
  6076. }
  6077. /**
  6078. * Runs the previous method for key down.
  6079. */
  6080. function runPrevKeyDownEvent() {
  6081. /*
  6082. Check to see if the current playlist has been set
  6083. or null and set the previous song.
  6084. */
  6085. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  6086. _audioNavigation2.default.setPrevious();
  6087. } else {
  6088. _audioNavigation2.default.setPreviousPlaylist(_config2.default.active_playlist);
  6089. }
  6090. }
  6091. /**
  6092. * Runs the stop method for key down.
  6093. */
  6094. function runStopKeyDownEvent() {
  6095. /*
  6096. Syncs all of the play pause elements to pause.
  6097. */
  6098. _playPauseElements2.default.syncToPause();
  6099. /*
  6100. Stops the active song.
  6101. */
  6102. _core2.default.stop();
  6103. }
  6104. /**
  6105. * Runs the shuffle method for key down.
  6106. */
  6107. function runShuffleKeyDownEvent() {
  6108. /*
  6109. Check to see if the current playlist has been set
  6110. or null and set the previous song.
  6111. */
  6112. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  6113. _shuffler2.default.toggleShuffle();
  6114. } else {
  6115. _shuffler2.default.toggleShufflePlaylist(_config2.default.active_playlist);
  6116. }
  6117. }
  6118. /**
  6119. * Run the repeat method for key down.
  6120. */
  6121. function runRepeatKeyDownEvent() {
  6122. /*
  6123. Toggles the repeat
  6124. */
  6125. _repeater2.default.setRepeat(!_config2.default.repeat);
  6126. /*
  6127. Visually sync repeat
  6128. */
  6129. _repeatElements2.default.syncRepeat();
  6130. }
  6131. /**
  6132. * Returns the public methods for the handler.
  6133. */
  6134. return {
  6135. handle: handle
  6136. };
  6137. }();
  6138. /**
  6139. * Imports the Play Pause Elements Visual Handler
  6140. * @module visual/PlayPauseElements
  6141. */
  6142. /**
  6143. * Imports the Audio Navigation Utility
  6144. * @module utilities/AudioNavigation
  6145. */
  6146. /**
  6147. * Imports the Shuffle Utility
  6148. * @module utilities/Shuffle
  6149. */
  6150. /**
  6151. * Imports the config module
  6152. * @module config
  6153. */
  6154. exports.default = KeyDown;
  6155. module.exports = exports["default"];
  6156. /***/ }),
  6157. /* 28 */
  6158. /***/ (function(module, exports, __webpack_require__) {
  6159. "use strict";
  6160. Object.defineProperty(exports, "__esModule", {
  6161. value: true
  6162. });
  6163. var _config = __webpack_require__(0);
  6164. var _config2 = _interopRequireDefault(_config);
  6165. var _core = __webpack_require__(1);
  6166. var _core2 = _interopRequireDefault(_core);
  6167. var _muteElements = __webpack_require__(10);
  6168. var _muteElements2 = _interopRequireDefault(_muteElements);
  6169. var _volumeSliderElements = __webpack_require__(11);
  6170. var _volumeSliderElements2 = _interopRequireDefault(_volumeSliderElements);
  6171. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6172. /**
  6173. * Handles all events for a mute event.
  6174. * @module events/Mute
  6175. */
  6176. /**
  6177. * Imports the AmplitudeJS Visual Mute Elements
  6178. * @module visual/MuteElements
  6179. */
  6180. /**
  6181. * Imports the config to use the values
  6182. */
  6183. var Mute = function () {
  6184. /**
  6185. * Handles an event for a mute element
  6186. *
  6187. * HANDLER FOR: class="amplitude-mute"
  6188. *
  6189. * @access public
  6190. */
  6191. function handle() {
  6192. /*
  6193. We don't fire this if the user is touching the screen and it's moving.
  6194. This could lead to a mis-fire
  6195. */
  6196. if (!_config2.default.is_touch_moving) {
  6197. /*
  6198. If the current volume in the config is 0, we set the volume to the
  6199. pre_mute level. This means that the audio is already muted and
  6200. needs to be restored to the pre_mute level.
  6201. Otherwise, we set pre_mute volume to the current volume
  6202. and set the config volume to 0, muting the audio.
  6203. */
  6204. if (_config2.default.volume == 0) {
  6205. _core2.default.setVolume(_config2.default.pre_mute_volume);
  6206. } else {
  6207. _config2.default.pre_mute_volume = _config2.default.volume;
  6208. _core2.default.setVolume(0);
  6209. }
  6210. /*
  6211. Sync Mute Elements.
  6212. */
  6213. _muteElements2.default.setMuted(_config2.default.volume == 0 ? true : false);
  6214. /*
  6215. Syncs the volume sliders so the visuals align up with the functionality.
  6216. If the volume is at 0, then the sliders should represent that so the user
  6217. has the right starting point.
  6218. */
  6219. _volumeSliderElements2.default.sync();
  6220. }
  6221. }
  6222. /**
  6223. * Returns the public facing methods
  6224. */
  6225. return {
  6226. handle: handle
  6227. };
  6228. }();
  6229. /**
  6230. * Imports the AmplitudeJS Visual Volume Slider Elements
  6231. * @module visual/VolumeSliderElements
  6232. */
  6233. /**
  6234. * Imports the AmplitudeJS Core Methods
  6235. * @module core/core
  6236. */
  6237. exports.default = Mute;
  6238. module.exports = exports["default"];
  6239. /***/ }),
  6240. /* 29 */
  6241. /***/ (function(module, exports, __webpack_require__) {
  6242. "use strict";
  6243. Object.defineProperty(exports, "__esModule", {
  6244. value: true
  6245. });
  6246. var _config = __webpack_require__(0);
  6247. var _config2 = _interopRequireDefault(_config);
  6248. var _core = __webpack_require__(1);
  6249. var _core2 = _interopRequireDefault(_core);
  6250. var _playPauseElements = __webpack_require__(2);
  6251. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  6252. var _callbacks = __webpack_require__(9);
  6253. var _callbacks2 = _interopRequireDefault(_callbacks);
  6254. var _audioNavigation = __webpack_require__(3);
  6255. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  6256. var _debug = __webpack_require__(4);
  6257. var _debug2 = _interopRequireDefault(_debug);
  6258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6259. /**
  6260. * AmplitudeJS Next Event Handler
  6261. *
  6262. * @module events/Next
  6263. */
  6264. /**
  6265. * Imports the Amplitude Audio Navigation Utility
  6266. * @module utilities/AudioNavigation
  6267. */
  6268. /**
  6269. * Imports the Play Pause Elements Module.
  6270. * @module visual/PlayPauseElements
  6271. */
  6272. /**
  6273. * Imports the config module
  6274. * @module config
  6275. */
  6276. var Next = function () {
  6277. /**
  6278. * Handles an event on the next button
  6279. *
  6280. * HANDLER FOR: class="amplitude-next"
  6281. *
  6282. * GLOBAL: class="amplitude-next"
  6283. * PLAYLIST: class="amplitude-next" amplitude-playlist="playlist_key"
  6284. *
  6285. * @access public
  6286. */
  6287. function handle() {
  6288. /*
  6289. We don't fire this if the user is touching the screen and it's moving.
  6290. This could lead to a mis-fire
  6291. */
  6292. if (!_config2.default.is_touch_moving) {
  6293. /*
  6294. Gets the playlist attribute from the element.
  6295. */
  6296. var playlist = this.getAttribute("data-amplitude-playlist");
  6297. /*
  6298. If the playlist is null, we handle the global next.
  6299. */
  6300. if (playlist == null) {
  6301. handleGlobalNext();
  6302. }
  6303. /*
  6304. If the playlist is set, we handle the playlist next.
  6305. */
  6306. if (playlist != null) {
  6307. handlePlaylistNext(playlist);
  6308. }
  6309. }
  6310. }
  6311. /**
  6312. * Handles an event on a global enxt button.
  6313. *
  6314. * @access private
  6315. */
  6316. function handleGlobalNext() {
  6317. /*
  6318. Check to see if the current state of the player
  6319. is in playlist mode or not playlist mode. If we are in playlist mode,
  6320. we set next on the playlist.
  6321. */
  6322. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  6323. _audioNavigation2.default.setNext();
  6324. } else {
  6325. _audioNavigation2.default.setNextPlaylist(_config2.default.active_playlist);
  6326. }
  6327. }
  6328. /**
  6329. * Handles an event on a next playlist button.
  6330. *
  6331. * @access private
  6332. * @prop {string} playlist - The playlist we are handling the next for.
  6333. */
  6334. function handlePlaylistNext(playlist) {
  6335. /*
  6336. Ensure the playlist is the same as the active playlist. To get to change
  6337. the scope to a new playlist, you need to play that playlist.
  6338. */
  6339. if (playlist == _config2.default.active_playlist) {
  6340. _audioNavigation2.default.setNextPlaylist(playlist);
  6341. } else {
  6342. _debug2.default.writeMessage("You can not go to the next song on a playlist that is not being played!");
  6343. }
  6344. }
  6345. /*
  6346. Returns the public facing methods.
  6347. */
  6348. return {
  6349. handle: handle
  6350. };
  6351. }();
  6352. /**
  6353. * AmplitudeJS Debug Module
  6354. * @module utilities/Debug
  6355. */
  6356. /**
  6357. * Imports the Callbacks Module
  6358. * @module utilities/Callbacks
  6359. */
  6360. /**
  6361. * Imports the AmplitudeJS Core module.
  6362. * @module core/core
  6363. */
  6364. exports.default = Next;
  6365. module.exports = exports["default"];
  6366. /***/ }),
  6367. /* 30 */
  6368. /***/ (function(module, exports, __webpack_require__) {
  6369. "use strict";
  6370. Object.defineProperty(exports, "__esModule", {
  6371. value: true
  6372. });
  6373. var _config = __webpack_require__(0);
  6374. var _config2 = _interopRequireDefault(_config);
  6375. var _configState = __webpack_require__(6);
  6376. var _configState2 = _interopRequireDefault(_configState);
  6377. var _core = __webpack_require__(1);
  6378. var _core2 = _interopRequireDefault(_core);
  6379. var _playPauseElements = __webpack_require__(2);
  6380. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  6381. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6382. /**
  6383. * Handles all of the pause events
  6384. * @module events/Pause
  6385. */
  6386. /**
  6387. * Imports the AmplitudeJS Core Methods
  6388. * @module core/Core
  6389. */
  6390. /**
  6391. * Imports the config module
  6392. * @module config
  6393. */
  6394. var Pause = function () {
  6395. /**
  6396. * Handles an event on a pause button
  6397. *
  6398. * HANDLER FOR: class="amplitude-pause"
  6399. *
  6400. * GLOBAL: class="amplitude-pause"
  6401. * PLAYLIST: class="amplitude-pause" amplitude-playlist="playlist_key"
  6402. * SONG: class="amplitude-pause" amplitude-song-index="song_index"
  6403. * SONG IN PLAYLIST: class="amplitude-pause" amplitude-playlist="playlist-key" amplitude-song-index="playlist_index"
  6404. *
  6405. * @access public
  6406. */
  6407. function handle() {
  6408. /*
  6409. If the touch is moving, we do not want to accidentally touch the play
  6410. pause element and fire an event.
  6411. */
  6412. if (!_config2.default.is_touch_moving) {
  6413. /*
  6414. Gets the attribute for song index so we can check if
  6415. there is a need to change the song. In some scenarios
  6416. there might be multiple pause classes on the page. In that
  6417. case it is possible the user could click a different pause
  6418. class.
  6419. */
  6420. var songIndexAttribute = this.getAttribute("data-amplitude-song-index");
  6421. var playlistAttribute = this.getAttribute("data-amplitude-playlist");
  6422. /*
  6423. Handle a global pause button.
  6424. */
  6425. if (playlistAttribute == null && songIndexAttribute == null) {
  6426. handleGlobalPause();
  6427. }
  6428. /*
  6429. Handle a playlist pause button.
  6430. */
  6431. if (playlistAttribute != null && songIndexAttribute == null) {
  6432. handlePlaylistPause(playlistAttribute);
  6433. }
  6434. /*
  6435. Handle a song pause button.
  6436. */
  6437. if (playlistAttribute == null && songIndexAttribute != null) {
  6438. handleSongPause(songIndexAttribute);
  6439. }
  6440. /*
  6441. Handle a song in playlist pause button.
  6442. */
  6443. if (playlistAttribute != null && songIndexAttribute != null) {
  6444. handleSongInPlaylistPause(playlistAttribute, songIndexAttribute);
  6445. }
  6446. }
  6447. }
  6448. /**
  6449. * Handles global pause button which pauses whatever song is
  6450. * active.
  6451. *
  6452. * @access private
  6453. */
  6454. function handleGlobalPause() {
  6455. /*
  6456. Pauses the song.
  6457. */
  6458. _core2.default.pause();
  6459. /*
  6460. Sync the play pause elements.
  6461. */
  6462. _playPauseElements2.default.sync();
  6463. }
  6464. /**
  6465. * Handles the playlist pause.
  6466. *
  6467. * @access private
  6468. * @param {string} playlist The playlist the pause button belongs to.
  6469. */
  6470. function handlePlaylistPause(playlist) {
  6471. /*
  6472. Checks to see if the active playlist is the same
  6473. */
  6474. if (_config2.default.active_playlist == playlist) {
  6475. /*
  6476. Pauses the song.
  6477. */
  6478. _core2.default.pause();
  6479. /*
  6480. Sync the play pause elements.
  6481. */
  6482. _playPauseElements2.default.sync();
  6483. }
  6484. }
  6485. /**
  6486. * Handles the song pause.
  6487. *
  6488. * @access private
  6489. * @param {integer} song The song the pause button belongs to.
  6490. */
  6491. function handleSongPause(song) {
  6492. /*
  6493. Checks to see if the active playlist is null and the song matches
  6494. the active index.
  6495. */
  6496. if ((_config2.default.active_playlist == "" || _config2.default.active_playlist == null) && _config2.default.active_index == song) {
  6497. /*
  6498. Pauses the song.
  6499. */
  6500. _core2.default.pause();
  6501. /*
  6502. Sync the play pause elements.
  6503. */
  6504. _playPauseElements2.default.sync();
  6505. }
  6506. }
  6507. /**
  6508. * Handles the song in playlist pause.
  6509. *
  6510. * @access private
  6511. * @param {string} playlist The playlist the pause button belongs to.
  6512. * @param {integer} song The song the pause button belongs to.
  6513. */
  6514. function handleSongInPlaylistPause(playlist, song) {
  6515. /*
  6516. Checks to see if the active song matches the song and the
  6517. active playlist matches the playlist. This means the pause button is
  6518. for the song in the playlist.
  6519. */
  6520. if (_config2.default.active_playlist == playlist && _config2.default.playlists[playlist].active_index == song) {
  6521. /*
  6522. Pauses the song.
  6523. */
  6524. _core2.default.pause();
  6525. /*
  6526. Sync the play pause elements.
  6527. */
  6528. _playPauseElements2.default.sync();
  6529. }
  6530. }
  6531. /*
  6532. Returns the public facing elements
  6533. */
  6534. return {
  6535. handle: handle
  6536. };
  6537. }();
  6538. /**
  6539. * Imports the AmplitudeJS Play Pause Elements
  6540. * @module visual/PlayPauseElements
  6541. */
  6542. /**
  6543. * Imports the ConfigState module.
  6544. * @module utilities/ConfigState
  6545. */
  6546. exports.default = Pause;
  6547. module.exports = exports["default"];
  6548. /***/ }),
  6549. /* 31 */
  6550. /***/ (function(module, exports, __webpack_require__) {
  6551. "use strict";
  6552. Object.defineProperty(exports, "__esModule", {
  6553. value: true
  6554. });
  6555. var _config = __webpack_require__(0);
  6556. var _config2 = _interopRequireDefault(_config);
  6557. var _configState = __webpack_require__(6);
  6558. var _configState2 = _interopRequireDefault(_configState);
  6559. var _core = __webpack_require__(1);
  6560. var _core2 = _interopRequireDefault(_core);
  6561. var _checks = __webpack_require__(5);
  6562. var _checks2 = _interopRequireDefault(_checks);
  6563. var _audioNavigation = __webpack_require__(3);
  6564. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  6565. var _playPauseElements = __webpack_require__(2);
  6566. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  6567. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6568. /**
  6569. * Handles all of the play events
  6570. * @module events/Play
  6571. */
  6572. /**
  6573. * Imports the AmplitudeJS Audio Navigation Utility
  6574. * @module utilities/AudioNavigation
  6575. */
  6576. /**
  6577. * Imports the AmplitudeJS Core Methods
  6578. * @module core/Core
  6579. */
  6580. /**
  6581. * Imports the config module
  6582. * @module config
  6583. */
  6584. var Play = function () {
  6585. /**
  6586. * Handles an event on a play button in Amplitude.
  6587. *
  6588. * HANDLER FOR: class="amplitude-play"
  6589. *
  6590. * GLOBAL: class="amplitude-play"
  6591. * PLAYLIST: class="amplitude-play" amplitude-playlist="playlist_key"
  6592. * SONG: class="amplitude-play" amplitude-song-index="song_index"
  6593. * SONG IN PLAYLIST: class="amplitude-play" amplitude-playlist="playlist-key" amplitude-song-index="playlist_index"
  6594. *
  6595. * @access public
  6596. */
  6597. function handle() {
  6598. /*
  6599. If the touch is moving, we do not want to accidentally touch the play
  6600. pause element and fire an event.
  6601. */
  6602. if (!_config2.default.is_touch_moving) {
  6603. /*
  6604. Gets the attribute for song index so we can check if
  6605. there is a need to change the song. In some scenarios
  6606. there might be multiple play classes on the page. In that
  6607. case it is possible the user could click a different play
  6608. class and change the song.
  6609. */
  6610. var songIndexAttribute = this.getAttribute("data-amplitude-song-index");
  6611. var playlistAttribute = this.getAttribute("data-amplitude-playlist");
  6612. /*
  6613. Handle a global play button.
  6614. */
  6615. if (playlistAttribute == null && songIndexAttribute == null) {
  6616. handleGlobalPlay();
  6617. }
  6618. /*
  6619. Handle a playlist play button.
  6620. */
  6621. if (playlistAttribute != null && songIndexAttribute == null) {
  6622. handlePlaylistPlay(playlistAttribute);
  6623. }
  6624. /*
  6625. Handle a song play button.
  6626. */
  6627. if (playlistAttribute == null && songIndexAttribute != null) {
  6628. handleSongPlay(songIndexAttribute);
  6629. }
  6630. /*
  6631. Handle a song in playlist play button.
  6632. */
  6633. if (playlistAttribute != null && songIndexAttribute != null) {
  6634. handleSongInPlaylistPlay(playlistAttribute, songIndexAttribute);
  6635. }
  6636. }
  6637. }
  6638. /**
  6639. * Handles global play button which plays whatever song is
  6640. * active.
  6641. *
  6642. * @access private
  6643. */
  6644. function handleGlobalPlay() {
  6645. /*
  6646. Plays the song
  6647. */
  6648. _core2.default.play();
  6649. /*
  6650. Sync the play pause elements.
  6651. */
  6652. _playPauseElements2.default.sync();
  6653. }
  6654. /**
  6655. * Handle the playlist play.
  6656. *
  6657. * @access private
  6658. * @param {string} playlist The playlist the play button belongs to.
  6659. */
  6660. function handlePlaylistPlay(playlist) {
  6661. /*
  6662. Checks if we have a new playlist.
  6663. */
  6664. if (_checks2.default.newPlaylist(playlist)) {
  6665. /*
  6666. Sets the active playlist to what belongs to the playlist.
  6667. */
  6668. _audioNavigation2.default.setActivePlaylist(playlist);
  6669. /*
  6670. Play first song in the playlist since we just
  6671. switched playlists, we start from the first song.
  6672. If the user has shuffle on for the playlist, then
  6673. we go from the first song in the shuffle playlist array.
  6674. */
  6675. if (_config2.default.playlists[playlist].shuffle) {
  6676. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].shuffle_list[0], 0);
  6677. } else {
  6678. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[0], 0);
  6679. }
  6680. }
  6681. /*
  6682. Plays the song.
  6683. */
  6684. _core2.default.play();
  6685. /*
  6686. Syncs the play pause elements since they are dependent upon this state
  6687. of the player.
  6688. */
  6689. _playPauseElements2.default.sync();
  6690. }
  6691. /**
  6692. * Handles the song play button.
  6693. *
  6694. * @access private
  6695. * @param {integer} song The index of the song we are playing.
  6696. */
  6697. function handleSongPlay(song) {
  6698. /*
  6699. There can be multiple playlists on the page and there can be
  6700. multiple songs on the page AND there can be songs in multiple
  6701. playlists, so we have some checking to do.
  6702. */
  6703. /*
  6704. Check to see if the playlist has changed. Essentially, if we are moving
  6705. out of a playlist context.
  6706. */
  6707. if (_checks2.default.newPlaylist(null)) {
  6708. /*
  6709. We've moved out of the playlist context, so we set the active playlist
  6710. to null
  6711. */
  6712. _audioNavigation2.default.setActivePlaylist(null);
  6713. /*
  6714. We then change the song to the index selected.
  6715. */
  6716. _audioNavigation2.default.changeSong(_config2.default.songs[song], song);
  6717. }
  6718. /*
  6719. Check to see if the song has changed. If it has,
  6720. set the active song. If it was in a playlist, the
  6721. song wouldn't change here, since we already set the
  6722. song when we checked for a playlist.
  6723. */
  6724. if (_checks2.default.newSong(null, song)) {
  6725. /*
  6726. The song selected is different, so we change the
  6727. song.
  6728. */
  6729. _audioNavigation2.default.changeSong(_config2.default.songs[song], song);
  6730. }
  6731. /*
  6732. Plays the song
  6733. */
  6734. _core2.default.play();
  6735. /*
  6736. Syncs the play pause elements since they are dependent upon this state
  6737. of the player.
  6738. */
  6739. _playPauseElements2.default.sync();
  6740. }
  6741. /**
  6742. * Handles the song in playlist play.
  6743. *
  6744. * @access private
  6745. * @param {string} playlist The playlist the play button belongs to.
  6746. * @param {integer} song The song the play button belongs to.
  6747. */
  6748. function handleSongInPlaylistPlay(playlist, song) {
  6749. /*
  6750. There can be multiple playlists on the page and there can be
  6751. multiple songs on the page AND there can be songs in multiple
  6752. playlists, so we have some checking to do.
  6753. */
  6754. /*
  6755. Check to see if the playlist has changed. Essentially, if we are moving
  6756. out of a playlist context.
  6757. */
  6758. if (_checks2.default.newPlaylist(playlist)) {
  6759. /*
  6760. We've moved out of the playlist context, so we set the active playlist
  6761. to null
  6762. */
  6763. _audioNavigation2.default.setActivePlaylist(playlist);
  6764. /*
  6765. We then change the song to the index selected.
  6766. */
  6767. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[song], song);
  6768. }
  6769. /*
  6770. Check to see if the song has changed. If it has,
  6771. set the active song. If it was in a playlist, the
  6772. song wouldn't change here, since we already set the
  6773. song when we checked for a playlist.
  6774. */
  6775. if (_checks2.default.newSong(playlist, song)) {
  6776. /*
  6777. The song selected is different, so we change the
  6778. song.
  6779. */
  6780. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[song], song);
  6781. }
  6782. /*
  6783. Plays the song
  6784. */
  6785. _core2.default.play();
  6786. /*
  6787. Now we sync all the elements to match the state of the audio.
  6788. We don't need to do any checks on new songs or changed playlists
  6789. in the global since it's whatever song is playing.
  6790. */
  6791. _playPauseElements2.default.sync();
  6792. }
  6793. /*
  6794. Returns the public facing elements
  6795. */
  6796. return {
  6797. handle: handle
  6798. };
  6799. }();
  6800. /**
  6801. * Imports the AmplitudeJS Play Pause Elements
  6802. * @module visual/PlayPauseElements
  6803. */
  6804. /**
  6805. * Imports the AmplitudeJS Checks Utility
  6806. * @module utilities/Checks
  6807. */
  6808. /**
  6809. * Imports the config state utility.
  6810. * @module utilities/ConfigState
  6811. */
  6812. exports.default = Play;
  6813. module.exports = exports["default"];
  6814. /***/ }),
  6815. /* 32 */
  6816. /***/ (function(module, exports, __webpack_require__) {
  6817. "use strict";
  6818. Object.defineProperty(exports, "__esModule", {
  6819. value: true
  6820. });
  6821. var _config = __webpack_require__(0);
  6822. var _config2 = _interopRequireDefault(_config);
  6823. var _configState = __webpack_require__(6);
  6824. var _configState2 = _interopRequireDefault(_configState);
  6825. var _core = __webpack_require__(1);
  6826. var _core2 = _interopRequireDefault(_core);
  6827. var _checks = __webpack_require__(5);
  6828. var _checks2 = _interopRequireDefault(_checks);
  6829. var _audioNavigation = __webpack_require__(3);
  6830. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  6831. var _playPauseElements = __webpack_require__(2);
  6832. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  6833. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6834. /**
  6835. * Handles all of the play pause events
  6836. * @module events/PlayPause
  6837. */
  6838. /**
  6839. * Imports the AmplitudeJS Audio Navigation Utility
  6840. * @module utilities/AudioNavigation
  6841. */
  6842. /**
  6843. * Imports the AmplitudeJS Core Methods
  6844. * @module core/Core
  6845. */
  6846. /**
  6847. * Imports the config module
  6848. * @module config
  6849. */
  6850. var PlayPause = function () {
  6851. /**
  6852. * Handles an event on a play/pause button
  6853. *
  6854. * HANDLER FOR: class="amplitude-play-pause"
  6855. *
  6856. * GLOBAL: class="amplitude-play-pause"
  6857. * PLAYLIST: class="amplitude-play-pause" amplitude-playlist="playlist_key"
  6858. * SONG: class="amplitude-play-pause" amplitude-song-index="song_index"
  6859. * SONG IN PLAYLIST: class="amplitude-play-pause" amplitude-playlist="playlist-key" amplitude-song-index="playlist_index"
  6860. *
  6861. * @access public
  6862. */
  6863. function handle() {
  6864. /*
  6865. If the touch is moving, we do not want to accidentally touch the play
  6866. pause element and fire an event.
  6867. */
  6868. if (!_config2.default.is_touch_moving) {
  6869. /*
  6870. Get the playlist and song from the element. It's alright if these
  6871. are null.
  6872. */
  6873. var playlist = this.getAttribute("data-amplitude-playlist");
  6874. var song = this.getAttribute("data-amplitude-song-index");
  6875. /*
  6876. Handle a global play pause button
  6877. */
  6878. if (playlist == null && song == null) {
  6879. handleGlobalPlayPause();
  6880. }
  6881. /*
  6882. Handle a playlist play pause button
  6883. */
  6884. if (playlist != null && song == null) {
  6885. handlePlaylistPlayPause(playlist);
  6886. }
  6887. /*
  6888. Handle a song play pause button
  6889. */
  6890. if (playlist == null && song != null) {
  6891. handleSongPlayPause(song);
  6892. }
  6893. /*
  6894. Handle a song in playlist play pause button
  6895. */
  6896. if (playlist != null && song != null) {
  6897. handleSongInPlaylistPlayPause(playlist, song);
  6898. }
  6899. }
  6900. }
  6901. /**
  6902. * Sets the main play pause buttons to the current state of the song.
  6903. * @access private
  6904. */
  6905. function handleGlobalPlayPause() {
  6906. /*
  6907. If the song is paused, we play the song. If the song is playing,
  6908. we pause the song.
  6909. */
  6910. if (_config2.default.audio.paused) {
  6911. _core2.default.play();
  6912. } else {
  6913. _core2.default.pause();
  6914. }
  6915. /*
  6916. Now we sync all the elements to match the state of the audio.
  6917. We don't need to do any checks on new songs or changed playlists
  6918. in the global since it's whatever song is playing.
  6919. */
  6920. _playPauseElements2.default.sync();
  6921. }
  6922. /**
  6923. * Sets the playlist main play pause buttons to the current state of the song.
  6924. * @access private
  6925. * @param {string} playlist The playlist the main play pause button controls
  6926. */
  6927. function handlePlaylistPlayPause(playlist) {
  6928. /*
  6929. The only thing that can change when you click a playlist
  6930. play pause is the playlist. Main play pauses have no change
  6931. in song, song play pauses can change playlist and song.
  6932. */
  6933. if (_checks2.default.newPlaylist(playlist)) {
  6934. /*
  6935. If there's a new playlist, then we set the new playlist.
  6936. */
  6937. _audioNavigation2.default.setActivePlaylist(playlist);
  6938. /*
  6939. Play first song in the playlist since we just
  6940. switched playlists, we start from the first song.
  6941. If the user has shuffle on for the playlist, then
  6942. we go from the first song in the shuffle playlist array.
  6943. */
  6944. if (_config2.default.playlists[playlist].shuffle) {
  6945. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].shuffle_list[0], 0, true);
  6946. } else {
  6947. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[0], 0);
  6948. }
  6949. }
  6950. /*
  6951. If the song is paused, we play the song. If the song is playing,
  6952. we pause the song.
  6953. */
  6954. if (_config2.default.audio.paused) {
  6955. _core2.default.play();
  6956. } else {
  6957. _core2.default.pause();
  6958. }
  6959. /*
  6960. Now we sync all the elements to match the state of the audio.
  6961. We don't need to do any checks on new songs or changed playlists
  6962. in the global since it's whatever song is playing.
  6963. */
  6964. _playPauseElements2.default.sync();
  6965. }
  6966. /**
  6967. * Sets the playlist main play pause buttons to the current state of the song.
  6968. * @access private
  6969. * @param {string} song The index of the song being played/paused
  6970. */
  6971. function handleSongPlayPause(song) {
  6972. /*
  6973. There can be multiple playlists on the page and there can be
  6974. multiple songs on the page AND there can be songs in multiple
  6975. playlists, so we have some checking to do.
  6976. */
  6977. /*
  6978. Check to see if the playlist has changed. Essentially, if we are moving
  6979. out of a playlist context.
  6980. */
  6981. if (_checks2.default.newPlaylist(null)) {
  6982. /*
  6983. We've moved out of the playlist context, so we set the active playlist
  6984. to null
  6985. */
  6986. _audioNavigation2.default.setActivePlaylist(null);
  6987. /*
  6988. We then change the song to the index selected.
  6989. */
  6990. _audioNavigation2.default.changeSong(_config2.default.songs[song], song, true);
  6991. }
  6992. /*
  6993. Check to see if the song has changed. If it has,
  6994. set the active song. If it was in a playlist, the
  6995. song wouldn't change here, since we already set the
  6996. song when we checked for a playlist.
  6997. */
  6998. if (_checks2.default.newSong(null, song)) {
  6999. /*
  7000. The song selected is different, so we change the
  7001. song.
  7002. */
  7003. _audioNavigation2.default.changeSong(_config2.default.songs[song], song, true);
  7004. }
  7005. /*
  7006. If the song is paused, we play the song. If the song is playing,
  7007. we pause the song.
  7008. */
  7009. if (_config2.default.audio.paused) {
  7010. _core2.default.play();
  7011. } else {
  7012. _core2.default.pause();
  7013. }
  7014. /*
  7015. Now we sync all the elements to match the state of the audio.
  7016. We don't need to do any checks on new songs or changed playlists
  7017. in the global since it's whatever song is playing.
  7018. */
  7019. _playPauseElements2.default.sync();
  7020. }
  7021. /**
  7022. * Sets the song in playlist play pause buttons to the current
  7023. * state of the song.
  7024. * @access private
  7025. * @param {string} playlist The playlist the song is a part of
  7026. * @param {number} song The index of the song being played/paused
  7027. */
  7028. function handleSongInPlaylistPlayPause(playlist, song) {
  7029. /*
  7030. There can be multiple playlists on the page and there can be
  7031. multiple songs on the page AND there can be songs in multiple
  7032. playlists, so we have some checking to do.
  7033. */
  7034. /*
  7035. Check to see if the playlist has changed. Essentially, if we are moving
  7036. out of a playlist context.
  7037. */
  7038. if (_checks2.default.newPlaylist(playlist)) {
  7039. /*
  7040. We've moved out of the playlist context, so we set the active playlist
  7041. to null
  7042. */
  7043. _audioNavigation2.default.setActivePlaylist(playlist);
  7044. /*
  7045. We then change the song to the index selected.
  7046. */
  7047. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[song], song, true);
  7048. }
  7049. /*
  7050. Check to see if the song has changed. If it has,
  7051. set the active song. If it was in a playlist, the
  7052. song wouldn't change here, since we already set the
  7053. song when we checked for a playlist.
  7054. */
  7055. if (_checks2.default.newSong(playlist, song)) {
  7056. /*
  7057. The song selected is different, so we change the
  7058. song.
  7059. */
  7060. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[song], song, true);
  7061. }
  7062. /*
  7063. If the song is paused, we play the song. If the song is playing,
  7064. we pause the song.
  7065. */
  7066. if (_config2.default.audio.paused) {
  7067. _core2.default.play();
  7068. } else {
  7069. _core2.default.pause();
  7070. }
  7071. /*
  7072. Now we sync all the elements to match the state of the audio.
  7073. We don't need to do any checks on new songs or changed playlists
  7074. in the global since it's whatever song is playing.
  7075. */
  7076. _playPauseElements2.default.sync();
  7077. }
  7078. /**
  7079. * Returns the public facing methods
  7080. */
  7081. return {
  7082. handle: handle
  7083. };
  7084. }();
  7085. /**
  7086. * Imports the AmplitudeJS Play Pause Elements
  7087. * @module visual/PlayPauseElements
  7088. */
  7089. /**
  7090. * Imports the AmplitudeJS Checks Utility
  7091. * @module utilities/Checks
  7092. */
  7093. /**
  7094. * Import the config state utility.
  7095. * @module utilities/configState
  7096. */
  7097. exports.default = PlayPause;
  7098. module.exports = exports["default"];
  7099. /***/ }),
  7100. /* 33 */
  7101. /***/ (function(module, exports, __webpack_require__) {
  7102. "use strict";
  7103. Object.defineProperty(exports, "__esModule", {
  7104. value: true
  7105. });
  7106. var _config = __webpack_require__(0);
  7107. var _config2 = _interopRequireDefault(_config);
  7108. var _core = __webpack_require__(1);
  7109. var _core2 = _interopRequireDefault(_core);
  7110. var _playbackSpeedElements = __webpack_require__(18);
  7111. var _playbackSpeedElements2 = _interopRequireDefault(_playbackSpeedElements);
  7112. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7113. /**
  7114. * AmplitudeJS Playback Speed Event Handler
  7115. *
  7116. * @module events/PlaybackSpeed
  7117. */
  7118. /**
  7119. * Imports the Amplitude Core module
  7120. * @module core/Core
  7121. */
  7122. var PlaybackSpeed = function () {
  7123. /**
  7124. * Handles an event on the playback speed button
  7125. *
  7126. * HANDLER FOR: class="amplitude-playback-speed"
  7127. *
  7128. * @access public
  7129. */
  7130. function handle() {
  7131. if (!_config2.default.is_touch_moving) {
  7132. /*
  7133. We increment the speed by .5 everytime we click
  7134. the button to change the playback speed. Once we are
  7135. actively playing back at 2, we start back at 1 which
  7136. is normal speed.
  7137. */
  7138. switch (_config2.default.playback_speed) {
  7139. case 1:
  7140. _core2.default.setPlaybackSpeed(1.5);
  7141. break;
  7142. case 1.5:
  7143. _core2.default.setPlaybackSpeed(2);
  7144. break;
  7145. case 2:
  7146. _core2.default.setPlaybackSpeed(1);
  7147. break;
  7148. }
  7149. /*
  7150. Visually sync the playback speed.
  7151. */
  7152. _playbackSpeedElements2.default.sync();
  7153. }
  7154. }
  7155. /*
  7156. Returns public facing methods
  7157. */
  7158. return {
  7159. handle: handle
  7160. };
  7161. }();
  7162. /**
  7163. * Imports the Playback Speed Visual Elements
  7164. * @module visual/PlaybackSpeedElements
  7165. */
  7166. /**
  7167. * Imports the config module
  7168. * @module config
  7169. */
  7170. exports.default = PlaybackSpeed;
  7171. module.exports = exports["default"];
  7172. /***/ }),
  7173. /* 34 */
  7174. /***/ (function(module, exports, __webpack_require__) {
  7175. "use strict";
  7176. Object.defineProperty(exports, "__esModule", {
  7177. value: true
  7178. });
  7179. var _config = __webpack_require__(0);
  7180. var _config2 = _interopRequireDefault(_config);
  7181. var _audioNavigation = __webpack_require__(3);
  7182. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  7183. var _debug = __webpack_require__(4);
  7184. var _debug2 = _interopRequireDefault(_debug);
  7185. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7186. /**
  7187. * AmplitudeJS Prev Event Handler
  7188. *
  7189. * @module events/Prev
  7190. */
  7191. /**
  7192. * Imports the Amplitude Audio Navigation Utility
  7193. * @module utilities/AudioNavigation
  7194. */
  7195. var Prev = function () {
  7196. /**
  7197. * Handles an event on the previous button
  7198. *
  7199. * HANDLER FOR: class="amplitude-prev"
  7200. *
  7201. * GLOBAL: class="amplitude-prev"
  7202. * PLAYLIST: class="amplitude-prev" amplitude-playlist="playlist_key"
  7203. *
  7204. * @access public
  7205. */
  7206. function handle() {
  7207. /*
  7208. We don't fire this if the user is touching the screen and it's moving.
  7209. This could lead to a mis-fire
  7210. */
  7211. if (!_config2.default.is_touch_moving) {
  7212. /*
  7213. Gets the playlist attribute from the element.
  7214. */
  7215. var playlist = this.getAttribute("data-amplitude-playlist");
  7216. /*
  7217. If the playlist is null, we handle the global prev.
  7218. */
  7219. if (playlist == null) {
  7220. handleGlobalPrev();
  7221. }
  7222. /*
  7223. If the playlist is set, we handle the playlist prev.
  7224. */
  7225. if (playlist != null) {
  7226. handlePlaylistPrev(playlist);
  7227. }
  7228. }
  7229. }
  7230. /**
  7231. * Handles an event on a global previous button.
  7232. *
  7233. * @access private
  7234. */
  7235. function handleGlobalPrev() {
  7236. /*
  7237. Check to see if the current state of the player
  7238. is in playlist mode or not playlist mode. If we are in playlist mode,
  7239. we set prev on the playlist.
  7240. */
  7241. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  7242. _audioNavigation2.default.setPrevious();
  7243. } else {
  7244. _audioNavigation2.default.setPreviousPlaylist(_config2.default.active_playlist);
  7245. }
  7246. }
  7247. /**
  7248. * Handles an event on a previous playlist button.
  7249. *
  7250. * @access private
  7251. * @prop {string} playlist - The playlist we are handling the previous for.
  7252. */
  7253. function handlePlaylistPrev(playlist) {
  7254. /*
  7255. Ensure the playlist is the same as the active playlist. To get to change
  7256. the scope to a new playlist, you need to play that playlist.
  7257. */
  7258. if (playlist == _config2.default.active_playlist) {
  7259. _audioNavigation2.default.setPreviousPlaylist(_config2.default.active_playlist);
  7260. } else {
  7261. _debug2.default.writeMessage("You can not go to the previous song on a playlist that is not being played!");
  7262. }
  7263. }
  7264. /*
  7265. Returns the public facing methods.
  7266. */
  7267. return {
  7268. handle: handle
  7269. };
  7270. }();
  7271. /**
  7272. * AmplitudeJS Debug Module
  7273. * @module utilities/Debug
  7274. */
  7275. /**
  7276. * Imports the config module
  7277. * @module config
  7278. */
  7279. exports.default = Prev;
  7280. module.exports = exports["default"];
  7281. /***/ }),
  7282. /* 35 */
  7283. /***/ (function(module, exports, __webpack_require__) {
  7284. "use strict";
  7285. Object.defineProperty(exports, "__esModule", {
  7286. value: true
  7287. });
  7288. var _config = __webpack_require__(0);
  7289. var _config2 = _interopRequireDefault(_config);
  7290. var _bufferedProgressElements = __webpack_require__(24);
  7291. var _bufferedProgressElements2 = _interopRequireDefault(_bufferedProgressElements);
  7292. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7293. /**
  7294. * AmplitudeJS Event Handler for progress
  7295. *
  7296. * @module events/Progress
  7297. */
  7298. /**
  7299. * Imports the config module
  7300. * @module config
  7301. */
  7302. var Progress = function () {
  7303. /**
  7304. * As the song is buffered, we can display the buffered percentage in
  7305. * a progress bar.
  7306. *
  7307. * HANDLER FOR: progress
  7308. *
  7309. * @access public
  7310. */
  7311. function handle() {
  7312. /*
  7313. Help from: http://jsbin.com/badimipi/1/edit?html,js,output
  7314. */
  7315. if (_config2.default.audio.buffered.length - 1 >= 0) {
  7316. var bufferedEnd = _config2.default.audio.buffered.end(_config2.default.audio.buffered.length - 1);
  7317. var duration = _config2.default.audio.duration;
  7318. /*
  7319. Set the computed song buffered value to the config.
  7320. */
  7321. _config2.default.buffered = bufferedEnd / duration * 100;
  7322. }
  7323. /*
  7324. Sync the buffered progress bars.
  7325. */
  7326. _bufferedProgressElements2.default.sync();
  7327. }
  7328. /**
  7329. * Returns the public facing methods
  7330. */
  7331. return {
  7332. handle: handle
  7333. };
  7334. }();
  7335. /**
  7336. * Imports the BufferedProgressElements visual handler
  7337. * @module visual/bufferedProgressElements.js
  7338. */
  7339. exports.default = Progress;
  7340. module.exports = exports["default"];
  7341. /***/ }),
  7342. /* 36 */
  7343. /***/ (function(module, exports, __webpack_require__) {
  7344. "use strict";
  7345. Object.defineProperty(exports, "__esModule", {
  7346. value: true
  7347. });
  7348. var _config = __webpack_require__(0);
  7349. var _config2 = _interopRequireDefault(_config);
  7350. var _repeater = __webpack_require__(12);
  7351. var _repeater2 = _interopRequireDefault(_repeater);
  7352. var _repeatElements = __webpack_require__(8);
  7353. var _repeatElements2 = _interopRequireDefault(_repeatElements);
  7354. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7355. /**
  7356. * AmplitudeJS Repeat Event Handler
  7357. *
  7358. * @module events/Repeat
  7359. */
  7360. /**
  7361. * Imports the repeater utility module.
  7362. * @module utilities/Repeater
  7363. */
  7364. var Repeat = function () {
  7365. /**
  7366. * Handles an event on the repeat button
  7367. *
  7368. * HANDLER FOR: class="amplitude-repeat"
  7369. *
  7370. * GLOBAL: class="amplitude-repeat"
  7371. * PLAYLIST: class="amplitude-repeat" amplitude-playlist="playlist_key"
  7372. *
  7373. * @access public
  7374. */
  7375. function handle() {
  7376. /*
  7377. We don't fire this if the user is touching the screen and it's moving.
  7378. This could lead to a mis-fire
  7379. */
  7380. if (!_config2.default.is_touch_moving) {
  7381. /*
  7382. Gets the playlist attribute from the element.
  7383. */
  7384. var playlist = this.getAttribute("data-amplitude-playlist");
  7385. /*
  7386. If the playlist is null, we handle the global repeat.
  7387. */
  7388. if (playlist == null) {
  7389. handleGlobalRepeat();
  7390. }
  7391. /*
  7392. If the playlist is set, we handle the playlist repeat.
  7393. */
  7394. if (playlist != null) {
  7395. handlePlaylistRepeat(playlist);
  7396. }
  7397. }
  7398. }
  7399. /**
  7400. * Handles an event on a global repeat button.
  7401. *
  7402. * @access private
  7403. */
  7404. function handleGlobalRepeat() {
  7405. /*
  7406. Sets repeat to the opposite of what it was set to
  7407. */
  7408. _repeater2.default.setRepeat(!_config2.default.repeat);
  7409. /*
  7410. Visually sync repeat
  7411. */
  7412. _repeatElements2.default.syncRepeat();
  7413. }
  7414. /**
  7415. * Handles an event on a playlist repeat button.
  7416. *
  7417. * @access private
  7418. * @prop {string} playlist - The playlist we are handling the repeat store.
  7419. */
  7420. function handlePlaylistRepeat(playlist) {
  7421. /*
  7422. Sets repeat to the opposite of what it was set to for the playlist.
  7423. */
  7424. _repeater2.default.setRepeatPlaylist(!_config2.default.playlists[playlist].repeat, playlist);
  7425. /*
  7426. Visually sync playlist repeat
  7427. */
  7428. _repeatElements2.default.syncRepeatPlaylist(playlist);
  7429. }
  7430. /*
  7431. Returns the public facing methods.
  7432. */
  7433. return {
  7434. handle: handle
  7435. };
  7436. }();
  7437. /**
  7438. * Imports the visual repeat elements module
  7439. * @module visual/RepeatElements
  7440. */
  7441. /**
  7442. * Imports the config module
  7443. * @module config
  7444. */
  7445. exports.default = Repeat;
  7446. module.exports = exports["default"];
  7447. /***/ }),
  7448. /* 37 */
  7449. /***/ (function(module, exports, __webpack_require__) {
  7450. "use strict";
  7451. Object.defineProperty(exports, "__esModule", {
  7452. value: true
  7453. });
  7454. var _config = __webpack_require__(0);
  7455. var _config2 = _interopRequireDefault(_config);
  7456. var _repeater = __webpack_require__(12);
  7457. var _repeater2 = _interopRequireDefault(_repeater);
  7458. var _repeatElements = __webpack_require__(8);
  7459. var _repeatElements2 = _interopRequireDefault(_repeatElements);
  7460. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7461. /**
  7462. * Handles an event on the Amplitude Repeat Song.
  7463. *
  7464. * @module events/RepeatSong
  7465. */
  7466. /**
  7467. * Imports the repeat utility
  7468. * @module utilities/Repeater
  7469. */
  7470. var RepeatSong = function () {
  7471. /**
  7472. * Handles an event on the repeat song button
  7473. *
  7474. * HANDLER FOR: 'amplitude-repeat-song'
  7475. *
  7476. * @access public
  7477. */
  7478. function handle() {
  7479. /*
  7480. If the touch is moving, we do not want to accidentally touch the play
  7481. pause element and fire an event.
  7482. */
  7483. if (!_config2.default.is_touch_moving) {
  7484. /*
  7485. Sets repeat song to the opposite of what it was set to
  7486. */
  7487. _repeater2.default.setRepeatSong(!_config2.default.repeat_song);
  7488. /*
  7489. Visually sync repeat song
  7490. */
  7491. _repeatElements2.default.syncRepeatSong();
  7492. }
  7493. }
  7494. /**
  7495. * Returns the public facing methods
  7496. */
  7497. return {
  7498. handle: handle
  7499. };
  7500. }();
  7501. /**
  7502. * Imports the AmplitudeJS Repeat Element
  7503. * @module visual/RepeatElements
  7504. */
  7505. /**
  7506. * Imports the config module
  7507. * @module config
  7508. */
  7509. exports.default = RepeatSong;
  7510. module.exports = exports["default"];
  7511. /***/ }),
  7512. /* 38 */
  7513. /***/ (function(module, exports, __webpack_require__) {
  7514. "use strict";
  7515. Object.defineProperty(exports, "__esModule", {
  7516. value: true
  7517. });
  7518. var _config = __webpack_require__(0);
  7519. var _config2 = _interopRequireDefault(_config);
  7520. var _shuffler = __webpack_require__(13);
  7521. var _shuffler2 = _interopRequireDefault(_shuffler);
  7522. var _shuffleElements = __webpack_require__(19);
  7523. var _shuffleElements2 = _interopRequireDefault(_shuffleElements);
  7524. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7525. /**
  7526. * Handles all of the shuffle events
  7527. * @module events/Shuffle
  7528. */
  7529. /**
  7530. * Imports the shuffler utility
  7531. * @module utilities/Shuffler
  7532. */
  7533. var Shuffle = function () {
  7534. /**
  7535. * Handles an event on the shuffle button
  7536. *
  7537. * HANDLER FOR: class="amplitude-shuffle"
  7538. *
  7539. * GLOBAL: class="amplitude-shuffle"
  7540. * PLAYLIST: class="amplitude-shuffle" amplitude-playlist="playlist_key"
  7541. *
  7542. * @access public
  7543. */
  7544. function handle() {
  7545. /*
  7546. If the touch is moving, we do not want to accidentally touch the play
  7547. pause element and fire an event.
  7548. */
  7549. if (!_config2.default.is_touch_moving) {
  7550. /*
  7551. Get the playlist attribute
  7552. */
  7553. var playlist = this.getAttribute("data-amplitude-playlist");
  7554. /*
  7555. Check to see if the shuffle button belongs to a playlist
  7556. */
  7557. if (playlist == null) {
  7558. handleGlobalShuffle();
  7559. } else {
  7560. handlePlaylistShuffle(playlist);
  7561. }
  7562. }
  7563. }
  7564. /**
  7565. * Handles the event on the global shuffle button.
  7566. */
  7567. function handleGlobalShuffle() {
  7568. /*
  7569. Either shuffles or removes shuffle on the global state.
  7570. */
  7571. _shuffler2.default.toggleShuffle();
  7572. /*
  7573. Visualize the shuffle state change.
  7574. */
  7575. _shuffleElements2.default.syncMain(_config2.default.shuffle_on);
  7576. }
  7577. /**
  7578. * Handles the event on the playlist shuffle button.
  7579. *
  7580. * @param {string} playlist - The playlist string the shuffle button belongs to.
  7581. */
  7582. function handlePlaylistShuffle(playlist) {
  7583. /*
  7584. Either shuffles or removes shuffle on the playlist state.
  7585. */
  7586. _shuffler2.default.toggleShufflePlaylist(playlist);
  7587. /*
  7588. Visually sync the playlist shuffle statuses.
  7589. */
  7590. _shuffleElements2.default.syncPlaylist(playlist);
  7591. }
  7592. /**
  7593. * Returns public facing methods
  7594. */
  7595. return {
  7596. handle: handle
  7597. };
  7598. }();
  7599. /**
  7600. * Imports the visual shuffle elements
  7601. * @module visual/ShuffleElements
  7602. */
  7603. /**
  7604. * Imports the config module
  7605. * @module config
  7606. */
  7607. exports.default = Shuffle;
  7608. module.exports = exports["default"];
  7609. /***/ }),
  7610. /* 39 */
  7611. /***/ (function(module, exports, __webpack_require__) {
  7612. "use strict";
  7613. Object.defineProperty(exports, "__esModule", {
  7614. value: true
  7615. });
  7616. var _config = __webpack_require__(0);
  7617. var _config2 = _interopRequireDefault(_config);
  7618. var _debug = __webpack_require__(4);
  7619. var _debug2 = _interopRequireDefault(_debug);
  7620. var _audioNavigation = __webpack_require__(3);
  7621. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  7622. var _checks = __webpack_require__(5);
  7623. var _checks2 = _interopRequireDefault(_checks);
  7624. var _core = __webpack_require__(1);
  7625. var _core2 = _interopRequireDefault(_core);
  7626. var _playPauseElements = __webpack_require__(2);
  7627. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  7628. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7629. /**
  7630. * Handles the skip to event.
  7631. *
  7632. * @module events/SkipTo
  7633. */
  7634. /**
  7635. * Imports the AmplitudeJS Core Methods
  7636. * @module core/Core
  7637. */
  7638. /**
  7639. * Imports the AmplitudeJS Audio Navigation Utility
  7640. * @module utilities/AudioNavigation
  7641. */
  7642. /**
  7643. * Imports the config module
  7644. * @module config
  7645. */
  7646. var SkipTo = function () {
  7647. /**
  7648. * Handles an event on a skip to button.
  7649. *
  7650. * HANDLER FOR: class="amplitude-skip-to"
  7651. *
  7652. * GLOBAL: class="amplitude-skip-to" amplitude-song-index="song_index" amplitude-location="seconds"
  7653. * PLAYLIST: class="amplitude-skip-to" amplitude-playlist="playlist_key" amplitude-song-index="song_index" amplitude-location="seconds"
  7654. *
  7655. * @access public
  7656. */
  7657. function handle() {
  7658. /*
  7659. If the touch is moving, we do not want to accidentally touch the play
  7660. pause element and fire an event.
  7661. */
  7662. if (!_config2.default.is_touch_moving) {
  7663. /*
  7664. Extracts the needed attributes from the element.
  7665. */
  7666. var playlist = this.getAttribute("data-amplitude-playlist");
  7667. var songIndex = this.getAttribute("data-amplitude-song-index");
  7668. var location = this.getAttribute("data-amplitude-location");
  7669. /*
  7670. If the location is null, write a message. We can't skip to a location
  7671. that is null
  7672. */
  7673. if (location == null) {
  7674. _debug2.default.writeMessage("You must add an 'data-amplitude-location' attribute in seconds to your 'amplitude-skip-to' element.");
  7675. }
  7676. /*
  7677. If the song index is null, write a debug message. We can't skip to a location
  7678. of a null song.
  7679. */
  7680. if (songIndex == null) {
  7681. _debug2.default.writeMessage("You must add an 'data-amplitude-song-index' attribute to your 'amplitude-skip-to' element.");
  7682. }
  7683. /*
  7684. If the location and song index are set, continue.
  7685. */
  7686. if (location != null && songIndex != null) {
  7687. /*
  7688. Determines if the skip to button is in the scope of a playlist.
  7689. */
  7690. if (playlist == null) {
  7691. handleSkipToSong(parseInt(songIndex), parseInt(location));
  7692. } else {
  7693. handleSkipToPlaylist(playlist, parseInt(songIndex), parseInt(location));
  7694. }
  7695. }
  7696. }
  7697. }
  7698. /**
  7699. * Handles the skipping to a specific song
  7700. *
  7701. * @access private
  7702. * @param {string} songIndex - The index of the song being skipped to
  7703. * @param {number} location - The seconds location of the song in the playlist.
  7704. */
  7705. function handleSkipToSong(songIndex, location) {
  7706. /*
  7707. Changes the song to where it's being skipped and then
  7708. play the song.
  7709. */
  7710. _audioNavigation2.default.changeSong(_config2.default.songs[songIndex], songIndex);
  7711. _core2.default.play();
  7712. /*
  7713. Syncs all of the play pause buttons now that we've skipped.
  7714. */
  7715. _playPauseElements2.default.syncGlobal();
  7716. _playPauseElements2.default.syncSong();
  7717. /*
  7718. Skip to the location in the song.
  7719. */
  7720. _core2.default.skipToLocation(location);
  7721. }
  7722. /**
  7723. * Handles the skipping to a song that's in a playlist.
  7724. *
  7725. * @access private
  7726. * @param {string} playlist - The playlist being skipped to
  7727. * @param {string} songIndex - The index of the song in the playlist
  7728. * @param {number} location - The seconds location of the song in the playlist.
  7729. */
  7730. function handleSkipToPlaylist(playlist, songIndex, location) {
  7731. /*
  7732. Checks if we are skipping to a new playlist
  7733. */
  7734. if (_checks2.default.newPlaylist(playlist)) {
  7735. _audioNavigation2.default.setActivePlaylist(playlist);
  7736. }
  7737. /*
  7738. Changes the song to where it's being skipped and then
  7739. play the song.
  7740. */
  7741. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[songIndex], songIndex);
  7742. _core2.default.play();
  7743. /*
  7744. Sync all of the play pause elements.
  7745. */
  7746. _playPauseElements2.default.syncGlobal();
  7747. _playPauseElements2.default.syncPlaylist();
  7748. _playPauseElements2.default.syncSong();
  7749. /*
  7750. Skip to the location in the song.
  7751. */
  7752. _core2.default.skipToLocation(location);
  7753. }
  7754. /**
  7755. * Return public facing methods
  7756. */
  7757. return {
  7758. handle: handle
  7759. };
  7760. }();
  7761. /**
  7762. * Imports the AmplitudeJS play pause elements.
  7763. * @module visual/PlayPauseElements
  7764. */
  7765. /**
  7766. * Imports the AmplitudeJS Checks Utility
  7767. * @module utilities/Checks
  7768. */
  7769. /**
  7770. * Imports AmplitudeJS Debug Utility
  7771. * @module utilities/debug
  7772. */
  7773. exports.default = SkipTo;
  7774. module.exports = exports["default"];
  7775. /***/ }),
  7776. /* 40 */
  7777. /***/ (function(module, exports, __webpack_require__) {
  7778. "use strict";
  7779. Object.defineProperty(exports, "__esModule", {
  7780. value: true
  7781. });
  7782. var _config = __webpack_require__(0);
  7783. var _config2 = _interopRequireDefault(_config);
  7784. var _time = __webpack_require__(23);
  7785. var _time2 = _interopRequireDefault(_time);
  7786. var _songSliderElements = __webpack_require__(14);
  7787. var _songSliderElements2 = _interopRequireDefault(_songSliderElements);
  7788. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7789. /**
  7790. * Handles the song slider to event.
  7791. *
  7792. * @module events/SongSlider
  7793. */
  7794. /**
  7795. * Imports the time utility
  7796. * @module utilities/Time
  7797. */
  7798. var SongSlider = function () {
  7799. /**
  7800. * Handles a song slider element.
  7801. *
  7802. * HANDLER FOR: class="amplitude-song-slider"
  7803. *
  7804. * GLOBAL: class="amplitude-song-slider"
  7805. * PLAYLIST: class="amplitude-song-slider" amplitude-playlist="playlist_key"
  7806. * SONG: class="amplitude-song-slider" amplitude-song-index="song_index"
  7807. * SONG IN PLAYLIST: class="amplitude-song-slider" amplitude-playlist="playlist_key" amplitude-song-index="song_index"
  7808. *
  7809. * @access public
  7810. */
  7811. function handle() {
  7812. /*
  7813. Gets the percentage of the song we will be setting the location for.
  7814. */
  7815. var locationPercentage = this.value;
  7816. /*
  7817. Computes the time in seconds for the current song.
  7818. */
  7819. var computedTime = _config2.default.audio.duration * (locationPercentage / 100);
  7820. /*
  7821. Gets the attributes for playlist and index for the element.
  7822. */
  7823. var playlist = this.getAttribute("data-amplitude-playlist");
  7824. var song = this.getAttribute("data-amplitude-song-index");
  7825. /*
  7826. If no playlist or song is defined, then it's a global song slider.
  7827. */
  7828. if (playlist == null && song == null) {
  7829. handleGlobalSongSlider(computedTime, locationPercentage);
  7830. }
  7831. /*
  7832. If a playlist but no song is defined, then it's playlist slider.
  7833. */
  7834. if (playlist != null && song == null) {
  7835. handlePlaylistSongSlider(computedTime, locationPercentage, playlist);
  7836. }
  7837. /*
  7838. If no playlist but a song is defined, then it's a song slider.
  7839. */
  7840. if (playlist == null && song != null) {
  7841. handleSongSongSlider(computedTime, locationPercentage, song);
  7842. }
  7843. /*
  7844. If playlist and song are defined then it's a song in a playlist
  7845. slider.
  7846. */
  7847. if (playlist != null && song != null) {
  7848. handleSongInPlaylistSongSlider(computedTime, locationPercentage, playlist, song);
  7849. }
  7850. }
  7851. /**
  7852. * Handles a change on a global audio slider
  7853. *
  7854. * @access private
  7855. * @param {integer} computedTime - The time we will set the audio to.
  7856. * @param {float} locationPercentage - The percent through the song.
  7857. */
  7858. function handleGlobalSongSlider(computedTime, locationPercentage) {
  7859. /*
  7860. If the active song is not live, set the current time and adjust the slider.
  7861. */
  7862. if (!_config2.default.active_metadata.live) {
  7863. _time2.default.setCurrentTime(computedTime);
  7864. /*
  7865. Sync song slider elements.
  7866. */
  7867. _songSliderElements2.default.sync(locationPercentage, _config2.default.active_playlist, _config2.default.active_index);
  7868. }
  7869. }
  7870. /**
  7871. * Handles a change on a playlist audio slider
  7872. *
  7873. * @access private
  7874. * @param {integer} computedTime - The time we will set the audio to.
  7875. * @param {float} locationPercentage - The percent through the song.
  7876. * @param {string} playlist = The playlist the song slider belongs to.
  7877. */
  7878. function handlePlaylistSongSlider(computedTime, locationPercentage, playlist) {
  7879. /*
  7880. We don't want to song slide a playlist that's not the
  7881. active placylist.
  7882. */
  7883. if (_config2.default.active_playlist == playlist) {
  7884. /*
  7885. If the active song is not live, set the current time
  7886. */
  7887. if (!_config2.default.active_metadata.live) {
  7888. _time2.default.setCurrentTime(computedTime);
  7889. /*
  7890. Sync song slider elements.
  7891. */
  7892. _songSliderElements2.default.sync(locationPercentage, playlist, _config2.default.active_index);
  7893. }
  7894. }
  7895. }
  7896. /**
  7897. * Handles a change on a song audio slider
  7898. *
  7899. * @access private
  7900. * @param {integer} computedTime - The time we will set the audio to.
  7901. * @param {float} locationPercentage - The percent through the song.
  7902. * @param {integer} songIndex = The song being navigated.
  7903. */
  7904. function handleSongSongSlider(computedTime, locationPercentage, songIndex) {
  7905. /*
  7906. We only want to move the slider if the active song is the
  7907. same as the song being selected.
  7908. */
  7909. if (_config2.default.active_index == songIndex && _config2.default.active_playlist == null) {
  7910. /*
  7911. If the active song is not live, set the current time
  7912. */
  7913. if (!_config2.default.active_metadata.live) {
  7914. _time2.default.setCurrentTime(computedTime);
  7915. /*
  7916. Sync song slider elements.
  7917. */
  7918. _songSliderElements2.default.sync(locationPercentage, _config2.default.active_playlist, songIndex);
  7919. }
  7920. }
  7921. }
  7922. /**
  7923. * Handles a change on a song audio slider
  7924. *
  7925. * @access private
  7926. * @param {integer} computedTime - The time we will set the audio to.
  7927. * @param {float} locationPercentage - The percent through the song.
  7928. * @param {integer} playlist = The playlist the song belongs to.
  7929. * @param {integer} songIndex = The song being navigated.
  7930. */
  7931. function handleSongInPlaylistSongSlider(computedTime, locationPercentage, playlist, songIndex) {
  7932. /*
  7933. We only want to move the slider if the active song is the
  7934. same as the song being selected and the active playlist is the same
  7935. as the playlist selected.
  7936. */
  7937. if (_config2.default.playlists[playlist].active_index == songIndex && _config2.default.active_playlist == playlist) {
  7938. /*
  7939. If the active song is not live, set the current time
  7940. */
  7941. if (!_config2.default.active_metadata.live) {
  7942. _time2.default.setCurrentTime(computedTime);
  7943. /*
  7944. Sync song slider elements.
  7945. */
  7946. _songSliderElements2.default.sync(locationPercentage, playlist, songIndex);
  7947. }
  7948. }
  7949. }
  7950. /*
  7951. Return public facing methods
  7952. */
  7953. return {
  7954. handle: handle
  7955. };
  7956. }();
  7957. /**
  7958. * Imports the song slider elements.
  7959. * @module visual/SongSliderElements
  7960. */
  7961. /**
  7962. * Imports the config module
  7963. * @module config
  7964. */
  7965. exports.default = SongSlider;
  7966. module.exports = exports["default"];
  7967. /***/ }),
  7968. /* 41 */
  7969. /***/ (function(module, exports, __webpack_require__) {
  7970. "use strict";
  7971. Object.defineProperty(exports, "__esModule", {
  7972. value: true
  7973. });
  7974. var _config = __webpack_require__(0);
  7975. var _config2 = _interopRequireDefault(_config);
  7976. var _configState = __webpack_require__(6);
  7977. var _configState2 = _interopRequireDefault(_configState);
  7978. var _playPauseElements = __webpack_require__(2);
  7979. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  7980. var _core = __webpack_require__(1);
  7981. var _core2 = _interopRequireDefault(_core);
  7982. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7983. /**
  7984. * Handles all of the stop events
  7985. * @module events/Stop
  7986. */
  7987. /**
  7988. * Imports the AmplitudeJS Play Pause Elements
  7989. * @module visual/PlayPauseElements
  7990. */
  7991. /**
  7992. * Imports the config module
  7993. * @module config
  7994. */
  7995. var Stop = function () {
  7996. /**
  7997. * Handles an event on a stop element.
  7998. *
  7999. * HANDLER FOR: class="amplitude-stop"
  8000. *
  8001. * @access public
  8002. */
  8003. function handle() {
  8004. /*
  8005. If touch is not moving, we run. We don't want to accidentally press
  8006. stop if touch is moving.
  8007. */
  8008. if (!_config2.default.is_touch_moving) {
  8009. /*
  8010. Sets all of the play/pause buttons to pause
  8011. */
  8012. _playPauseElements2.default.syncToPause();
  8013. /*
  8014. Stops the active song.
  8015. */
  8016. _core2.default.stop();
  8017. }
  8018. }
  8019. /**
  8020. * Returns public facing methods
  8021. */
  8022. return {
  8023. handle: handle
  8024. };
  8025. }();
  8026. /**
  8027. * Imports the AmplitudeJS Core Methods
  8028. * @module core/Core
  8029. */
  8030. /**
  8031. * Imports the config state module.
  8032. * @module utilities/configState
  8033. */
  8034. exports.default = Stop;
  8035. module.exports = exports["default"];
  8036. /***/ }),
  8037. /* 42 */
  8038. /***/ (function(module, exports, __webpack_require__) {
  8039. "use strict";
  8040. Object.defineProperty(exports, "__esModule", {
  8041. value: true
  8042. });
  8043. var _config = __webpack_require__(0);
  8044. var _config2 = _interopRequireDefault(_config);
  8045. var _bufferedProgressElements = __webpack_require__(24);
  8046. var _bufferedProgressElements2 = _interopRequireDefault(_bufferedProgressElements);
  8047. var _timeElements = __webpack_require__(15);
  8048. var _timeElements2 = _interopRequireDefault(_timeElements);
  8049. var _songSliderElements = __webpack_require__(14);
  8050. var _songSliderElements2 = _interopRequireDefault(_songSliderElements);
  8051. var _songPlayedProgressElements = __webpack_require__(20);
  8052. var _songPlayedProgressElements2 = _interopRequireDefault(_songPlayedProgressElements);
  8053. var _time = __webpack_require__(23);
  8054. var _time2 = _interopRequireDefault(_time);
  8055. var _callbacks = __webpack_require__(9);
  8056. var _callbacks2 = _interopRequireDefault(_callbacks);
  8057. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8058. /**
  8059. * AmplitudeJS Event Handler for Time Update
  8060. *
  8061. * @module events/TimeUpdate
  8062. */
  8063. /**
  8064. * Imports the Time utility class
  8065. * @module utilities/Time
  8066. */
  8067. /**
  8068. * Imports the Song Slider Elements visual class.
  8069. * @module visual/songSliderElements
  8070. */
  8071. /**
  8072. * Imports the Buffered Progress Elements visual class
  8073. * @module visual/bufferedProgressElements
  8074. */
  8075. var TimeUpdate = function () {
  8076. /**
  8077. * When the time updates on the active song, we sync the current time displays
  8078. *
  8079. * HANDLER FOR: timeupdate
  8080. *
  8081. * @access public
  8082. */
  8083. function handle() {
  8084. /*
  8085. Computes the buffered time.
  8086. */
  8087. computeBufferedTime();
  8088. /*
  8089. Sync the buffered progress elements.
  8090. */
  8091. _bufferedProgressElements2.default.sync();
  8092. /*
  8093. Updates the current time information.
  8094. */
  8095. updateTimeInformation();
  8096. /*
  8097. Run time callbacks
  8098. */
  8099. runTimeCallbacks();
  8100. }
  8101. /**
  8102. * Computes the buffered time
  8103. */
  8104. function computeBufferedTime() {
  8105. /*
  8106. Help from: http://jsbin.com/badimipi/1/edit?html,js,output
  8107. */
  8108. if (_config2.default.audio.buffered.length - 1 >= 0) {
  8109. var bufferedEnd = _config2.default.audio.buffered.end(_config2.default.audio.buffered.length - 1);
  8110. var duration = _config2.default.audio.duration;
  8111. _config2.default.buffered = bufferedEnd / duration * 100;
  8112. }
  8113. }
  8114. /**
  8115. * Updates the current time information.
  8116. * @access private
  8117. */
  8118. function updateTimeInformation() {
  8119. /*
  8120. If the current song is not live, then
  8121. we can update the time information. Otherwise the
  8122. current time updates wouldn't mean much since the time
  8123. is infinite.
  8124. */
  8125. if (!_config2.default.active_metadata.live) {
  8126. /*
  8127. Compute the current time
  8128. */
  8129. var currentTime = _time2.default.computeCurrentTimes();
  8130. /*
  8131. Compute the song completion percentage
  8132. */
  8133. var songCompletionPercentage = _time2.default.computeSongCompletionPercentage();
  8134. /*
  8135. Computes the song duration
  8136. */
  8137. var songDuration = _time2.default.computeSongDuration();
  8138. /*
  8139. Sync the current time elements with the current
  8140. location of the song and the song duration elements with
  8141. the duration of the song.
  8142. */
  8143. _timeElements2.default.syncCurrentTimes(currentTime);
  8144. /*
  8145. Sync the song slider elements.
  8146. */
  8147. _songSliderElements2.default.sync(songCompletionPercentage, _config2.default.active_playlist, _config2.default.active_index);
  8148. /*
  8149. Sync the song played progress elements.
  8150. */
  8151. _songPlayedProgressElements2.default.sync(songCompletionPercentage);
  8152. /*
  8153. Sync the duration time elements.
  8154. */
  8155. _timeElements2.default.syncDurationTimes(currentTime, songDuration);
  8156. }
  8157. }
  8158. /**
  8159. * Runs a callback at a certain time in the song.
  8160. */
  8161. function runTimeCallbacks() {
  8162. /*
  8163. Gets the current seconds into the song.
  8164. */
  8165. var currentSeconds = Math.floor(_config2.default.audio.currentTime);
  8166. /*
  8167. Checks to see if there is a callback at the certain seconds into the song.
  8168. */
  8169. if (_config2.default.active_metadata.time_callbacks != undefined && _config2.default.active_metadata.time_callbacks[currentSeconds] != undefined) {
  8170. /*
  8171. Checks to see if the callback has been run. Since the time updates more than
  8172. one second, we don't want the callback to run X times.
  8173. */
  8174. if (!_config2.default.active_metadata.time_callbacks[currentSeconds].run) {
  8175. _config2.default.active_metadata.time_callbacks[currentSeconds].run = true;
  8176. _config2.default.active_metadata.time_callbacks[currentSeconds]();
  8177. }
  8178. } else {
  8179. /*
  8180. Iterate over all of the callbacks for a song. If the song has one, we flag
  8181. the run as false. This occurs because we have passed the active second for
  8182. the callback, so we flag it as not run. It will either run again if the user
  8183. seeks back or not run in the future.
  8184. */
  8185. for (var seconds in _config2.default.active_metadata.time_callbacks) {
  8186. if (_config2.default.active_metadata.time_callbacks.hasOwnProperty(seconds)) {
  8187. _config2.default.active_metadata.time_callbacks[seconds].run = false;
  8188. }
  8189. }
  8190. }
  8191. }
  8192. /**
  8193. * Returns public functions
  8194. */
  8195. return {
  8196. handle: handle
  8197. };
  8198. }();
  8199. /**
  8200. * Imports the Callback utility class
  8201. * @module utilities/Callbacks
  8202. */
  8203. /**
  8204. * Imports the Song Played Progress Elements visual class.
  8205. * @module visual/songPlayedProgressElements
  8206. */
  8207. /**
  8208. * Imports the Time Elements visual class.
  8209. * @module visual/timeElements
  8210. */
  8211. /**
  8212. * Imports the config module
  8213. * @module config
  8214. */
  8215. exports.default = TimeUpdate;
  8216. module.exports = exports["default"];
  8217. /***/ }),
  8218. /* 43 */
  8219. /***/ (function(module, exports, __webpack_require__) {
  8220. "use strict";
  8221. Object.defineProperty(exports, "__esModule", {
  8222. value: true
  8223. });
  8224. var _config = __webpack_require__(0);
  8225. var _config2 = _interopRequireDefault(_config);
  8226. var _core = __webpack_require__(1);
  8227. var _core2 = _interopRequireDefault(_core);
  8228. var _muteElements = __webpack_require__(10);
  8229. var _muteElements2 = _interopRequireDefault(_muteElements);
  8230. var _volumeSliderElements = __webpack_require__(11);
  8231. var _volumeSliderElements2 = _interopRequireDefault(_volumeSliderElements);
  8232. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8233. /**
  8234. * Handles all events for a volume down event.
  8235. * @module events/VolumeDown
  8236. */
  8237. /**
  8238. * Imports the AmplitudeJS Visual Mute Elements
  8239. * @module visual/MuteElements
  8240. */
  8241. /**
  8242. * Imports the config to use the values
  8243. */
  8244. var VolumeDown = function () {
  8245. /**
  8246. * Handles a click on a volume down element.
  8247. *
  8248. * HANDLER FOR: class="amplitude-volume-down"
  8249. *
  8250. * @access public
  8251. */
  8252. function handle() {
  8253. /*
  8254. We don't fire this if the user is touching the screen and it's moving.
  8255. This could lead to a mis-fire
  8256. */
  8257. if (!_config2.default.is_touch_moving) {
  8258. /*
  8259. The volume range is from 0 to 1 for an audio element. We make this
  8260. a base of 100 for ease of working with.
  8261. If the new value is less than 100, we use the new calculated
  8262. value which gets converted to the proper unit for the audio element.
  8263. If the new value is greater than 100, we set the volume to 1 which
  8264. is the max for the audio element.
  8265. */
  8266. var volume = null;
  8267. if (_config2.default.volume - _config2.default.volume_increment > 0) {
  8268. volume = _config2.default.volume - _config2.default.volume_increment;
  8269. } else {
  8270. volume = 0;
  8271. }
  8272. /*
  8273. Calls the core function to set the volume to the computed value
  8274. based on the user's intent.
  8275. */
  8276. _core2.default.setVolume(volume);
  8277. /*
  8278. Sync Mute Elements.
  8279. */
  8280. _muteElements2.default.setMuted(_config2.default.volume == 0 ? true : false);
  8281. /*
  8282. Sync Volume Slider Elements
  8283. */
  8284. _volumeSliderElements2.default.sync();
  8285. }
  8286. }
  8287. /**
  8288. * Returns the public facing methods
  8289. */
  8290. return {
  8291. handle: handle
  8292. };
  8293. }();
  8294. /**
  8295. * Imports the AmplitudeJS Visual Volume Slider Elements
  8296. * @module visual/VolumeSliderElements
  8297. */
  8298. /**
  8299. * Imports the AmplitudeJS Core Methods
  8300. * @module core/core
  8301. */
  8302. exports.default = VolumeDown;
  8303. module.exports = exports["default"];
  8304. /***/ }),
  8305. /* 44 */
  8306. /***/ (function(module, exports, __webpack_require__) {
  8307. "use strict";
  8308. Object.defineProperty(exports, "__esModule", {
  8309. value: true
  8310. });
  8311. var _config = __webpack_require__(0);
  8312. var _config2 = _interopRequireDefault(_config);
  8313. var _core = __webpack_require__(1);
  8314. var _core2 = _interopRequireDefault(_core);
  8315. var _muteElements = __webpack_require__(10);
  8316. var _muteElements2 = _interopRequireDefault(_muteElements);
  8317. var _volumeSliderElements = __webpack_require__(11);
  8318. var _volumeSliderElements2 = _interopRequireDefault(_volumeSliderElements);
  8319. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8320. /**
  8321. * Handles all events for a volume up event.
  8322. * @module events/VolumeSlider
  8323. */
  8324. /**
  8325. * Imports the AmplitudeJS Visual Mute Elements
  8326. * @module visual/MuteElements
  8327. */
  8328. /**
  8329. * Imports the config to use the values
  8330. */
  8331. var VolumeSlider = function () {
  8332. /**
  8333. * Handles a change on the volume slider
  8334. *
  8335. * HANDLER FOR: class="amplitude-volume-slider"
  8336. *
  8337. * @access public
  8338. */
  8339. function handle() {
  8340. /*
  8341. Calls the core function to set the volume to the computed value
  8342. based on the user's intent.
  8343. */
  8344. _core2.default.setVolume(this.value);
  8345. /*
  8346. Sync Mute Elements.
  8347. */
  8348. _muteElements2.default.setMuted(_config2.default.volume == 0 ? true : false);
  8349. /*
  8350. Sync the volume slider locations
  8351. */
  8352. _volumeSliderElements2.default.sync();
  8353. }
  8354. /**
  8355. * Returns the public facing methods
  8356. */
  8357. return {
  8358. handle: handle
  8359. };
  8360. }();
  8361. /**
  8362. * Imports the AmplitudeJS Visual Volume Slider Elements
  8363. * @module visual/VolumeSliderElements
  8364. */
  8365. /**
  8366. * Imports the AmplitudeJS Core Methods
  8367. * @module core/core
  8368. */
  8369. exports.default = VolumeSlider;
  8370. module.exports = exports["default"];
  8371. /***/ }),
  8372. /* 45 */
  8373. /***/ (function(module, exports, __webpack_require__) {
  8374. "use strict";
  8375. Object.defineProperty(exports, "__esModule", {
  8376. value: true
  8377. });
  8378. var _config = __webpack_require__(0);
  8379. var _config2 = _interopRequireDefault(_config);
  8380. var _core = __webpack_require__(1);
  8381. var _core2 = _interopRequireDefault(_core);
  8382. var _muteElements = __webpack_require__(10);
  8383. var _muteElements2 = _interopRequireDefault(_muteElements);
  8384. var _volumeSliderElements = __webpack_require__(11);
  8385. var _volumeSliderElements2 = _interopRequireDefault(_volumeSliderElements);
  8386. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8387. /**
  8388. * Handles all events for a volume up event.
  8389. * @module events/VolumeUp
  8390. */
  8391. /**
  8392. * Imports the AmplitudeJS Visual Mute Elements
  8393. * @module visual/MuteElements
  8394. */
  8395. /**
  8396. * Imports the config to use the values
  8397. */
  8398. var VolumeUp = function () {
  8399. /**
  8400. * Handles a click on a volume up element.
  8401. *
  8402. * HANDLER FOR: class="amplitude-volume-up"
  8403. *
  8404. * @access public
  8405. */
  8406. function handle() {
  8407. /*
  8408. We don't fire this if the user is touching the screen and it's moving.
  8409. This could lead to a mis-fire
  8410. */
  8411. if (!_config2.default.is_touch_moving) {
  8412. /*
  8413. The volume range is from 0 to 1 for an audio element. We make this
  8414. a base of 100 for ease of working with.
  8415. If the new value is less than 100, we use the new calculated
  8416. value which gets converted to the proper unit for the audio element.
  8417. If the new value is greater than 100, we set the volume to 1 which
  8418. is the max for the audio element.
  8419. */
  8420. var volume = null;
  8421. if (_config2.default.volume + _config2.default.volume_increment <= 100) {
  8422. volume = _config2.default.volume + _config2.default.volume_increment;
  8423. } else {
  8424. volume = 100;
  8425. }
  8426. /*
  8427. Calls the core function to set the volume to the computed value
  8428. based on the user's intent.
  8429. */
  8430. _core2.default.setVolume(volume);
  8431. /*
  8432. Sync Mute Elements.
  8433. */
  8434. _muteElements2.default.setMuted(_config2.default.volume == 0 ? true : false);
  8435. /*
  8436. Sync Volume Slider Elements
  8437. */
  8438. _volumeSliderElements2.default.sync();
  8439. }
  8440. }
  8441. /**
  8442. * Returns the public facing methods
  8443. */
  8444. return {
  8445. handle: handle
  8446. };
  8447. }();
  8448. /**
  8449. * Imports the AmplitudeJS Visual Volume Slider Elements
  8450. * @module visual/VolumeSliderElements
  8451. */
  8452. /**
  8453. * Imports the AmplitudeJS Core Methods
  8454. * @module core/core
  8455. */
  8456. exports.default = VolumeUp;
  8457. module.exports = exports["default"];
  8458. /***/ }),
  8459. /* 46 */
  8460. /***/ (function(module, exports, __webpack_require__) {
  8461. "use strict";
  8462. Object.defineProperty(exports, "__esModule", {
  8463. value: true
  8464. });
  8465. var _config = __webpack_require__(0);
  8466. var _config2 = _interopRequireDefault(_config);
  8467. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8468. /**
  8469. * AmplitudeJS FX Module. Helps with configuring and setting up visualizations
  8470. * and any other features of the Web Audio API that Amplitude takes advantage
  8471. * of.
  8472. *
  8473. * @module fx/FX
  8474. */
  8475. var Fx = function () {
  8476. /**
  8477. * Configures the Web Audio API to work with AmplitudeJS
  8478. */
  8479. function configureWebAudioAPI() {
  8480. /*
  8481. Gets the context for the browser. If this is null, the Web Audio
  8482. API is unavailable.
  8483. */
  8484. var browserContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.oAudioContext || window.msAudioContext;
  8485. /*
  8486. If we have a context, the Web Audio API is available and we can continue,
  8487. otherwise, we alert the user if they have debug turned on.
  8488. */
  8489. if (browserContext) {
  8490. /*
  8491. Web Audio API is available, set the context in our config.
  8492. */
  8493. _config2.default.context = new browserContext();
  8494. /*
  8495. Create an analyzer that we will use in the context.
  8496. */
  8497. _config2.default.analyser = _config2.default.context.createAnalyser();
  8498. /*
  8499. Set cross origin to anonymous so we have a better chance of being able
  8500. to use the power of the Web Audio API.
  8501. */
  8502. _config2.default.audio.crossOrigin = "anonymous";
  8503. /*
  8504. Bind the source to the Javascript Audio Element.
  8505. */
  8506. _config2.default.source = _config2.default.context.createMediaElementSource(_config2.default.audio);
  8507. /*
  8508. Connect the analyser to the source
  8509. */
  8510. _config2.default.source.connect(_config2.default.analyser);
  8511. /*
  8512. Connect the context destination to the analyser.
  8513. */
  8514. _config2.default.analyser.connect(_config2.default.context.destination);
  8515. } else {
  8516. AmplitudeHelpers.writeDebugMessage("Web Audio API is unavailable! We will set any of your visualizations with your back up definition!");
  8517. }
  8518. }
  8519. /**
  8520. * Determines if the web audio API is available or not.
  8521. */
  8522. function webAudioAPIAvailable() {
  8523. /*
  8524. Gets the context for the browser. If this is null, the Web Audio
  8525. API is unavailable.
  8526. */
  8527. var browserContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.oAudioContext || window.msAudioContext;
  8528. _config2.default.web_audio_api_available = false;
  8529. /*
  8530. Determines if the Web Audio API is available or not.
  8531. */
  8532. if (browserContext) {
  8533. /*
  8534. Set the flag in the config that the Web Audio API is available
  8535. */
  8536. _config2.default.web_audio_api_available = true;
  8537. return true;
  8538. } else {
  8539. /*
  8540. Set the flag in the config that the Web Audio API is not available
  8541. */
  8542. _config2.default.web_audio_api_available = false;
  8543. return false;
  8544. }
  8545. }
  8546. /**
  8547. * Determines if the user is using any of the web audio API features.
  8548. */
  8549. function determineUsingAnyFX() {
  8550. var waveforms = document.querySelectorAll(".amplitude-wave-form");
  8551. var visualizationElements = document.querySelectorAll(".amplitude-visualization");
  8552. if (waveforms.length > 0 || visualizationElements.length > 0) {
  8553. return true;
  8554. } else {
  8555. return false;
  8556. }
  8557. }
  8558. /*
  8559. Returns the publicly accessible methods
  8560. */
  8561. return {
  8562. configureWebAudioAPI: configureWebAudioAPI,
  8563. webAudioAPIAvailable: webAudioAPIAvailable,
  8564. determineUsingAnyFX: determineUsingAnyFX
  8565. };
  8566. }(); /**
  8567. * Imports the config module
  8568. * @module config
  8569. */
  8570. exports.default = Fx;
  8571. module.exports = exports["default"];
  8572. /***/ }),
  8573. /* 47 */
  8574. /***/ (function(module, exports, __webpack_require__) {
  8575. "use strict";
  8576. Object.defineProperty(exports, "__esModule", {
  8577. value: true
  8578. });
  8579. var _init = __webpack_require__(21);
  8580. var _init2 = _interopRequireDefault(_init);
  8581. var _config = __webpack_require__(0);
  8582. var _config2 = _interopRequireDefault(_config);
  8583. var _core = __webpack_require__(1);
  8584. var _core2 = _interopRequireDefault(_core);
  8585. var _shuffler = __webpack_require__(13);
  8586. var _shuffler2 = _interopRequireDefault(_shuffler);
  8587. var _configState = __webpack_require__(6);
  8588. var _configState2 = _interopRequireDefault(_configState);
  8589. var _audioNavigation = __webpack_require__(3);
  8590. var _audioNavigation2 = _interopRequireDefault(_audioNavigation);
  8591. var _repeater = __webpack_require__(12);
  8592. var _repeater2 = _interopRequireDefault(_repeater);
  8593. var _checks = __webpack_require__(5);
  8594. var _checks2 = _interopRequireDefault(_checks);
  8595. var _visualizations = __webpack_require__(16);
  8596. var _visualizations2 = _interopRequireDefault(_visualizations);
  8597. var _shuffleElements = __webpack_require__(19);
  8598. var _shuffleElements2 = _interopRequireDefault(_shuffleElements);
  8599. var _repeatElements = __webpack_require__(8);
  8600. var _repeatElements2 = _interopRequireDefault(_repeatElements);
  8601. var _songSliderElements = __webpack_require__(14);
  8602. var _songSliderElements2 = _interopRequireDefault(_songSliderElements);
  8603. var _songPlayedProgressElements = __webpack_require__(20);
  8604. var _songPlayedProgressElements2 = _interopRequireDefault(_songPlayedProgressElements);
  8605. var _timeElements = __webpack_require__(15);
  8606. var _timeElements2 = _interopRequireDefault(_timeElements);
  8607. var _playPauseElements = __webpack_require__(2);
  8608. var _playPauseElements2 = _interopRequireDefault(_playPauseElements);
  8609. var _metaDataElements = __webpack_require__(7);
  8610. var _metaDataElements2 = _interopRequireDefault(_metaDataElements);
  8611. var _playbackSpeedElements = __webpack_require__(18);
  8612. var _playbackSpeedElements2 = _interopRequireDefault(_playbackSpeedElements);
  8613. var _debug = __webpack_require__(4);
  8614. var _debug2 = _interopRequireDefault(_debug);
  8615. var _soundcloud = __webpack_require__(17);
  8616. var _soundcloud2 = _interopRequireDefault(_soundcloud);
  8617. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8618. /**
  8619. * Amplitude should just be an interface to the public functions.
  8620. * Everything else should be handled by other objects
  8621. *
  8622. * @module Amplitude
  8623. */
  8624. /**
  8625. * Meta Data Elements
  8626. * @module visual/MetaDataElements
  8627. */
  8628. /**
  8629. * Time Elements
  8630. * @module visual/TimeElements
  8631. */
  8632. /**
  8633. * Song Slider Elements
  8634. * @module visual/SongSliderElements
  8635. */
  8636. /****************************************************
  8637. * Elements
  8638. ****************************************************/
  8639. /**
  8640. * Visual Shuffle Elements
  8641. * @module visual/ShuffleElements
  8642. */
  8643. /**
  8644. * Imports the checks
  8645. * @module utilities/Checks
  8646. */
  8647. /**
  8648. * Imports the audio navigation
  8649. * @module utilities/AudioNavigation
  8650. */
  8651. /****************************************************
  8652. * Utilities
  8653. ****************************************************/
  8654. /**
  8655. * Shuffler Module
  8656. * @module utilities/Shuffler
  8657. */
  8658. /****************************************************
  8659. * Config
  8660. ****************************************************/
  8661. /**
  8662. * Imports the config module
  8663. * @module config
  8664. */
  8665. var Amplitude = function () {
  8666. /**
  8667. * The main init function. The user will call this through
  8668. * Amplitude.init({}) and pass in their settings.
  8669. *
  8670. * Public Accessor: Amplitude.init( user_config_json );
  8671. *
  8672. * @access public
  8673. * @param {object} userConfig - A JSON object of user defined values that helps configure and initialize AmplitudeJS.
  8674. */
  8675. function init(userConfig) {
  8676. _init2.default.initialize(userConfig);
  8677. }
  8678. /**
  8679. * Returns the current config for AmplitudeJS
  8680. */
  8681. function getConfig() {
  8682. return _config2.default;
  8683. }
  8684. /**
  8685. * Binds new elements that were added to the page.
  8686. *
  8687. * Public Accessor: Amplitude.bindNewElements()
  8688. *
  8689. * @access public
  8690. */
  8691. function bindNewElements() {
  8692. _init2.default.rebindDisplay();
  8693. }
  8694. /**
  8695. * Returns the active playlist.
  8696. *
  8697. * Public Accessor: Amplitude.getActivePlaylist()
  8698. *
  8699. * @access public
  8700. */
  8701. function getActivePlaylist() {
  8702. return _config2.default.active_playlist;
  8703. }
  8704. /**
  8705. * Returns the current playback speed.
  8706. *
  8707. * Public Accessor: Amplitude.getPlaybackSpeed()
  8708. *
  8709. * @access public
  8710. */
  8711. function getPlaybackSpeed() {
  8712. return _config2.default.playback_speed;
  8713. }
  8714. /**
  8715. * Sets the playback speed
  8716. *
  8717. * Public Accessor: Amplitude.setPlaybackSpeed( speed )
  8718. *
  8719. * @access public
  8720. */
  8721. function setPlaybackSpeed(speed) {
  8722. /*
  8723. Increments are set in .5 We only accept values
  8724. 1, 1.5, 2
  8725. 1 -> Regular Speed
  8726. 1.5 -> 50% faster
  8727. 2 -> Twice as fast
  8728. */
  8729. _core2.default.setPlaybackSpeed(speed);
  8730. /*
  8731. Visually sync the playback speed.
  8732. */
  8733. _playbackSpeedElements2.default.sync();
  8734. }
  8735. /**
  8736. * Gets the repeat state of the player.
  8737. *
  8738. * Public Accessor: Amplitude.getRepeat()
  8739. *
  8740. * @access public
  8741. */
  8742. function getRepeat() {
  8743. return _config2.default.repeat;
  8744. }
  8745. /**
  8746. * Gets the repeat state for a playlist
  8747. *
  8748. * Public Accessor: Amplitude.getRepeatPlaylist()
  8749. *
  8750. * @access public
  8751. */
  8752. function getRepeatPlaylist(playlistKey) {
  8753. return _config2.default.playlists[playlistKey].repeat;
  8754. }
  8755. /**
  8756. * Returns the shuffle state of the player.
  8757. *
  8758. * Public Accessor: Amplitude.getShuffle()
  8759. *
  8760. * @access public
  8761. */
  8762. function getShuffle() {
  8763. return _config2.default.shuffle_on;
  8764. }
  8765. /**
  8766. * Returns the shuffle state of the playlist.
  8767. *
  8768. * Public Accessor: Amplitude.getShufflePlaylist( playlist )
  8769. *
  8770. * @access public
  8771. * @param {string} playlist - The key representing the playlist ID to see if it's shuffled or not.
  8772. */
  8773. function getShufflePlaylist(playlist) {
  8774. return _config2.default.playlists[playlist].shuffle;
  8775. }
  8776. /**
  8777. * Sets the shuffle state for the player.
  8778. *
  8779. * Public Accessor: Amplitude.setShuffle()
  8780. *
  8781. * @param {boolean} shuffle - True when we are shuffling the songs, false when we turn off shuffle.
  8782. *
  8783. * @access public
  8784. */
  8785. function setShuffle(shuffle) {
  8786. _shuffler2.default.setShuffle(shuffle);
  8787. _shuffleElements2.default.syncMain();
  8788. }
  8789. /**
  8790. * Sets the shuffle state for the playlist
  8791. *
  8792. * Public Accessor: Amplitude.setShufflePlaylist( playlist )
  8793. *
  8794. * @access public
  8795. * @param {string} playlist - The key representing the playlist ID to to shuffle the playlist.
  8796. * @param {boolean} shuffle - True when we are shuffling the playlist, false when we turn off shuffle.
  8797. */
  8798. function setShufflePlaylist(playlist, shuffle) {
  8799. _shuffler2.default.setShufflePlaylist(playlist, shuffle);
  8800. _shuffleElements2.default.syncMain();
  8801. _shuffleElements2.default.syncPlaylist(playlist);
  8802. }
  8803. /**
  8804. * Sets the repeat state for the player.
  8805. *
  8806. * Public Accessor: Amplitude.setRepeat()
  8807. *
  8808. * @access public
  8809. * @param {boolean} repeatState - The state you want the repeat song to be in.
  8810. */
  8811. function setRepeat(repeatState) {
  8812. _repeater2.default.setRepeat(repeatState);
  8813. _repeatElements2.default.syncRepeat();
  8814. }
  8815. /**
  8816. * Sets the repeat state for a playlist.
  8817. *
  8818. * Public Accessor: Amplitude.setRepeatPlaylist( playlistKey )
  8819. *
  8820. * @access public
  8821. * @param {string} playlist - The key representing the playlist ID to to shuffle the playlist.
  8822. * @param {boolean} repeatState - The state you want the repeat playlist to be in.
  8823. */
  8824. function setRepeatPlaylist(playlist, repeatState) {
  8825. _repeater2.default.setRepeatPlaylist(repeatState, playlist);
  8826. _repeatElements2.default.syncRepeatPlaylist(playlist);
  8827. }
  8828. /**
  8829. * Sets the repeat state for the song.
  8830. *
  8831. * Public Accessor: Amplitude.setRepeatSong()
  8832. *
  8833. * @access public
  8834. * @param {boolean} repeatState - The state you want the repeat song status to be in.
  8835. */
  8836. function setRepeatSong(repeatState) {
  8837. if (!_config2.default.is_touch_moving) {
  8838. /*
  8839. Sets repeat to the opposite of what it was set to
  8840. */
  8841. _repeater2.default.setRepeatSong(!_config2.default.repeat_song);
  8842. /*
  8843. Visually sync repeat song
  8844. */
  8845. _repeatElements2.default.syncRepeatSong();
  8846. }
  8847. }
  8848. /**
  8849. * Gets the default album art for the player
  8850. *
  8851. * Public Accessor: Amplitude.getDefaultAlbumArt()
  8852. *
  8853. * @access public
  8854. */
  8855. function getDefaultAlbumArt() {
  8856. return _config2.default.default_album_art;
  8857. }
  8858. /**
  8859. * Gets the default playlist art for the playlists
  8860. *
  8861. * Public Accessor: Amplitude.getDefaultPlaylistArt()
  8862. *
  8863. * @access public
  8864. */
  8865. function getDefaultPlaylistArt() {
  8866. return _config2.default.default_playlist_art;
  8867. }
  8868. /**
  8869. * Sets the default album art for the player
  8870. *
  8871. * Public Accessor: Amplitude.setDefaultAlbumArt( url )
  8872. *
  8873. * @access public
  8874. * @param {string} url - A string representing the URL of the new default album art.
  8875. */
  8876. function setDefaultAlbumArt(url) {
  8877. _config2.default.default_album_art = url;
  8878. }
  8879. /**
  8880. * Sets the default playlist art for the player
  8881. *
  8882. * Public Accessor: Amplitude.setDefaultPlaylistArt( url )
  8883. *
  8884. * @access public
  8885. * @param {string} url - A string representing the URL of the new default playlist art.
  8886. */
  8887. function setDefaultPlaylistArt(url) {
  8888. _config2.default.default_plalist_art = url;
  8889. }
  8890. /**
  8891. * Allows the user to get the percentage of the song played.
  8892. *
  8893. * Public Accessor: Amplitude.getSongPlayedPercentage();
  8894. *
  8895. * @access public
  8896. */
  8897. function getSongPlayedPercentage() {
  8898. /*
  8899. Returns the percentage of the song played.
  8900. */
  8901. return _config2.default.audio.currentTime / _config2.default.audio.duration * 100;
  8902. }
  8903. /**
  8904. * Allows the user to get the amount of seconds the song has played.
  8905. *
  8906. * Public Accessor: Amplitude.getSongPlayed();
  8907. *
  8908. * @access public
  8909. */
  8910. function getSongPlayedSeconds() {
  8911. /*
  8912. Returns the amount of seconds the song has played.
  8913. */
  8914. return _config2.default.audio.currentTime;
  8915. }
  8916. /**
  8917. * Allows the user to get the duration of the current song
  8918. *
  8919. * Public Accessor: Amplitude.getSongPlayed();
  8920. *
  8921. * @access public
  8922. */
  8923. function getSongDuration() {
  8924. /*
  8925. Returns the duration of the current song
  8926. */
  8927. return _config2.default.audio.duration;
  8928. }
  8929. /**
  8930. * Allows the user to set how far into the song they want to be. This is
  8931. * helpful for implementing custom range sliders. Only works on the current song.
  8932. *
  8933. * Public Accessor: Amplitude.setSongPlayedPercentage( float );
  8934. *
  8935. * @access public
  8936. * @param {number} percentage - The percentage of the song played
  8937. */
  8938. function setSongPlayedPercentage(percentage) {
  8939. /*
  8940. Ensures the percentage is a number and is between 0 and 100.
  8941. */
  8942. if (typeof percentage == "number" && percentage > 0 && percentage < 100) {
  8943. /*
  8944. Sets the current time of the song to the percentage.
  8945. */
  8946. _config2.default.audio.currentTime = _config2.default.audio.duration * (percentage / 100);
  8947. }
  8948. }
  8949. /**
  8950. * Allows the user to turn on debugging.
  8951. *
  8952. * Public Accessor: Amplitude.setDebug( bool );
  8953. *
  8954. * @access public
  8955. * @param {boolean} state - Turns debugging on and off.
  8956. */
  8957. function setDebug(state) {
  8958. /*
  8959. Sets the global config debug on or off.
  8960. */
  8961. _config2.default.debug = state;
  8962. }
  8963. /**
  8964. * Returns the active song meta data for the user to do what is
  8965. * needed.
  8966. *
  8967. * Public Accessor: Amplitude.getActiveSongMetadata();
  8968. *
  8969. * @access public
  8970. * @returns {object} JSON Object with the active song information
  8971. */
  8972. function getActiveSongMetadata() {
  8973. return _config2.default.active_metadata;
  8974. }
  8975. /**
  8976. * Returns the active playlist meta data for the for the user to use.
  8977. *
  8978. * Public Accessor: Amplitude.getActivePlaylistMetadata();
  8979. *
  8980. * @access public
  8981. * @returns {object} JSON representation for the active playlist
  8982. */
  8983. function getActivePlaylistMetadata() {
  8984. return _config2.default.playlists[_config2.default.active_playlist];
  8985. }
  8986. /**
  8987. * Returns a song in the songs array at that index
  8988. *
  8989. * Public Accessor: Amplitude.getSongAtIndex( song_index )
  8990. *
  8991. * @access public
  8992. * @param {number} index - The integer for the index of the song in the songs array.
  8993. * @returns {object} JSON representation for the song at a specific index.
  8994. */
  8995. function getSongAtIndex(index) {
  8996. return _config2.default.songs[index];
  8997. }
  8998. /**
  8999. * Returns a song at a playlist index
  9000. *
  9001. * Public Accessor: Amplitude.getSongAtPlaylistIndex( playlist, index
  9002. *
  9003. * @access public
  9004. * @param {number} index - The integer for the index of the song in the playlist.
  9005. * @param {string} playlist - The key of the playlist we are getting the song at the index for
  9006. * @returns {object} JSON representation for the song at a specific index.
  9007. */
  9008. function getSongAtPlaylistIndex(playlist, index) {
  9009. var song = _config2.default.playlists[playlist].songs[index];
  9010. return song;
  9011. }
  9012. /**
  9013. * Adds a song to the end of the config array. This will allow Amplitude
  9014. * to play the song in a playlist type setting.
  9015. *
  9016. * Public Accessor: Amplitude.addSong( song_json )
  9017. *
  9018. * @access public
  9019. * @param {object} song - JSON representation of a song.
  9020. * @returns {number} New index of the song.
  9021. */
  9022. function addSong(song) {
  9023. /*
  9024. Ensures we have a songs array to push to.
  9025. */
  9026. if (_config2.default.songs == undefined) {
  9027. _config2.default.songs = [];
  9028. }
  9029. _config2.default.songs.push(song);
  9030. if (_config2.default.shuffle_on) {
  9031. _config2.default.shuffle_list.push(song);
  9032. }
  9033. if (_soundcloud2.default.isSoundCloudURL(song.url)) {
  9034. _soundcloud2.default.resolveIndividualStreamableURL(song.url, null, _config2.default.songs.length - 1, _config2.default.shuffle_on);
  9035. }
  9036. return _config2.default.songs.length - 1;
  9037. }
  9038. /**
  9039. * Adds a song to the beginning of the config array.
  9040. * This will allow Amplitude to play the song in a
  9041. * playlist type setting.
  9042. *
  9043. * Public Accessor: Amplitude.addSong( song_json )
  9044. *
  9045. * @access public
  9046. * @param {object} song - JSON representation of a song.
  9047. * @returns {number} New index of the song (0)
  9048. */
  9049. function prependSong(song) {
  9050. /*
  9051. Ensures we have a songs array to push to.
  9052. */
  9053. if (_config2.default.songs == undefined) {
  9054. _config2.default.songs = [];
  9055. }
  9056. _config2.default.songs.unshift(song);
  9057. if (_config2.default.shuffle_on) {
  9058. _config2.default.shuffle_list.unshift(song);
  9059. }
  9060. if (_soundcloud2.default.isSoundCloudURL(song.url)) {
  9061. _soundcloud2.default.resolveIndividualStreamableURL(song.url, null, _config2.default.songs.length - 1, _config2.default.shuffle_on);
  9062. }
  9063. return 0;
  9064. }
  9065. /**
  9066. * Adds a song to a playlist. This will allow Amplitude to play the song in the
  9067. * playlist
  9068. *
  9069. * Public Accessor: Amplitude.addSongToPlaylist( song_json, playlist_key )
  9070. *
  9071. * @access public
  9072. * @param {object} song - JSON representation of a song.
  9073. * @param {string} playlist - Playlist we are adding the song to.
  9074. * @returns {mixed} New index of song in playlist or null if no playlist exists
  9075. */
  9076. function addSongToPlaylist(song, playlist) {
  9077. if (_config2.default.playlists[playlist] != undefined) {
  9078. _config2.default.playlists[playlist].songs.push(song);
  9079. if (_config2.default.playlists[playlist].shuffle) {
  9080. _config2.default.playlists[playlist].shuffle_list.push(song);
  9081. }
  9082. if (_soundcloud2.default.isSoundCloudURL(song.url)) {
  9083. _soundcloud2.default.resolveIndividualStreamableURL(song.url, playlist, _config2.default.playlists[playlist].songs.length - 1, _config2.default.playlists[playlist].shuffle);
  9084. }
  9085. return _config2.default.playlists[playlist].songs.length - 1;
  9086. } else {
  9087. _debug2.default.writeMessage("Playlist doesn't exist!");
  9088. return null;
  9089. }
  9090. }
  9091. /**
  9092. * Adds a playlist to Amplitude.
  9093. *
  9094. * @param {string} key - The key of the playlist we are adding.
  9095. * @param {object} data - The data relating to the playlist
  9096. * @param {array} songs - The songs to add to the playlist
  9097. */
  9098. function addPlaylist(key, data, songs) {
  9099. /*
  9100. Ensures the playlist is not already defined.
  9101. */
  9102. if (_config2.default.playlists[key] == undefined) {
  9103. /*
  9104. Initialize the new playlist object.
  9105. */
  9106. _config2.default.playlists[key] = {};
  9107. /*
  9108. Define the ignored keys that we don't want to copy over.
  9109. */
  9110. var ignoredKeys = ["repeat", "shuffle", "shuffle_list", "songs", "src"];
  9111. /*
  9112. Iterate over all of the keys defined by the user and
  9113. set them on the playlist.
  9114. */
  9115. for (var dataKey in data) {
  9116. if (ignoredKeys.indexOf(dataKey) < 0) {
  9117. _config2.default.playlists[key][dataKey] = data[dataKey];
  9118. }
  9119. }
  9120. /*
  9121. Initialize the default parameters for the playlist and set the songs.
  9122. */
  9123. _config2.default.playlists[key].songs = songs;
  9124. _config2.default.playlists[key].active_index = null;
  9125. _config2.default.playlists[key].repeat = false;
  9126. _config2.default.playlists[key].shuffle = false;
  9127. _config2.default.playlists[key].shuffle_list = [];
  9128. return _config2.default.playlists[key];
  9129. } else {
  9130. _debug2.default.writeMessage("A playlist already exists with that key!");
  9131. return null;
  9132. }
  9133. }
  9134. /**
  9135. * Removes a song from the song array
  9136. *
  9137. * Public Accessor: Amplitude.removeSong( index )
  9138. *
  9139. * @access public
  9140. * @param {integer} index - Index of the song being removed
  9141. * @returns {boolean} True if removed false if not.
  9142. */
  9143. function removeSong(index) {
  9144. _config2.default.songs.splice(index, 1);
  9145. }
  9146. /**
  9147. * Removes a song from the playlist
  9148. *
  9149. * Public Accessor: Amplitude.removeSongFromPlaylist( index, playlist )
  9150. *
  9151. * @access public
  9152. * @param {integer} index - Index of the song being removed from the playlist.
  9153. * @param {string} playlist - Playlist we are removing the song from.
  9154. * @returns {boolean} True if removed false if not.
  9155. */
  9156. function removeSongFromPlaylist(index, playlist) {
  9157. if (_config2.default.playlists[playlist] != undefined) {
  9158. _config2.default.playlists[playlist].songs.splice(index, 1);
  9159. }
  9160. }
  9161. /**
  9162. * When you pass a song object it plays that song right awawy. It sets
  9163. * the active song in the config to the song you pass in and synchronizes
  9164. * the visuals.
  9165. *
  9166. * Public Accessor: Amplitude.playNow( song )
  9167. *
  9168. * @access public
  9169. * @param {object} song - JSON representation of a song.
  9170. */
  9171. function playNow(song) {
  9172. /*
  9173. Makes sure the song object has a URL associated with it
  9174. or there will be nothing to play.
  9175. */
  9176. if (song.url) {
  9177. _config2.default.audio.src = song.url;
  9178. _config2.default.active_metadata = song;
  9179. _config2.default.active_album = song.album;
  9180. } else {
  9181. /*
  9182. Write error message since the song passed in doesn't
  9183. have a URL.
  9184. */
  9185. _debug2.default.writeMessage("The song needs to have a URL!");
  9186. }
  9187. /*
  9188. Plays the song.
  9189. */
  9190. _core2.default.play();
  9191. /*
  9192. Sets the main song control status visual
  9193. */
  9194. _playPauseElements2.default.sync();
  9195. /*
  9196. Update the song meta data
  9197. */
  9198. _metaDataElements2.default.displayMetaData();
  9199. /*
  9200. Reset the song sliders, song progress bar info, and
  9201. reset times. This ensures everything stays in sync.
  9202. */
  9203. _songSliderElements2.default.resetElements();
  9204. /*
  9205. Reset the song played progress elements.
  9206. */
  9207. _songPlayedProgressElements2.default.resetElements();
  9208. /*
  9209. Reset all of the current time elements.
  9210. */
  9211. _timeElements2.default.resetCurrentTimes();
  9212. /*
  9213. Reset all of the duration time elements.
  9214. */
  9215. _timeElements2.default.resetDurationTimes();
  9216. }
  9217. /**
  9218. * Plays a song at the index passed in from the songs array.
  9219. *
  9220. * Public Accessor: Amplitude.playSongAtIndex( index )
  9221. *
  9222. * @access public
  9223. * @param {number} index - The number representing the song in the songs array.
  9224. */
  9225. function playSongAtIndex(index) {
  9226. /*
  9227. Stop the current song.
  9228. */
  9229. _core2.default.stop();
  9230. /*
  9231. Determine if there is a new playlist, if so set the active playlist and change the song.
  9232. */
  9233. if (_checks2.default.newPlaylist(null)) {
  9234. _audioNavigation2.default.setActivePlaylist(null);
  9235. _audioNavigation2.default.changeSong(_config2.default.songs[index], index);
  9236. }
  9237. /*
  9238. Check if the song is new. If so, change the song.
  9239. */
  9240. if (_checks2.default.newSong(null, index)) {
  9241. _audioNavigation2.default.changeSong(_config2.default.songs[index], index);
  9242. }
  9243. /*
  9244. Play the song
  9245. */
  9246. _core2.default.play();
  9247. /*
  9248. Sync all of the play pause buttons.
  9249. */
  9250. _playPauseElements2.default.sync();
  9251. }
  9252. /**
  9253. * Plays a song at the index passed in for the playlist provided. The index passed
  9254. * in should be the index of the song in the playlist and not the songs array.
  9255. *
  9256. * @access public
  9257. * @param {number} index - The number representing the song in the playlist array.
  9258. * @param {string} playlist - The key string representing the playlist we are playing the song from.
  9259. *
  9260. */
  9261. function playPlaylistSongAtIndex(index, playlist) {
  9262. _core2.default.stop();
  9263. /*
  9264. Determine if there is a new playlist, if so set the active playlist and change the song.
  9265. */
  9266. if (_checks2.default.newPlaylist(playlist)) {
  9267. _audioNavigation2.default.setActivePlaylist(playlist);
  9268. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[index], index);
  9269. }
  9270. /*
  9271. Check if the song is new. If so, change the song.
  9272. */
  9273. if (_checks2.default.newSong(playlist, index)) {
  9274. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[index], index);
  9275. }
  9276. /*
  9277. Sync all of the play pause buttons.
  9278. */
  9279. _playPauseElements2.default.sync();
  9280. /*
  9281. Play the song
  9282. */
  9283. _core2.default.play();
  9284. }
  9285. /**
  9286. * Allows the user to play whatever the active song is directly
  9287. * through Javascript. Normally ALL of Amplitude functions that access
  9288. * the core features are called through event handlers.
  9289. *
  9290. * Public Accessor: Amplitude.play();
  9291. *
  9292. * @access public
  9293. */
  9294. function play() {
  9295. _core2.default.play();
  9296. }
  9297. /**
  9298. * Allows the user to pause whatever the active song is directly
  9299. * through Javascript. Normally ALL of Amplitude functions that access
  9300. * the core features are called through event handlers.
  9301. *
  9302. * Public Accessor: Amplitude.pause();
  9303. *
  9304. * @access public
  9305. */
  9306. function pause() {
  9307. _core2.default.pause();
  9308. }
  9309. /**
  9310. * Allows the user to stop whatever the active song is directly
  9311. * through Javascript.
  9312. *
  9313. * Public Accessor: Amplitude.stop();
  9314. *
  9315. * @access public
  9316. */
  9317. function stop() {
  9318. _core2.default.stop();
  9319. }
  9320. /**
  9321. * Returns the audio object used to play the audio
  9322. *
  9323. * Public Accessor: Amplitude.getAudio();
  9324. *
  9325. * @access public
  9326. */
  9327. function getAudio() {
  9328. return _config2.default.audio;
  9329. }
  9330. /**
  9331. * Returns the Web Audio API ANalyser used for visualizations.
  9332. *
  9333. * Public Accessor: Amplitude.getAnalyser()
  9334. *
  9335. * @access public
  9336. */
  9337. function getAnalyser() {
  9338. return _config2.default.analyser;
  9339. }
  9340. /**
  9341. * Plays the next song either in the playlist or globally.
  9342. *
  9343. * Public Accessor: Amplitude.next( playlist );
  9344. *
  9345. * @access public
  9346. * @param {string} [playlist = null - The playlist key
  9347. */
  9348. function next() {
  9349. var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  9350. var nextData = {};
  9351. /*
  9352. If the playlist is empty or null, then we check the active
  9353. playlist
  9354. */
  9355. if (playlist == "" || playlist == null) {
  9356. /*
  9357. If the active playlist is null, then we set the next global
  9358. song or we set the next in the playlist.
  9359. */
  9360. if (_config2.default.active_playlist == null || _config2.default.active_playlist == "") {
  9361. _audioNavigation2.default.setNext();
  9362. } else {
  9363. _audioNavigation2.default.setNextPlaylist(_config2.default.active_playlist);
  9364. }
  9365. } else {
  9366. _audioNavigation2.default.setNextPlaylist(playlist);
  9367. }
  9368. }
  9369. /**
  9370. * Plays the prev song either in the playlist or globally.
  9371. *
  9372. * Public Accessor: Amplitude.prev( playlist );
  9373. *
  9374. * @access public
  9375. * @param {string} [playlist = null] - The playlist key
  9376. */
  9377. function prev() {
  9378. var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  9379. var prevData = {};
  9380. /*
  9381. If the playlist is empty or null, then we check the active
  9382. playlist
  9383. */
  9384. if (playlist == "" || playlist == null) {
  9385. /*
  9386. If the active playlist is null, then we set the prev global
  9387. song or we set the prev in the playlist.
  9388. */
  9389. if (_config2.default.active_playlist == null || _config2.default.active_playlist == "") {
  9390. _audioNavigation2.default.setPrevious();
  9391. } else {
  9392. _audioNavigation2.default.setPreviousPlaylist(_config2.default.active_playlist);
  9393. }
  9394. } else {
  9395. _audioNavigation2.default.setPreviousPlaylist(playlist);
  9396. }
  9397. }
  9398. /**
  9399. * Gets all of the songs in the songs array
  9400. *
  9401. * Public Accessor: Amplitude.getSongs( );
  9402. *
  9403. * @access public
  9404. */
  9405. function getSongs() {
  9406. return _config2.default.songs;
  9407. }
  9408. /**
  9409. * Gets all of the songs in a playlist
  9410. *
  9411. * Public Accessor: Amplitude.getSongsInPlaylist( playlist );
  9412. *
  9413. * @access public
  9414. * @param {string} playlist - The playlist key
  9415. */
  9416. function getSongsInPlaylist(playlist) {
  9417. return _config2.default.playlists[playlist].songs;
  9418. }
  9419. /**
  9420. * Get current state of songs. If shuffled, this will return the shuffled
  9421. * songs.
  9422. *
  9423. * Public Accessor: Amplitude.getSongsState();
  9424. *
  9425. * @access public
  9426. */
  9427. function getSongsState() {
  9428. if (_config2.default.shuffle_on) {
  9429. return _config2.default.shuffle_list;
  9430. } else {
  9431. return _config2.default.songs;
  9432. }
  9433. }
  9434. /**
  9435. * Get current state of songs in playlist. If shuffled, this will return the
  9436. * shuffled songs.
  9437. *
  9438. * Public Accessor: Amplitude.getSongsStatePlaylist( playlist );
  9439. *
  9440. * @access public
  9441. * @param {string} playlist - The playlist key
  9442. */
  9443. function getSongsStatePlaylist(playlist) {
  9444. if (_config2.default.playlists[playlist].shuffle) {
  9445. return _config2.default.playlists[playlist].shuffle_list;
  9446. } else {
  9447. return _config2.default.playlists[playlist].songs;
  9448. }
  9449. }
  9450. /**
  9451. * Gets the active index of the player
  9452. *
  9453. * Public Accessor: Amplitude.getActiveIndex()
  9454. *
  9455. * @access public
  9456. */
  9457. function getActiveIndex() {
  9458. return parseInt(_config2.default.active_index);
  9459. }
  9460. /**
  9461. * Get the version of AmplitudeJS
  9462. *
  9463. * Public Accessor: Amplitude.getVersion()
  9464. *
  9465. * @access public
  9466. */
  9467. function getVersion() {
  9468. return _config2.default.version;
  9469. }
  9470. /**
  9471. * Get the buffered amount for the current song
  9472. *
  9473. * Public Accessor: Amplitude.getBuffered()
  9474. *
  9475. * @access public
  9476. */
  9477. function getBuffered() {
  9478. return _config2.default.buffered;
  9479. }
  9480. /**
  9481. * Skip to a certain location in a selected song.
  9482. *
  9483. * Public Accessor: Amplitude.getBuffered()
  9484. *
  9485. * @access public
  9486. * @param {number} seconds - The amount of seconds we should skip to in the song.
  9487. * @param {number} songIndex - The index of the song in the songs array.
  9488. * @param {string} [playlist = null] - The playlist the song we are skipping to belogns to.
  9489. */
  9490. function skipTo(seconds, songIndex) {
  9491. var playlist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  9492. seconds = parseInt(seconds);
  9493. if (playlist != null) {
  9494. /*
  9495. Checks if we are skipping to a new playlist
  9496. */
  9497. if (_checks2.default.newPlaylist(playlist)) {
  9498. _audioNavigation2.default.setActivePlaylist(playlist);
  9499. }
  9500. /*
  9501. Changes the song to where it's being skipped and then
  9502. play the song.
  9503. */
  9504. _audioNavigation2.default.changeSongPlaylist(playlist, _config2.default.playlists[playlist].songs[songIndex], songIndex);
  9505. _core2.default.play();
  9506. /*
  9507. Sync all of the play pause elements.
  9508. */
  9509. _playPauseElements2.default.syncGlobal();
  9510. _playPauseElements2.default.syncPlaylist();
  9511. _playPauseElements2.default.syncSong();
  9512. /*
  9513. Skip to the location in the song.
  9514. */
  9515. _core2.default.skipToLocation(seconds);
  9516. } else {
  9517. /*
  9518. Changes the song to where it's being skipped and then
  9519. play the song.
  9520. */
  9521. _audioNavigation2.default.changeSong(_config2.default.songs[songIndex], songIndex);
  9522. _core2.default.play();
  9523. /*
  9524. Syncs all of the play pause buttons now that we've skipped.
  9525. */
  9526. _playPauseElements2.default.syncGlobal();
  9527. _playPauseElements2.default.syncSong();
  9528. /*
  9529. Skip to the location in the song.
  9530. */
  9531. _core2.default.skipToLocation(seconds);
  9532. }
  9533. }
  9534. /**
  9535. * Sets the meta data for a song in the songs array. This will set any
  9536. * meta data for a song besides the URL. The URL could cause issues if the
  9537. * song was playing.
  9538. *
  9539. * Public Accessor: Amplitude.setSongMetaData()
  9540. *
  9541. * @access public
  9542. * @param {number} index - The index of the song in the songs array.
  9543. * @param {object} metaData - The object containing the meta data we are updating.
  9544. * @param {string} playlist - The playlist we are updating the song meta data for.
  9545. */
  9546. function setSongMetaData(index, metaData) {
  9547. var playlist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  9548. /*
  9549. Update the meta data for a song in a playlist.
  9550. */
  9551. if (playlist != "" && playlist != null && _config2.default.playlists[playlist] != undefined) {
  9552. /*
  9553. Set all of the defined meta data properties
  9554. */
  9555. for (var key in metaData) {
  9556. if (metaData.hasOwnProperty(key)) {
  9557. if (key != "url" && key != "URL" && key != "live" && key != "LIVE") {
  9558. _config2.default.playlists[playlist].songs[index][key] = metaData[key];
  9559. }
  9560. }
  9561. }
  9562. } else {
  9563. /*
  9564. Update the meta data for a song.
  9565. */
  9566. for (var key in metaData) {
  9567. if (metaData.hasOwnProperty(key)) {
  9568. if (key != "url" && key != "URL" && key != "live" && key != "LIVE") {
  9569. _config2.default.songs[index][key] = metaData[key];
  9570. }
  9571. }
  9572. }
  9573. }
  9574. /*
  9575. Display the updates on the screen.
  9576. */
  9577. _metaDataElements2.default.displayMetaData();
  9578. _metaDataElements2.default.syncMetaData();
  9579. }
  9580. function setPlaylistMetaData(playlist, metaData) {
  9581. if (_config2.default.playlists[playlist] != undefined) {
  9582. /*
  9583. These are the ignored keys that we won't be worrying about displaying.
  9584. Every other key in the playlist object can be displayed.
  9585. */
  9586. var ignoredKeys = ["repeat", "shuffle", "shuffle_list", "songs", "src"];
  9587. for (var key in metaData) {
  9588. if (metaData.hasOwnProperty(key)) {
  9589. if (ignoredKeys.indexOf(key) < 0) {
  9590. _config2.default.playlists[playlist][key] = metaData[key];
  9591. }
  9592. }
  9593. }
  9594. _metaDataElements2.default.displayPlaylistMetaData();
  9595. } else {
  9596. _debug2.default.writeMessage("You must provide a valid playlist key!");
  9597. }
  9598. }
  9599. /**
  9600. * Sets the delay between the songs when they are finished.
  9601. *
  9602. * Public Accessor: Amplitude.setDelay()
  9603. *
  9604. * @access public
  9605. * @param {number} delay - The millisecond delay time between songs
  9606. */
  9607. function setDelay(time) {
  9608. _config2.default.delay = time;
  9609. }
  9610. /**
  9611. * Returns the current delay between songs.
  9612. *
  9613. * Public Accessor: Amplitude.getDelay()
  9614. *
  9615. * @access public
  9616. */
  9617. function getDelay() {
  9618. return _config2.default.delay;
  9619. }
  9620. /**
  9621. * Returns the state of the player.
  9622. *
  9623. * Public Accessor: Amplitude.getPlayerState();
  9624. */
  9625. function getPlayerState() {
  9626. return _config2.default.player_state;
  9627. }
  9628. /**
  9629. * Registers a visualization and sets that visualization's
  9630. * preferences. When creating a visualization, you can set certain
  9631. * preferences that the user can overwrite similar to Amplitude.
  9632. * Public Accessor: Amplitude.registerVisualization( visualization, preferences )
  9633. *
  9634. * @param {object} visualzation A visualization object that gets registered
  9635. * with Amplitude
  9636. *
  9637. * @param {object} preferences A JSON object of preferences relating to the
  9638. * visualization
  9639. */
  9640. function registerVisualization(visualization, preferences) {
  9641. _visualizations2.default.register(visualization, preferences);
  9642. }
  9643. /**
  9644. * Set the visualization for the playlist
  9645. *
  9646. * @param {string} playlist - The playlist we are setting the visualization for.
  9647. * @param {string} visualizationKey - The key of the visualization we are adding to the playlist.
  9648. */
  9649. function setPlaylistVisualization(playlist, visualizationKey) {
  9650. if (_config2.default.playlists[playlist] != undefined) {
  9651. if (_config2.default.visualizations.available[visualizationKey] != undefined) {
  9652. _config2.default.playlists[playlist].visualization = visualizationKey;
  9653. } else {
  9654. _debug2.default.writeMessage("A visualization does not exist for the key provided.");
  9655. }
  9656. } else {
  9657. _debug2.default.writeMessage("The playlist for the key provided does not exist");
  9658. }
  9659. }
  9660. /**
  9661. * Set a visualization for the song.
  9662. *
  9663. * @param {number} songIndex - The index of the song in the songs array we are setting the visualization for.
  9664. * @param {string} visualizationKey - The key of the visualization we are adding to the playlist.
  9665. */
  9666. function setSongVisualization(songIndex, visualizationKey) {
  9667. if (_config2.default.songs[songIndex]) {
  9668. if (_config2.default.visualizations.available[visualizationKey] != undefined) {
  9669. _config2.default.songs[songIndex].visualization = visualizationKey;
  9670. } else {
  9671. _debug2.default.writeMessage("A visualization does not exist for the key provided.");
  9672. }
  9673. } else {
  9674. _debug2.default.writeMessage("A song at that index is undefined");
  9675. }
  9676. }
  9677. /**
  9678. * Set song in playlist visualization.
  9679. *
  9680. * @param {string} playlist - The playlist we are setting the song visualization for.
  9681. * @param {number} songIndex - The index we are setting the visualization for.
  9682. * @param {strong} visualizationKey - The key of the visualization we are adding to the song in the playlist.
  9683. */
  9684. function setSongInPlaylistVisualization(playlist, songIndex, visualizationKey) {
  9685. if (_config2.default.playlists[playlist].songs[songIndex] != undefined) {
  9686. if (_config2.default.visualizations.available[visualizationKey] != undefined) {
  9687. _config2.default.playlists[playlist].songs[songIndex].visualization = visualizationKey;
  9688. } else {
  9689. _debug2.default.writeMessage("A visualization does not exist for the key provided.");
  9690. }
  9691. } else {
  9692. _debug2.default.writeMessage("The song in the playlist at that key is not defined");
  9693. }
  9694. }
  9695. /**
  9696. * Sets the global visualization default.
  9697. */
  9698. function setGlobalVisualization(visualizationKey) {
  9699. if (_config2.default.visualizations.available[visualizationKey] != undefined) {
  9700. _config2.default.visualization = visualizationKey;
  9701. } else {
  9702. _debug2.default.writeMessage("A visualization does not exist for the key provided.");
  9703. }
  9704. }
  9705. /**
  9706. * Sets the active volume.
  9707. * @param {number} volumeLevel - A number between 1 and 100 as a percentage of
  9708. * min to max for a volume level.
  9709. */
  9710. function setVolume(volumeLevel) {
  9711. _core2.default.setVolume(volumeLevel);
  9712. }
  9713. /**
  9714. * Gets the active volume.
  9715. */
  9716. function getVolume() {
  9717. return _config2.default.volume;
  9718. }
  9719. /*
  9720. Returns all of the publically accesible methods.
  9721. */
  9722. return {
  9723. init: init,
  9724. getConfig: getConfig,
  9725. bindNewElements: bindNewElements,
  9726. getActivePlaylist: getActivePlaylist,
  9727. getPlaybackSpeed: getPlaybackSpeed,
  9728. setPlaybackSpeed: setPlaybackSpeed,
  9729. getRepeat: getRepeat,
  9730. getRepeatPlaylist: getRepeatPlaylist,
  9731. getShuffle: getShuffle,
  9732. getShufflePlaylist: getShufflePlaylist,
  9733. setShuffle: setShuffle,
  9734. setShufflePlaylist: setShufflePlaylist,
  9735. setRepeat: setRepeat,
  9736. setRepeatSong: setRepeatSong,
  9737. setRepeatPlaylist: setRepeatPlaylist,
  9738. getDefaultAlbumArt: getDefaultAlbumArt,
  9739. setDefaultAlbumArt: setDefaultAlbumArt,
  9740. getDefaultPlaylistArt: getDefaultPlaylistArt,
  9741. setDefaultPlaylistArt: setDefaultPlaylistArt,
  9742. getSongPlayedPercentage: getSongPlayedPercentage,
  9743. setSongPlayedPercentage: setSongPlayedPercentage,
  9744. getSongPlayedSeconds: getSongPlayedSeconds,
  9745. getSongDuration: getSongDuration,
  9746. setDebug: setDebug,
  9747. getActiveSongMetadata: getActiveSongMetadata,
  9748. getActivePlaylistMetadata: getActivePlaylistMetadata,
  9749. getSongAtIndex: getSongAtIndex,
  9750. getSongAtPlaylistIndex: getSongAtPlaylistIndex,
  9751. addSong: addSong,
  9752. prependSong: prependSong,
  9753. addSongToPlaylist: addSongToPlaylist,
  9754. removeSong: removeSong,
  9755. removeSongFromPlaylist: removeSongFromPlaylist,
  9756. playNow: playNow,
  9757. playSongAtIndex: playSongAtIndex,
  9758. playPlaylistSongAtIndex: playPlaylistSongAtIndex,
  9759. play: play,
  9760. pause: pause,
  9761. stop: stop,
  9762. getAudio: getAudio,
  9763. getAnalyser: getAnalyser,
  9764. next: next,
  9765. prev: prev,
  9766. getSongs: getSongs,
  9767. getSongsInPlaylist: getSongsInPlaylist,
  9768. getSongsState: getSongsState,
  9769. getSongsStatePlaylist: getSongsStatePlaylist,
  9770. getActiveIndex: getActiveIndex,
  9771. getVersion: getVersion,
  9772. getBuffered: getBuffered,
  9773. skipTo: skipTo,
  9774. setSongMetaData: setSongMetaData,
  9775. setPlaylistMetaData: setPlaylistMetaData,
  9776. setDelay: setDelay,
  9777. getDelay: getDelay,
  9778. getPlayerState: getPlayerState,
  9779. addPlaylist: addPlaylist,
  9780. registerVisualization: registerVisualization,
  9781. setPlaylistVisualization: setPlaylistVisualization,
  9782. setSongVisualization: setSongVisualization,
  9783. setSongInPlaylistVisualization: setSongInPlaylistVisualization,
  9784. setGlobalVisualization: setGlobalVisualization,
  9785. getVolume: getVolume,
  9786. setVolume: setVolume
  9787. };
  9788. }();
  9789. /**
  9790. * Playback Speed Elements
  9791. * @module visual/PlaybackSpeedElements
  9792. */
  9793. /**
  9794. * Play Pause Elements
  9795. * @module visual/PlayPauseElements
  9796. */
  9797. /**
  9798. * Song Played Progress Elements
  9799. * @module visual/SongPlayedProgressElements
  9800. */
  9801. /**
  9802. * Visual Repeat Elements
  9803. * @module visual/RepeatElements
  9804. */
  9805. /****************************************************
  9806. * FX Modules
  9807. ****************************************************/
  9808. /**
  9809. * Imports the visualizations module
  9810. * @module fx/Visualizations
  9811. */
  9812. /**
  9813. * Repeater Module
  9814. *
  9815. * @module utilities/Repeater
  9816. */
  9817. /**
  9818. * Imports the config state module.
  9819. * @module ConfigState
  9820. */
  9821. /****************************************************
  9822. * Core
  9823. ****************************************************/
  9824. /**
  9825. * AmplitudeJS Core Module
  9826. *
  9827. * @module core/Core
  9828. */
  9829. /**
  9830. * @name AmplitudeJS
  9831. * @author Dan Pastori (Server Side Up) <hello@serversideup.net>
  9832. */
  9833. /**
  9834. * AmplitudeJS Initializer Module
  9835. *
  9836. * @module init/AmplitudeInitializer
  9837. */
  9838. exports.default = Amplitude;
  9839. module.exports = exports["default"];
  9840. /***/ }),
  9841. /* 48 */
  9842. /***/ (function(module, exports, __webpack_require__) {
  9843. "use strict";
  9844. Object.defineProperty(exports, "__esModule", {
  9845. value: true
  9846. });
  9847. var _config = __webpack_require__(0);
  9848. var _config2 = _interopRequireDefault(_config);
  9849. var _debug = __webpack_require__(4);
  9850. var _debug2 = _interopRequireDefault(_debug);
  9851. var _checks = __webpack_require__(5);
  9852. var _checks2 = _interopRequireDefault(_checks);
  9853. var _metaDataElements = __webpack_require__(7);
  9854. var _metaDataElements2 = _interopRequireDefault(_metaDataElements);
  9855. var _soundcloud = __webpack_require__(17);
  9856. var _soundcloud2 = _interopRequireDefault(_soundcloud);
  9857. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9858. /**
  9859. * Handles the initialization of the playlists.
  9860. *
  9861. * @module init/PlaylistsInitializer
  9862. */
  9863. /**
  9864. * AmplitudeJS Visual Meta Data Elements Module
  9865. * @module visual/MetaDataElements
  9866. */
  9867. /**
  9868. * AmplitudeJS Debug Module
  9869. * @module utilities/Debug
  9870. */
  9871. var PlaylistsInitializer = function () {
  9872. /**
  9873. * Initializes the playlists for AmplitudeJS
  9874. *
  9875. * @param {Object} playlists - The playlists defined by the user.
  9876. */
  9877. function initialize(playlists) {
  9878. /*
  9879. Copy the playlists over to Amplitude
  9880. */
  9881. _config2.default.playlists = playlists;
  9882. /*
  9883. Copy songs over from songs array.
  9884. */
  9885. copySongsToPlaylists();
  9886. /*
  9887. Grab any SoundCloud Data for the playlist songs if needed.
  9888. */
  9889. grabSoundCloudData();
  9890. /*
  9891. Initialize a scoped active index for each playlist.
  9892. */
  9893. initializePlaylistActiveIndexes();
  9894. /*
  9895. Initialize the shuffle status of the playlists.
  9896. */
  9897. initializePlaylistShuffleStatuses();
  9898. /*
  9899. Initialize the repeat status for the playlits.
  9900. */
  9901. initializePlaylistsRepeatStatuses();
  9902. /*
  9903. Initialize temporary place holders for shuffle lists.
  9904. */
  9905. initializePlaylistShuffleLists();
  9906. /*
  9907. Initializes the first song in the playlist
  9908. */
  9909. initializeFirstSongInPlaylistMetaData();
  9910. }
  9911. /**
  9912. * Initializes a scoped active index for each playlist.
  9913. *
  9914. * @access private
  9915. */
  9916. function initializePlaylistActiveIndexes() {
  9917. /*
  9918. Iterate over all of the playlists defined by the user
  9919. and add an active index.
  9920. */
  9921. for (var key in _config2.default.playlists) {
  9922. _config2.default.playlists[key].active_index = null;
  9923. }
  9924. }
  9925. /**
  9926. * Ensures the indexes in the playlists are valid indexes. The song has
  9927. * to exist in the Amplitude config to be played correctly. If the index
  9928. * is an integer, we ensure it exists and coy it to the array.
  9929. *
  9930. * @access private
  9931. */
  9932. function copySongsToPlaylists() {
  9933. /*
  9934. Iterate over all of the config's playlists
  9935. */
  9936. for (var key in _config2.default.playlists) {
  9937. /*
  9938. Checks if the playlist key is accurate.
  9939. */
  9940. if (_config2.default.playlists.hasOwnProperty(key)) {
  9941. /*
  9942. Checks if the playlist has songs.
  9943. */
  9944. if (_config2.default.playlists[key].songs) {
  9945. /*
  9946. Iterate over all of the songs in the playlist
  9947. */
  9948. for (var i = 0; i < _config2.default.playlists[key].songs.length; i++) {
  9949. if (_checks2.default.isInt(_config2.default.playlists[key].songs[i])) {
  9950. _config2.default.playlists[key].songs[i] = _config2.default.songs[_config2.default.playlists[key].songs[i]];
  9951. _config2.default.playlists[key].songs[i].index = i;
  9952. }
  9953. /*
  9954. Check to see if the index for the song in the playlist
  9955. exists in the songs config.
  9956. */
  9957. if (_checks2.default.isInt(_config2.default.playlists[key].songs[i]) && !_config2.default.songs[_config2.default.playlists[key].songs[i]]) {
  9958. _debug2.default.writeMessage("The song index: " + _config2.default.playlists[key].songs[i] + " in playlist with key: " + key + " is not defined in your songs array!");
  9959. }
  9960. /*
  9961. If not an int, then is a dedicated song, just set the index.
  9962. */
  9963. if (!_checks2.default.isInt(_config2.default.playlists[key].songs[i])) {
  9964. _config2.default.playlists[key].songs[i].index = i;
  9965. }
  9966. }
  9967. }
  9968. }
  9969. }
  9970. }
  9971. /**
  9972. * Grabs the SoundCloud data for any song in the playlist that
  9973. * the user needs to grab data for.
  9974. *
  9975. * @access private
  9976. */
  9977. function grabSoundCloudData() {
  9978. /*
  9979. Iterate over all of the config's playlists
  9980. */
  9981. for (var key in _config2.default.playlists) {
  9982. /*
  9983. Checks if the playlist key is accurate.
  9984. */
  9985. if (_config2.default.playlists.hasOwnProperty(key)) {
  9986. /*
  9987. Iterate over all of the songs in the playlist and see if
  9988. they need to grab the SoundCloud data for the song.
  9989. */
  9990. for (var i = 0; i < _config2.default.playlists[key].songs.length; i++) {
  9991. /*
  9992. Only Grab the data if the URL is a SoundCloud URL.
  9993. */
  9994. if (_soundcloud2.default.isSoundCloudURL(_config2.default.playlists[key].songs[i].url)) {
  9995. /*
  9996. Only grab the data if the SoundCloud data has not already been
  9997. grabbed for the audio. This could happen if the user defined the
  9998. song in the songs array and was grabbed before.
  9999. */
  10000. if (_config2.default.playlists[key].songs[i].soundcloud_data == undefined) {
  10001. _soundcloud2.default.resolveIndividualStreamableURL(_config2.default.playlists[key].songs[i].url, key, i);
  10002. }
  10003. }
  10004. }
  10005. }
  10006. }
  10007. }
  10008. /**
  10009. * Initializes the shuffle statuses for each of the playlists. These will
  10010. * be referenced when we shuffle individual playlists.
  10011. *
  10012. * @access private
  10013. */
  10014. function initializePlaylistShuffleStatuses() {
  10015. /*
  10016. Iterate over all of the playlists the user defined adding
  10017. the playlist key to the shuffled playlist array and creating
  10018. and empty object to house the statuses.
  10019. */
  10020. for (var key in _config2.default.playlists) {
  10021. _config2.default.playlists[key].shuffle = false;
  10022. }
  10023. }
  10024. /**
  10025. * Initializes the repeat statuses for each of the playlists. These will
  10026. * be referenced when we repeat individual playlits.
  10027. *
  10028. * @access private
  10029. */
  10030. function initializePlaylistsRepeatStatuses() {
  10031. /*
  10032. Iterate over all of the playlists the user defined adding
  10033. the playlist key to the repeated playlist array and creating
  10034. and empty object to house the statuses.
  10035. */
  10036. for (var key in _config2.default.playlists) {
  10037. _config2.default.playlists[key].repeat = false;
  10038. }
  10039. }
  10040. /**
  10041. * Initializes the shuffled playlist placeholders. These will be set for
  10042. * playlists that are shuffled and contain the shuffled songs.
  10043. *
  10044. * @access private
  10045. */
  10046. function initializePlaylistShuffleLists() {
  10047. /*
  10048. Iterate over all of the playlists the user defined adding
  10049. the playlist key to the shuffled playlists array and creating
  10050. and empty object to house the shuffled playlists
  10051. */
  10052. for (var key in _config2.default.playlists) {
  10053. _config2.default.playlists[key].shuffle_list = [];
  10054. }
  10055. }
  10056. /**
  10057. * Intializes the display for the first song in the playlist meta data.
  10058. *
  10059. * @access private
  10060. */
  10061. function initializeFirstSongInPlaylistMetaData() {
  10062. /*
  10063. Iterates over all of the playlists setting the meta data for the
  10064. first song.
  10065. */
  10066. for (var key in _config2.default.playlists) {
  10067. _metaDataElements2.default.setFirstSongInPlaylist(_config2.default.playlists[key].songs[0], key);
  10068. }
  10069. }
  10070. /*
  10071. Returns the public facing methods
  10072. */
  10073. return {
  10074. initialize: initialize
  10075. };
  10076. }();
  10077. /**
  10078. * AmplitudeJS SoundCloud Meta module
  10079. * @module soundcloud/Soundcloud
  10080. */
  10081. /**
  10082. * AmplitudeJS Checks Utility.
  10083. * @module utilities/Checks
  10084. */
  10085. /**
  10086. * Imports the config module
  10087. * @module config
  10088. */
  10089. exports.default = PlaylistsInitializer;
  10090. module.exports = exports["default"];
  10091. /***/ }),
  10092. /* 49 */
  10093. /***/ (function(module, exports, __webpack_require__) {
  10094. "use strict";
  10095. Object.defineProperty(exports, "__esModule", {
  10096. value: true
  10097. });
  10098. var _config = __webpack_require__(0);
  10099. var _config2 = _interopRequireDefault(_config);
  10100. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10101. /**
  10102. * Handles all of the container elements.
  10103. *
  10104. * @param visual/ContainerElements
  10105. */
  10106. var ContainerElements = function () {
  10107. /**
  10108. * Applies the class 'amplitude-active-song-container' to the element
  10109. * containing visual information regarding the active song.
  10110. *
  10111. * @prop {boolean} direct - Determines if it was a direct click on the song. We
  10112. * then don't care if shuffle is on or not.
  10113. *
  10114. * @access public
  10115. */
  10116. function setActive(direct) {
  10117. /*
  10118. Gets all of the song container elements.
  10119. */
  10120. var songContainers = document.getElementsByClassName("amplitude-song-container");
  10121. /*
  10122. Removes all of the active song containrs.
  10123. */
  10124. for (var i = 0; i < songContainers.length; i++) {
  10125. songContainers[i].classList.remove("amplitude-active-song-container");
  10126. }
  10127. /*
  10128. Finds the active index and adds the active song container to the element
  10129. that represents the song at the index.
  10130. */
  10131. if (_config2.default.active_playlist == "" || _config2.default.active_playlist == null) {
  10132. var activeIndex = "";
  10133. /*
  10134. If we click directly on the song element, we ignore
  10135. whether it's in shuffle or not.
  10136. */
  10137. if (direct) {
  10138. activeIndex = _config2.default.active_index;
  10139. } else {
  10140. if (_config2.default.shuffle_on) {
  10141. activeIndex = _config2.default.shuffle_list[_config2.default.active_index].index;
  10142. } else {
  10143. activeIndex = _config2.default.active_index;
  10144. }
  10145. }
  10146. if (document.querySelectorAll('.amplitude-song-container[data-amplitude-song-index="' + activeIndex + '"]')) {
  10147. var _songContainers = document.querySelectorAll('.amplitude-song-container[data-amplitude-song-index="' + activeIndex + '"]');
  10148. for (var _i = 0; _i < _songContainers.length; _i++) {
  10149. if (!_songContainers[_i].hasAttribute("data-amplitude-playlist")) {
  10150. _songContainers[_i].classList.add("amplitude-active-song-container");
  10151. }
  10152. }
  10153. }
  10154. } else {
  10155. /*
  10156. If we have an active playlist or the action took place directly on the
  10157. song element, we ignore the shuffle.
  10158. */
  10159. if (_config2.default.active_playlist != null && _config2.default.active_playlist != "" || direct) {
  10160. var activePlaylistIndex = _config2.default.playlists[_config2.default.active_playlist].active_index;
  10161. } else {
  10162. var activePlaylistIndex = "";
  10163. if (_config2.default.playlists[_config2.default.active_playlist].shuffle) {
  10164. activePlaylistIndex = _config2.default.playlists[_config2.default.active_playlist].shuffle_list[_config2.default.playlists[_config2.default.active_playlist].active_index].index;
  10165. } else {
  10166. activePlaylistIndex = _config2.default.playlists[_config2.default.active_playlist].active_index;
  10167. }
  10168. }
  10169. if (document.querySelectorAll('.amplitude-song-container[data-amplitude-song-index="' + activePlaylistIndex + '"][data-amplitude-playlist="' + _config2.default.active_playlist + '"]')) {
  10170. var _songContainers2 = document.querySelectorAll('.amplitude-song-container[data-amplitude-song-index="' + activePlaylistIndex + '"][data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10171. for (var _i2 = 0; _i2 < _songContainers2.length; _i2++) {
  10172. _songContainers2[_i2].classList.add("amplitude-active-song-container");
  10173. }
  10174. }
  10175. }
  10176. }
  10177. return {
  10178. setActive: setActive
  10179. };
  10180. }(); /**
  10181. * Imports the config module
  10182. * @module config
  10183. */
  10184. exports.default = ContainerElements;
  10185. module.exports = exports["default"];
  10186. /***/ }),
  10187. /* 50 */
  10188. /***/ (function(module, exports, __webpack_require__) {
  10189. "use strict";
  10190. Object.defineProperty(exports, "__esModule", {
  10191. value: true
  10192. });
  10193. var _config = __webpack_require__(0);
  10194. var _config2 = _interopRequireDefault(_config);
  10195. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10196. /**
  10197. * Handles all of the current time hour elements.
  10198. *
  10199. * @module visual/time/CurrentHourElements
  10200. */
  10201. var CurrentHourElements = function () {
  10202. function sync(hours) {
  10203. syncGlobal(hours);
  10204. syncPlaylist(hours);
  10205. syncSong(hours);
  10206. syncSongInPlaylist(hours);
  10207. }
  10208. /**
  10209. * Updates any elements that display the current hour for the song.
  10210. *
  10211. * @access public
  10212. * @param {number} hours - An integer conaining how many hours into the song.
  10213. */
  10214. function syncGlobal(hours) {
  10215. /*
  10216. Get all of the hour selectors
  10217. */
  10218. var currentHourSelectors = document.querySelectorAll(".amplitude-current-hours");
  10219. /*
  10220. Set the current hour selector's inner html to hours passed in.
  10221. */
  10222. for (var i = 0; i < currentHourSelectors.length; i++) {
  10223. var playlist = currentHourSelectors[i].getAttribute("data-amplitude-playlist");
  10224. var songIndex = currentHourSelectors[i].getAttribute("data-amplitude-song-index");
  10225. /*
  10226. Updates the current hour selector for a global display.
  10227. */
  10228. if (playlist == null && songIndex == null) {
  10229. currentHourSelectors[i].innerHTML = hours;
  10230. }
  10231. }
  10232. }
  10233. /**
  10234. * Syncs the playlist current hour elements.
  10235. *
  10236. * @param {Integer} hour - The current audio hour.
  10237. */
  10238. function syncPlaylist(hours) {
  10239. /*
  10240. Get all of the hour selectors
  10241. */
  10242. var currentHourPlaylistSelectors = document.querySelectorAll('.amplitude-current-hours[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10243. /*
  10244. Set the current hour selector's inner html to hours passed in.
  10245. */
  10246. for (var i = 0; i < currentHourPlaylistSelectors.length; i++) {
  10247. var songIndex = currentHourPlaylistSelectors[i].getAttribute("data-amplitude-song-index");
  10248. /*
  10249. Updates the current hour selector for a global display.
  10250. */
  10251. if (songIndex == null) {
  10252. currentHourPlaylistSelectors[i].innerHTML = hours;
  10253. }
  10254. }
  10255. }
  10256. /**
  10257. * Syncs the song hour elements.
  10258. *
  10259. * @param {Integer} hour - The current audio hour.
  10260. */
  10261. function syncSong(hours) {
  10262. if (_config2.default.active_playlist == null) {
  10263. /*
  10264. Get all of the hour selectors
  10265. */
  10266. var currentHourSongSelectors = document.querySelectorAll('.amplitude-current-hours[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10267. /*
  10268. Set the current hour selector's inner html to hours passed in.
  10269. */
  10270. for (var i = 0; i < currentHourSongSelectors.length; i++) {
  10271. var playlist = currentHourSongSelectors[i].getAttribute("data-amplitude-playlist");
  10272. /*
  10273. Updates the current hour selector for a global display.
  10274. */
  10275. if (playlist == null) {
  10276. currentHourSongSelectors[i].innerHTML = hours;
  10277. }
  10278. }
  10279. }
  10280. }
  10281. /**
  10282. * Syncs the song in playlist song hour elements.
  10283. *
  10284. * @param {Integer} hour - The current audio hour.
  10285. */
  10286. function syncSongInPlaylist(hours) {
  10287. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  10288. /*
  10289. Get all of the hour selectors
  10290. */
  10291. var currentHourPlaylistSongSelectors = document.querySelectorAll('.amplitude-current-hours[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  10292. /*
  10293. Set the current hour selector's inner html to hours passed in.
  10294. */
  10295. for (var i = 0; i < currentHourPlaylistSongSelectors.length; i++) {
  10296. currentHourPlaylistSongSelectors[i].innerHTML = hours;
  10297. }
  10298. }
  10299. /**
  10300. * Reset the current hour elements.
  10301. */
  10302. function resetTimes() {
  10303. /*
  10304. Gets the hour display elements
  10305. */
  10306. var hourSelectors = document.querySelectorAll(".amplitude-current-hours");
  10307. /*
  10308. Iterates over all of the hour selectors and sets the inner HTML
  10309. to 00.
  10310. */
  10311. for (var i = 0; i < hourSelectors.length; i++) {
  10312. hourSelectors[i].innerHTML = "00";
  10313. }
  10314. }
  10315. /**
  10316. * Returns the publically facing methods.
  10317. */
  10318. return {
  10319. sync: sync,
  10320. resetTimes: resetTimes
  10321. };
  10322. }(); /**
  10323. * Imports the config module
  10324. * @module config
  10325. */
  10326. exports.default = CurrentHourElements;
  10327. module.exports = exports["default"];
  10328. /***/ }),
  10329. /* 51 */
  10330. /***/ (function(module, exports, __webpack_require__) {
  10331. "use strict";
  10332. Object.defineProperty(exports, "__esModule", {
  10333. value: true
  10334. });
  10335. var _config = __webpack_require__(0);
  10336. var _config2 = _interopRequireDefault(_config);
  10337. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10338. /**
  10339. * Handles all of the current time minutes elements.
  10340. *
  10341. * @module visual/time/CurrentMinuteElements
  10342. */
  10343. var CurrentMinuteElements = function () {
  10344. /**
  10345. * Syncs the current minutes elements.
  10346. *
  10347. * @param {Integer} minutes - The current audio minutes.
  10348. */
  10349. function sync(minutes) {
  10350. syncGlobal(minutes);
  10351. syncPlaylist(minutes);
  10352. syncSong(minutes);
  10353. syncSongInPlaylist(minutes);
  10354. }
  10355. /**
  10356. * Syncs the global current minutes elements.
  10357. *
  10358. * @param {Integer} minutes - The current audio minutes.
  10359. */
  10360. function syncGlobal(minutes) {
  10361. /*
  10362. Get all of the minute selectors
  10363. */
  10364. var currentMinuteSelectors = document.querySelectorAll(".amplitude-current-minutes");
  10365. /*
  10366. Set the current minute selector's inner html to minutes passed in.
  10367. */
  10368. for (var i = 0; i < currentMinuteSelectors.length; i++) {
  10369. var playlist = currentMinuteSelectors[i].getAttribute("data-amplitude-playlist");
  10370. var songIndex = currentMinuteSelectors[i].getAttribute("data-amplitude-song-index");
  10371. /*
  10372. Updates the current minute selector for a global display.
  10373. */
  10374. if (playlist == null && songIndex == null) {
  10375. currentMinuteSelectors[i].innerHTML = minutes;
  10376. }
  10377. }
  10378. }
  10379. /**
  10380. * Syncs the playlist minutes elements.
  10381. *
  10382. * @param {Integer} minutes - The current audio minutes.
  10383. */
  10384. function syncPlaylist(minutes) {
  10385. /*
  10386. Get all of the minute selectors
  10387. */
  10388. var currentMinutePlaylistSelectors = document.querySelectorAll('.amplitude-current-minutes[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10389. /*
  10390. Set the current minute selector's inner html to minutes passed in.
  10391. */
  10392. for (var i = 0; i < currentMinutePlaylistSelectors.length; i++) {
  10393. var songIndex = currentMinutePlaylistSelectors[i].getAttribute("data-amplitude-song-index");
  10394. /*
  10395. Updates the current minute selector for a global display.
  10396. */
  10397. if (songIndex == null) {
  10398. currentMinutePlaylistSelectors[i].innerHTML = minutes;
  10399. }
  10400. }
  10401. }
  10402. /**
  10403. * Syncs the current song minutes elements.
  10404. *
  10405. * @param {Integer} minutes - The current audio minutes.
  10406. */
  10407. function syncSong(minutes) {
  10408. if (_config2.default.active_playlist == null) {
  10409. /*
  10410. Get all of the minute selectors
  10411. */
  10412. var currentMinuteSongSelectors = document.querySelectorAll('.amplitude-current-minutes[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10413. /*
  10414. Set the current minute selector's inner html to minutes passed in.
  10415. */
  10416. for (var i = 0; i < currentMinuteSongSelectors.length; i++) {
  10417. var playlist = currentMinuteSongSelectors[i].getAttribute("data-amplitude-playlist");
  10418. /*
  10419. Updates the current minute selector for a global display.
  10420. */
  10421. if (playlist == null) {
  10422. currentMinuteSongSelectors[i].innerHTML = minutes;
  10423. }
  10424. }
  10425. }
  10426. }
  10427. /**
  10428. * Syncs the current song in playlist minutes elements.
  10429. *
  10430. * @param {Integer} minutes - The current audio minutes.
  10431. */
  10432. function syncSongInPlaylist(minutes) {
  10433. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  10434. /*
  10435. Get all of the minute selectors
  10436. */
  10437. var currentMinutePlaylistSongSelectors = document.querySelectorAll('.amplitude-current-minutes[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  10438. /*
  10439. Set the current minute selector's inner html to minutes passed in.
  10440. */
  10441. for (var i = 0; i < currentMinutePlaylistSongSelectors.length; i++) {
  10442. currentMinutePlaylistSongSelectors[i].innerHTML = minutes;
  10443. }
  10444. }
  10445. /**
  10446. * Reset the current times.
  10447. */
  10448. function resetTimes() {
  10449. /*
  10450. Gets the minute display elements
  10451. */
  10452. var minuteSelectors = document.querySelectorAll(".amplitude-current-minutes");
  10453. /*
  10454. Iterates over all of the minute selectors and sets the inner HTML
  10455. to 00.
  10456. */
  10457. for (var i = 0; i < minuteSelectors.length; i++) {
  10458. minuteSelectors[i].innerHTML = "00";
  10459. }
  10460. }
  10461. /**
  10462. * Returns the publically facing methods.
  10463. */
  10464. return {
  10465. sync: sync,
  10466. resetTimes: resetTimes
  10467. };
  10468. }(); /**
  10469. * Imports the config module
  10470. * @module config
  10471. */
  10472. exports.default = CurrentMinuteElements;
  10473. module.exports = exports["default"];
  10474. /***/ }),
  10475. /* 52 */
  10476. /***/ (function(module, exports, __webpack_require__) {
  10477. "use strict";
  10478. Object.defineProperty(exports, "__esModule", {
  10479. value: true
  10480. });
  10481. var _config = __webpack_require__(0);
  10482. var _config2 = _interopRequireDefault(_config);
  10483. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10484. /**
  10485. * Handles all of the current time seconds elements.
  10486. *
  10487. * @module visual/time/CurrentSecondElements
  10488. */
  10489. var CurrentSecondElements = function () {
  10490. /**
  10491. * Syncs the current seconds elements.
  10492. *
  10493. * @param {Integer} seconds - The current audio seconds.
  10494. */
  10495. function sync(seconds) {
  10496. syncGlobal(seconds);
  10497. syncPlaylist(seconds);
  10498. syncSong(seconds);
  10499. syncSongInPlaylist(seconds);
  10500. }
  10501. /**
  10502. * Syncs the global current seconds elements.
  10503. *
  10504. * @param {Integer} seconds - The current audio seconds.
  10505. */
  10506. function syncGlobal(seconds) {
  10507. /*
  10508. Get all of the second selectors
  10509. */
  10510. var currentSecondSelectors = document.querySelectorAll(".amplitude-current-seconds");
  10511. /*
  10512. Set the current second selector's inner html to seconds passed in.
  10513. */
  10514. for (var i = 0; i < currentSecondSelectors.length; i++) {
  10515. var playlist = currentSecondSelectors[i].getAttribute("data-amplitude-playlist");
  10516. var songIndex = currentSecondSelectors[i].getAttribute("data-amplitude-song-index");
  10517. /*
  10518. Updates the current second selector for a global display.
  10519. */
  10520. if (playlist == null && songIndex == null) {
  10521. currentSecondSelectors[i].innerHTML = seconds;
  10522. }
  10523. }
  10524. }
  10525. /**
  10526. * Syncs the playlist seconds elements.
  10527. *
  10528. * @param {Integer} seconds - The current audio seconds.
  10529. */
  10530. function syncPlaylist(seconds) {
  10531. /*
  10532. Get all of the second selectors
  10533. */
  10534. var currentSecondPlaylistSelectors = document.querySelectorAll('.amplitude-current-seconds[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10535. /*
  10536. Set the current second selector's inner html to seconds passed in.
  10537. */
  10538. for (var i = 0; i < currentSecondPlaylistSelectors.length; i++) {
  10539. var songIndex = currentSecondPlaylistSelectors[i].getAttribute("data-amplitude-song-index");
  10540. /*
  10541. Updates the current second selector for a global display.
  10542. */
  10543. if (songIndex == null) {
  10544. currentSecondPlaylistSelectors[i].innerHTML = seconds;
  10545. }
  10546. }
  10547. }
  10548. /**
  10549. * Syncs the current song seconds elements.
  10550. *
  10551. * @param {Integer} seconds - The current audio seconds.
  10552. */
  10553. function syncSong(seconds) {
  10554. if (_config2.default.active_playlist == null) {
  10555. /*
  10556. Get all of the second selectors
  10557. */
  10558. var currentSecondSongSelectors = document.querySelectorAll('.amplitude-current-seconds[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10559. /*
  10560. Set the current second selector's inner html to seconds passed in.
  10561. */
  10562. for (var i = 0; i < currentSecondSongSelectors.length; i++) {
  10563. var playlist = currentSecondSongSelectors[i].getAttribute("data-amplitude-playlist");
  10564. /*
  10565. Updates the current second selector for a global display.
  10566. */
  10567. if (playlist == null) {
  10568. currentSecondSongSelectors[i].innerHTML = seconds;
  10569. }
  10570. }
  10571. }
  10572. }
  10573. /**
  10574. * Syncs the current song in playlist seconds elements.
  10575. *
  10576. * @param {Integer} seconds - The current audio seconds.
  10577. */
  10578. function syncSongInPlaylist(seconds) {
  10579. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  10580. /*
  10581. Get all of the second selectors
  10582. */
  10583. var currentSecondPlaylistSongSelectors = document.querySelectorAll('.amplitude-current-seconds[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  10584. /*
  10585. Set the current second selector's inner html to seconds passed in.
  10586. */
  10587. for (var i = 0; i < currentSecondPlaylistSongSelectors.length; i++) {
  10588. currentSecondPlaylistSongSelectors[i].innerHTML = seconds;
  10589. }
  10590. }
  10591. /**
  10592. * Reset the current seconds elements.
  10593. */
  10594. function resetTimes() {
  10595. /*
  10596. Gets the second display elements
  10597. */
  10598. var secondSelectors = document.querySelectorAll(".amplitude-current-seconds");
  10599. /*
  10600. Iterates over all of the second selectors and sets the inner HTML
  10601. to 00.
  10602. */
  10603. for (var i = 0; i < secondSelectors.length; i++) {
  10604. secondSelectors[i].innerHTML = "00";
  10605. }
  10606. }
  10607. /**
  10608. * Returns the publically facing methods.
  10609. */
  10610. return {
  10611. sync: sync,
  10612. resetTimes: resetTimes
  10613. };
  10614. }(); /**
  10615. * Imports the config module
  10616. * @module config
  10617. */
  10618. exports.default = CurrentSecondElements;
  10619. module.exports = exports["default"];
  10620. /***/ }),
  10621. /* 53 */
  10622. /***/ (function(module, exports, __webpack_require__) {
  10623. "use strict";
  10624. Object.defineProperty(exports, "__esModule", {
  10625. value: true
  10626. });
  10627. var _config = __webpack_require__(0);
  10628. var _config2 = _interopRequireDefault(_config);
  10629. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10630. /**
  10631. * These methods help sync visual time elements.
  10632. *
  10633. * @module visual/CurrentTimeElements
  10634. */
  10635. var CurrentTimeElements = function () {
  10636. /**
  10637. * Visually displays the current time on the screen. This is called on
  10638. * time update for the current song.
  10639. *
  10640. * @access public
  10641. * @param {object} currentTime - An object containing the current time for the song in seconds, minutes, and hours.
  10642. */
  10643. function sync(currentTime) {
  10644. /*
  10645. Set current time display.
  10646. */
  10647. syncGlobal(currentTime);
  10648. syncPlaylist(currentTime);
  10649. syncSong(currentTime);
  10650. syncSongInPlaylist(currentTime);
  10651. }
  10652. /**
  10653. * Updates any elements that display the current time for the song. This
  10654. * is a computed field that will be commonly used.
  10655. *
  10656. * @access public
  10657. * @param {object} time - A json object conaining the parts for the current time for the song.
  10658. */
  10659. function syncGlobal(time) {
  10660. /*
  10661. Get all of the time selectors.
  10662. */
  10663. var currentTimeSelectors = document.querySelectorAll(".amplitude-current-time");
  10664. /*
  10665. Set the time selector's inner html to the current time for the song. The current
  10666. time is computed by joining minutes and seconds.
  10667. */
  10668. var timeText = time.minutes + ":" + time.seconds;
  10669. if (time.hours > 0) {
  10670. timeText = time.hours + ":" + timeText;
  10671. }
  10672. for (var i = 0; i < currentTimeSelectors.length; i++) {
  10673. var playlist = currentTimeSelectors[i].getAttribute("data-amplitude-playlist");
  10674. var songIndex = currentTimeSelectors[i].getAttribute("data-amplitude-song-index");
  10675. if (playlist == null && songIndex == null) {
  10676. currentTimeSelectors[i].innerHTML = timeText;
  10677. }
  10678. }
  10679. }
  10680. /**
  10681. * Updates any elements that display the current time for the song. This
  10682. * is a computed field that will be commonly used.
  10683. *
  10684. * @access public
  10685. * @param {object} time - A json object conaining the parts for the current time for the song.
  10686. */
  10687. function syncPlaylist(time) {
  10688. /*
  10689. Get all of the time selectors.
  10690. */
  10691. var currentTimeSelectors = document.querySelectorAll('.amplitude-current-time[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10692. /*
  10693. Set the time selector's inner html to the current time for the song. The current
  10694. time is computed by joining minutes and seconds.
  10695. */
  10696. var timeText = time.minutes + ":" + time.seconds;
  10697. if (time.hours > 0) {
  10698. timeText = time.hours + ":" + timeText;
  10699. }
  10700. for (var i = 0; i < currentTimeSelectors.length; i++) {
  10701. var songIndex = currentTimeSelectors[i].getAttribute("data-amplitude-song-index");
  10702. if (songIndex == null) {
  10703. currentTimeSelectors[i].innerHTML = timeText;
  10704. }
  10705. }
  10706. }
  10707. /**
  10708. * Updates any elements that display the current time for the song. This
  10709. * is a computed field that will be commonly used.
  10710. *
  10711. * @access public
  10712. * @param {object} time - A json object conaining the parts for the current time for the song.
  10713. */
  10714. function syncSong(time) {
  10715. if (_config2.default.active_playlist == null) {
  10716. /*
  10717. Get all of the time selectors.
  10718. */
  10719. var currentTimeSelectors = document.querySelectorAll('.amplitude-current-time[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10720. /*
  10721. Set the time selector's inner html to the current time for the song. The current
  10722. time is computed by joining minutes and seconds.
  10723. */
  10724. var timeText = time.minutes + ":" + time.seconds;
  10725. if (time.hours > 0) {
  10726. timeText = time.hours + ":" + timeText;
  10727. }
  10728. for (var i = 0; i < currentTimeSelectors.length; i++) {
  10729. var playlist = currentTimeSelectors[i].getAttribute("data-amplitude-playlist");
  10730. if (playlist == null) {
  10731. currentTimeSelectors[i].innerHTML = timeText;
  10732. }
  10733. }
  10734. }
  10735. }
  10736. /**
  10737. * Updates any elements that display the current time for the song. This
  10738. * is a computed field that will be commonly used.
  10739. *
  10740. * @access public
  10741. * @param {object} time - A json object conaining the parts for the current time for the song.
  10742. */
  10743. function syncSongInPlaylist(time) {
  10744. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  10745. /*
  10746. Get all of the time selectors.
  10747. */
  10748. var currentTimeSelectors = document.querySelectorAll('.amplitude-current-time[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  10749. /*
  10750. Set the time selector's inner html to the current time for the song. The current
  10751. time is computed by joining minutes and seconds.
  10752. */
  10753. var timeText = time.minutes + ":" + time.seconds;
  10754. if (time.hours > 0) {
  10755. timeText = time.hours + ":" + timeText;
  10756. }
  10757. for (var i = 0; i < currentTimeSelectors.length; i++) {
  10758. currentTimeSelectors[i].innerHTML = timeText;
  10759. }
  10760. }
  10761. /**
  10762. * Resets the current time displays to 00:00
  10763. *
  10764. * @access public
  10765. */
  10766. function resetTimes() {
  10767. /*
  10768. Gets the time selector display elements
  10769. */
  10770. var timeSelectors = document.querySelectorAll(".amplitude-current-time");
  10771. /*
  10772. Iterates over all of the time selectors and sets the inner HTML
  10773. to 00.
  10774. */
  10775. for (var i = 0; i < timeSelectors.length; i++) {
  10776. timeSelectors[i].innerHTML = "00:00";
  10777. }
  10778. }
  10779. /**
  10780. * Returns the publically facing methods
  10781. */
  10782. return {
  10783. sync: sync,
  10784. resetTimes: resetTimes
  10785. };
  10786. }(); /**
  10787. * Imports the config module
  10788. * @module config
  10789. */
  10790. exports.default = CurrentTimeElements;
  10791. module.exports = exports["default"];
  10792. /***/ }),
  10793. /* 54 */
  10794. /***/ (function(module, exports, __webpack_require__) {
  10795. "use strict";
  10796. Object.defineProperty(exports, "__esModule", {
  10797. value: true
  10798. });
  10799. var _config = __webpack_require__(0);
  10800. var _config2 = _interopRequireDefault(_config);
  10801. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10802. /**
  10803. * Handles all of the duration countdown elements.
  10804. *
  10805. * @module visual/time/DurationCountDownTimeElements.
  10806. */
  10807. var DurationCountDownTimeElements = function () {
  10808. /**
  10809. * Syncs all of the countdown time elements.
  10810. *
  10811. * @param {object} countDownTime - The current time of the audio.
  10812. * @param {object} songDuration - The song duration of the audio.
  10813. */
  10814. function sync(countDownTime, songDuration) {
  10815. var timeRemaining = computeTimeRemaining(countDownTime, songDuration);
  10816. syncGlobal(timeRemaining);
  10817. syncPlaylist(timeRemaining);
  10818. syncSong(timeRemaining);
  10819. syncSongInPlaylist(timeRemaining);
  10820. }
  10821. /**
  10822. * Syncs the global count down time elements.
  10823. *
  10824. * @param {string} timeRemaining - The time remaining for the audio.
  10825. */
  10826. function syncGlobal(timeRemaining) {
  10827. var durationTimeRemainingSelectors = document.querySelectorAll(".amplitude-time-remaining");
  10828. for (var i = 0; i < durationTimeRemainingSelectors.length; i++) {
  10829. var playlist = durationTimeRemainingSelectors[i].getAttribute("data-amplitude-playlist");
  10830. var songIndex = durationTimeRemainingSelectors[i].getAttribute("data-amplitude-song-index");
  10831. if (playlist == null && songIndex == null) {
  10832. durationTimeRemainingSelectors[i].innerHTML = timeRemaining;
  10833. }
  10834. }
  10835. }
  10836. /**
  10837. * Syncs the playlist count down time elements.
  10838. *
  10839. * @param {string} timeRemaining - The time remaining for the audio.
  10840. */
  10841. function syncPlaylist(timeRemaining) {
  10842. var durationTimeRemainingSelectors = document.querySelectorAll('.amplitude-time-remaining[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10843. for (var i = 0; i < durationTimeRemainingSelectors.length; i++) {
  10844. var songIndex = durationTimeRemainingSelectors[i].getAttribute("data-amplitude-song-index");
  10845. if (songIndex == null) {
  10846. durationTimeRemainingSelectors[i].innerHTML = timeRemaining;
  10847. }
  10848. }
  10849. }
  10850. /**
  10851. * Syncs the song count down time elements.
  10852. *
  10853. * @param {string} timeRemaining - The time remaining for the audio.
  10854. */
  10855. function syncSong(timeRemaining) {
  10856. if (_config2.default.active_playlist == null) {
  10857. var durationTimeRemainingSelectors = document.querySelectorAll('.amplitude-time-remaining[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10858. for (var i = 0; i < durationTimeRemainingSelectors.length; i++) {
  10859. var playlist = durationTimeRemainingSelectors[i].getAttribute("data-amplitude-playlist");
  10860. if (playlist == null) {
  10861. durationTimeRemainingSelectors[i].innerHTML = timeRemaining;
  10862. }
  10863. }
  10864. }
  10865. }
  10866. /**
  10867. * Syncs the song in playlist count down time elements.
  10868. *
  10869. * @param {string} timeRemaining - The time remaining for the audio.
  10870. */
  10871. function syncSongInPlaylist(timeRemaining) {
  10872. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  10873. var durationTimeRemainingSelectors = document.querySelectorAll('.amplitude-time-remaining[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  10874. for (var i = 0; i < durationTimeRemainingSelectors.length; i++) {
  10875. durationTimeRemainingSelectors[i].innerHTML = timeRemaining;
  10876. }
  10877. }
  10878. /**
  10879. * Resets the count down times.
  10880. */
  10881. function resetTimes() {
  10882. var durationTimeRemainingSelectors = document.querySelectorAll(".amplitude-time-remaining");
  10883. for (var i = 0; i < durationTimeRemainingSelectors.length; i++) {
  10884. durationTimeRemainingSelectors[i].innerHTML = "00";
  10885. }
  10886. }
  10887. /**
  10888. * Computes the time remaining for the audio.
  10889. *
  10890. * @param {object} currentTime - The current time of the audio.
  10891. * @param {object} songDuration - The duration of the audio.
  10892. */
  10893. function computeTimeRemaining(currentTime, songDuration) {
  10894. var timeRemaining = "00:00";
  10895. /*
  10896. Initialize the total current seconds and total duration seconds
  10897. */
  10898. var totalCurrentSeconds = parseInt(currentTime.seconds) + parseInt(currentTime.minutes) * 60 + parseInt(currentTime.hours) * 60 * 60;
  10899. var totalDurationSeconds = parseInt(songDuration.seconds) + parseInt(songDuration.minutes) * 60 + parseInt(songDuration.hours) * 60 * 60;
  10900. /*
  10901. If the two variables are numbers we continue the computing.
  10902. */
  10903. if (!isNaN(totalCurrentSeconds) && !isNaN(totalDurationSeconds)) {
  10904. /*
  10905. Find the total remaining seconds.
  10906. */
  10907. var timeRemainingTotalSeconds = totalDurationSeconds - totalCurrentSeconds;
  10908. var remainingHours = Math.floor(timeRemainingTotalSeconds / 3600);
  10909. var remainingMinutes = Math.floor((timeRemainingTotalSeconds - remainingHours * 3600) / 60);
  10910. var remainingSeconds = timeRemainingTotalSeconds - remainingHours * 3600 - remainingMinutes * 60;
  10911. timeRemaining = (remainingMinutes < 10 ? "0" + remainingMinutes : remainingMinutes) + ":" + (remainingSeconds < 10 ? "0" + remainingSeconds : remainingSeconds);
  10912. if (remainingHours > 0) {
  10913. timeRemaining = remainingHours + ":" + timeRemaining;
  10914. }
  10915. }
  10916. return timeRemaining;
  10917. }
  10918. /**
  10919. * Returns the publically facing methods.
  10920. */
  10921. return {
  10922. sync: sync,
  10923. resetTimes: resetTimes
  10924. };
  10925. }(); /**
  10926. * Imports the config module
  10927. * @module config
  10928. */
  10929. exports.default = DurationCountDownTimeElements;
  10930. module.exports = exports["default"];
  10931. /***/ }),
  10932. /* 55 */
  10933. /***/ (function(module, exports, __webpack_require__) {
  10934. "use strict";
  10935. Object.defineProperty(exports, "__esModule", {
  10936. value: true
  10937. });
  10938. var _config = __webpack_require__(0);
  10939. var _config2 = _interopRequireDefault(_config);
  10940. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10941. /**
  10942. * Handles all of the duration hours elements.
  10943. *
  10944. * @module visual/time/DurationHourElements.
  10945. */
  10946. var DurationHourElements = function () {
  10947. /**
  10948. * Sync the duration hours elements.
  10949. *
  10950. * @param {Integer} hours - The duration hours for the audio.
  10951. */
  10952. function sync(hours) {
  10953. syncGlobal(hours);
  10954. syncPlaylist(hours);
  10955. syncSong(hours);
  10956. syncSongInPlaylist(hours);
  10957. }
  10958. /**
  10959. * Syncs the global duration hours elements.
  10960. *
  10961. * @param {Integer} hours - the duration hours for the audio.
  10962. */
  10963. function syncGlobal(hours) {
  10964. var durationHourSelectors = document.querySelectorAll(".amplitude-duration-hours");
  10965. for (var i = 0; i < durationHourSelectors.length; i++) {
  10966. var playlist = durationHourSelectors[i].getAttribute("data-amplitude-playlist");
  10967. var songIndex = durationHourSelectors[i].getAttribute("data-amplitude-song-index");
  10968. if (playlist == null && songIndex == null) {
  10969. durationHourSelectors[i].innerHTML = hours;
  10970. }
  10971. }
  10972. }
  10973. /**
  10974. * Syncs the playlist duration hours for the audio.
  10975. *
  10976. * @param {Integer} hours - The duration hours for the audio.
  10977. */
  10978. function syncPlaylist(hours) {
  10979. var durationHourSelectors = document.querySelectorAll('.amplitude-duration-hours[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  10980. for (var i = 0; i < durationHourSelectors.length; i++) {
  10981. var songIndex = durationHourSelectors[i].getAttribute("data-amplitude-song-index");
  10982. if (songIndex == null) {
  10983. durationHourSelectors[i].innerHTML = hours;
  10984. }
  10985. }
  10986. }
  10987. /**
  10988. * Syncs the song duration hours.
  10989. *
  10990. * @param {Integer} hours - The duration hours for the audio.
  10991. */
  10992. function syncSong(hours) {
  10993. if (_config2.default.active_playlist == null) {
  10994. var durationHourSelectors = document.querySelectorAll('.amplitude-duration-hours[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  10995. for (var i = 0; i < durationHourSelectors.length; i++) {
  10996. var playlist = durationHourSelectors[i].getAttribute("data-amplitude-playlist");
  10997. if (playlist == null) {
  10998. durationHourSelectors[i].innerHTML = hours;
  10999. }
  11000. }
  11001. }
  11002. }
  11003. /**
  11004. * Syncs the song in playlist duration hours.
  11005. *
  11006. * @param {Integer} hours - The duration hours of the audio.
  11007. */
  11008. function syncSongInPlaylist(hours) {
  11009. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  11010. var durationHourSelectors = document.querySelectorAll('.amplitude-duration-hours[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  11011. for (var i = 0; i < durationHourSelectors.length; i++) {
  11012. durationHourSelectors[i].innerHTML = hours;
  11013. }
  11014. }
  11015. /**
  11016. * Resets the duration shours elements to '00'
  11017. */
  11018. function resetTimes() {
  11019. var durationHourSelectors = document.querySelectorAll(".amplitude-duration-hours");
  11020. for (var i = 0; i < durationHourSelectors.length; i++) {
  11021. durationHourSelectors[i].innerHTML = "00";
  11022. }
  11023. }
  11024. /**
  11025. * Returns the publically facing methods.
  11026. */
  11027. return {
  11028. sync: sync,
  11029. resetTimes: resetTimes
  11030. };
  11031. }(); /**
  11032. * Imports the config module
  11033. * @module config
  11034. */
  11035. exports.default = DurationHourElements;
  11036. module.exports = exports["default"];
  11037. /***/ }),
  11038. /* 56 */
  11039. /***/ (function(module, exports, __webpack_require__) {
  11040. "use strict";
  11041. Object.defineProperty(exports, "__esModule", {
  11042. value: true
  11043. });
  11044. var _config = __webpack_require__(0);
  11045. var _config2 = _interopRequireDefault(_config);
  11046. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11047. /**
  11048. * Handles all of the duration minutes elements.
  11049. *
  11050. * @module visual/time/DurationMinuteElements.
  11051. */
  11052. var DurationMinuteElements = function () {
  11053. /**
  11054. * Sync the duration minutes elements.
  11055. *
  11056. * @param {Integer} minutes - The duration minutes for the audio.
  11057. */
  11058. function sync(minutes) {
  11059. syncGlobal(minutes);
  11060. syncPlaylist(minutes);
  11061. syncSong(minutes);
  11062. syncSongInPlaylist(minutes);
  11063. }
  11064. /**
  11065. * Syncs the global duration minutes elements.
  11066. *
  11067. * @param {Integer} minutes - the duration minutes for the audio.
  11068. */
  11069. function syncGlobal(minutes) {
  11070. var durationMinuteSelectors = document.querySelectorAll(".amplitude-duration-minutes");
  11071. for (var i = 0; i < durationMinuteSelectors.length; i++) {
  11072. var playlist = durationMinuteSelectors[i].getAttribute("data-amplitude-playlist");
  11073. var songIndex = durationMinuteSelectors[i].getAttribute("data-amplitude-song-index");
  11074. if (playlist == null && songIndex == null) {
  11075. durationMinuteSelectors[i].innerHTML = minutes;
  11076. }
  11077. }
  11078. }
  11079. /**
  11080. * Syncs the playlist duration minutes for the audio.
  11081. *
  11082. * @param {Integer} minutes - The duration minutes for the audio.
  11083. */
  11084. function syncPlaylist(minutes) {
  11085. var durationMinuteSelectors = document.querySelectorAll('.amplitude-duration-minutes[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  11086. for (var i = 0; i < durationMinuteSelectors.length; i++) {
  11087. var songIndex = durationMinuteSelectors[i].getAttribute("data-amplitude-song-index");
  11088. if (songIndex == null) {
  11089. durationMinuteSelectors[i].innerHTML = minutes;
  11090. }
  11091. }
  11092. }
  11093. /**
  11094. * Syncs the song duration minutes.
  11095. *
  11096. * @param {Integer} minutes - The duration minutes for the audio.
  11097. */
  11098. function syncSong(minutes) {
  11099. if (_config2.default.active_playlist == null) {
  11100. var durationMinuteSelectors = document.querySelectorAll('.amplitude-duration-minutes[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  11101. for (var i = 0; i < durationMinuteSelectors.length; i++) {
  11102. var playlist = durationMinuteSelectors[i].getAttribute("data-amplitude-playlist");
  11103. if (playlist == null) {
  11104. durationMinuteSelectors[i].innerHTML = minutes;
  11105. }
  11106. }
  11107. }
  11108. }
  11109. /**
  11110. * Syncs the song in playlist duration minutes.
  11111. *
  11112. * @param {Integer} minutes - The duration minutes of the audio.
  11113. */
  11114. function syncSongInPlaylist(minutes) {
  11115. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  11116. var durationMinuteSelectors = document.querySelectorAll('.amplitude-duration-minutes[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  11117. for (var i = 0; i < durationMinuteSelectors.length; i++) {
  11118. durationMinuteSelectors[i].innerHTML = minutes;
  11119. }
  11120. }
  11121. /**
  11122. * Resets the duration minutes elements to '00'
  11123. */
  11124. function resetTimes() {
  11125. var durationMinuteSelectors = document.querySelectorAll(".amplitude-duration-minutes");
  11126. for (var i = 0; i < durationMinuteSelectors.length; i++) {
  11127. durationMinuteSelectors[i].innerHTML = "00";
  11128. }
  11129. }
  11130. /**
  11131. * Returns the publically facing methods.
  11132. */
  11133. return {
  11134. sync: sync,
  11135. resetTimes: resetTimes
  11136. };
  11137. }(); /**
  11138. * Imports the config module
  11139. * @module config
  11140. */
  11141. exports.default = DurationMinuteElements;
  11142. module.exports = exports["default"];
  11143. /***/ }),
  11144. /* 57 */
  11145. /***/ (function(module, exports, __webpack_require__) {
  11146. "use strict";
  11147. Object.defineProperty(exports, "__esModule", {
  11148. value: true
  11149. });
  11150. var _config = __webpack_require__(0);
  11151. var _config2 = _interopRequireDefault(_config);
  11152. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11153. /**
  11154. * Handles all of the duration seconds elements.
  11155. *
  11156. * @module visual/time/DurationSecondElements.
  11157. */
  11158. var DurationSecondElements = function () {
  11159. /**
  11160. * Sync the duration seconds elements.
  11161. *
  11162. * @param {Integer} seconds - The duration seconds for the audio.
  11163. */
  11164. function sync(seconds) {
  11165. syncGlobal(seconds);
  11166. syncPlaylist(seconds);
  11167. syncSong(seconds);
  11168. syncSongInPlaylist(seconds);
  11169. }
  11170. /**
  11171. * Syncs the global duration seconds elements.
  11172. *
  11173. * @param {Integer} seconds - the duration seconds for the audio.
  11174. */
  11175. function syncGlobal(seconds) {
  11176. var durationSecondSelectors = document.querySelectorAll(".amplitude-duration-seconds");
  11177. for (var i = 0; i < durationSecondSelectors.length; i++) {
  11178. var playlist = durationSecondSelectors[i].getAttribute("data-amplitude-playlist");
  11179. var songIndex = durationSecondSelectors[i].getAttribute("data-amplitude-song-index");
  11180. if (playlist == null && songIndex == null) {
  11181. durationSecondSelectors[i].innerHTML = seconds;
  11182. }
  11183. }
  11184. }
  11185. /**
  11186. * Syncs the playlist duration seconds for the audio.
  11187. *
  11188. * @param {Integer} seconds - The duration seconds for the audio.
  11189. */
  11190. function syncPlaylist(seconds) {
  11191. var durationSecondSelectors = document.querySelectorAll('.amplitude-duration-seconds[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  11192. for (var i = 0; i < durationSecondSelectors.length; i++) {
  11193. var songIndex = durationSecondSelectors[i].getAttribute("data-amplitude-song-index");
  11194. if (songIndex == null) {
  11195. durationSecondSelectors[i].innerHTML = seconds;
  11196. }
  11197. }
  11198. }
  11199. /**
  11200. * Syncs the song duration seconds.
  11201. *
  11202. * @param {Integer} seconds - The duration seconds for the audio.
  11203. */
  11204. function syncSong(seconds) {
  11205. if (_config2.default.active_playlist == null) {
  11206. var durationSecondSelectors = document.querySelectorAll('.amplitude-duration-seconds[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  11207. for (var i = 0; i < durationSecondSelectors.length; i++) {
  11208. var playlist = durationSecondSelectors[i].getAttribute("data--amplitude-playlist");
  11209. if (playlist == null) {
  11210. durationSecondSelectors[i].innerHTML = seconds;
  11211. }
  11212. }
  11213. }
  11214. }
  11215. /**
  11216. * Syncs the song in playlist duration seconds.
  11217. *
  11218. * @param {Integer} seconds - The duration seconds of the audio.
  11219. */
  11220. function syncSongInPlaylist(seconds) {
  11221. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  11222. var durationSecondSelectors = document.querySelectorAll('.amplitude-duration-seconds[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  11223. for (var i = 0; i < durationSecondSelectors.length; i++) {
  11224. durationSecondSelectors[i].innerHTML = seconds;
  11225. }
  11226. }
  11227. /**
  11228. * Resets the duration seconds elements to '00'
  11229. */
  11230. function resetTimes() {
  11231. var durationSecondSelectors = document.querySelectorAll(".amplitude-duration-seconds");
  11232. for (var i = 0; i < durationSecondSelectors.length; i++) {
  11233. durationSecondSelectors[i].innerHTML = "00";
  11234. }
  11235. }
  11236. /**
  11237. * Returns the publically facing methods.
  11238. */
  11239. return {
  11240. sync: sync,
  11241. resetTimes: resetTimes
  11242. };
  11243. }(); /**
  11244. * Imports the config module
  11245. * @module config
  11246. */
  11247. exports.default = DurationSecondElements;
  11248. module.exports = exports["default"];
  11249. /***/ }),
  11250. /* 58 */
  11251. /***/ (function(module, exports, __webpack_require__) {
  11252. "use strict";
  11253. Object.defineProperty(exports, "__esModule", {
  11254. value: true
  11255. });
  11256. var _config = __webpack_require__(0);
  11257. var _config2 = _interopRequireDefault(_config);
  11258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11259. /**
  11260. * Handles all of the duration time elements.
  11261. *
  11262. * @module visual/time/DurationTimeElements.
  11263. */
  11264. var DurationTimeElements = function () {
  11265. /**
  11266. * Syncs the duration time for all elements.
  11267. *
  11268. * @param {Object} durationTime - The object containing all of the song duration times.
  11269. */
  11270. function sync(durationTime) {
  11271. var durationText = computeDurationText(durationTime);
  11272. syncGlobal(durationText);
  11273. syncPlaylist(durationText);
  11274. syncSong(durationText);
  11275. syncSongInPlaylist(durationText);
  11276. }
  11277. /**
  11278. * Sync the global song duration elements.
  11279. *
  11280. * @param {Object} durationText - The text for the song duration.
  11281. */
  11282. function syncGlobal(durationText) {
  11283. var durationTimeSelectors = document.querySelectorAll(".amplitude-duration-time");
  11284. for (var i = 0; i < durationTimeSelectors.length; i++) {
  11285. var playlist = durationTimeSelectors[i].getAttribute("data-amplitude-playlist");
  11286. var songIndex = durationTimeSelectors[i].getAttribute("data-amplitude-song-index");
  11287. if (playlist == null && songIndex == null) {
  11288. durationTimeSelectors[i].innerHTML = durationText;
  11289. }
  11290. }
  11291. }
  11292. /**
  11293. * Sync the playlist duration times.
  11294. *
  11295. * @param {Object} durationText - The text for the song duration.
  11296. */
  11297. function syncPlaylist(durationText) {
  11298. var durationTimeSelectors = document.querySelectorAll('.amplitude-duration-time[data-amplitude-playlist="' + _config2.default.active_playlist + '"]');
  11299. for (var i = 0; i < durationTimeSelectors.length; i++) {
  11300. var songIndex = durationTimeSelectors[i].getAttribute("data-amplitude-song-index");
  11301. if (songIndex == null) {
  11302. durationTimeSelectors[i].innerHTML = durationText;
  11303. }
  11304. }
  11305. }
  11306. /**
  11307. * Sync the song duration times.
  11308. *
  11309. * @param {Object} durationText - The text for the song duration.
  11310. */
  11311. function syncSong(durationText) {
  11312. if (_config2.default.active_playlist == null) {
  11313. var durationTimeSelectors = document.querySelectorAll('.amplitude-duration-time[data-amplitude-song-index="' + _config2.default.active_index + '"]');
  11314. for (var i = 0; i < durationTimeSelectors.length; i++) {
  11315. var playlist = durationTimeSelectors[i].getAttribute("data-amplitude-playlist");
  11316. if (playlist == null) {
  11317. durationTimeSelectors[i].innerHTML = durationText;
  11318. }
  11319. }
  11320. }
  11321. }
  11322. /**
  11323. * Sync the song in playlist duration times.
  11324. *
  11325. * @param {Object} durationText - An object containing the duration text.
  11326. */
  11327. function syncSongInPlaylist(durationText) {
  11328. var activePlaylistIndex = _config2.default.active_playlist != "" && _config2.default.active_playlist != null ? _config2.default.playlists[_config2.default.active_playlist].active_index : null;
  11329. var durationTimeSelectors = document.querySelectorAll('.amplitude-duration-time[data-amplitude-playlist="' + _config2.default.active_playlist + '"][data-amplitude-song-index="' + activePlaylistIndex + '"]');
  11330. for (var i = 0; i < durationTimeSelectors.length; i++) {
  11331. durationTimeSelectors[i].innerHTML = durationText;
  11332. }
  11333. }
  11334. /**
  11335. * Resets all of the duration times to empty.
  11336. */
  11337. function resetTimes() {
  11338. var durationTimeSelectors = document.querySelectorAll(".amplitude-duration-time");
  11339. for (var i = 0; i < durationTimeSelectors.length; i++) {
  11340. durationTimeSelectors[i].innerHTML = "00:00";
  11341. }
  11342. }
  11343. /**
  11344. * Computes the duration text
  11345. *
  11346. * @param {Object} durationTime - An object containint the duration times.
  11347. */
  11348. function computeDurationText(durationTime) {
  11349. var durationText = "00:00";
  11350. if (!isNaN(durationTime.minutes) && !isNaN(durationTime.seconds)) {
  11351. durationText = durationTime.minutes + ":" + durationTime.seconds;
  11352. if (!isNaN(durationTime.hours) && durationTime.hours > 0) {
  11353. durationText = durationTime.hours + ":" + durationText;
  11354. }
  11355. }
  11356. return durationText;
  11357. }
  11358. /**
  11359. * Return publically accessible methods.
  11360. */
  11361. return {
  11362. sync: sync,
  11363. resetTimes: resetTimes
  11364. };
  11365. }(); /**
  11366. * Imports the config module
  11367. * @module config
  11368. */
  11369. exports.default = DurationTimeElements;
  11370. module.exports = exports["default"];
  11371. /***/ }),
  11372. /* 59 */
  11373. /***/ (function(module, exports) {
  11374. module.exports = {"name":"amplitudejs","version":"5.3.2","description":"A JavaScript library that allows you to control the design of your media controls in your webpage -- not the browser. No dependencies (jQuery not required) https://521dimensions.com/open-source/amplitudejs","main":"dist/amplitude.js","devDependencies":{"babel-core":"^6.26.3","babel-loader":"^7.1.5","babel-plugin-add-module-exports":"0.2.1","babel-polyfill":"^6.26.0","babel-preset-es2015":"^6.18.0","husky":"^1.3.1","jest":"^23.6.0","prettier":"1.15.1","pretty-quick":"^1.11.1","watch":"^1.0.2","webpack":"^2.7.0"},"directories":{"doc":"docs"},"files":["dist"],"funding":{"type":"opencollective","url":"https://opencollective.com/amplitudejs"},"scripts":{"build":"node_modules/.bin/webpack","prettier":"npx pretty-quick","preversion":"npx pretty-quick && npm run test","postversion":"git push && git push --tags","test":"jest","version":"npm run build && git add -A dist"},"repository":{"type":"git","url":"git+https://github.com/521dimensions/amplitudejs.git"},"keywords":["webaudio","html5","javascript","audio-player"],"author":"521 Dimensions (https://521dimensions.com)","license":"MIT","bugs":{"url":"https://github.com/521dimensions/amplitudejs/issues"},"homepage":"https://github.com/521dimensions/amplitudejs#readme"}
  11375. /***/ })
  11376. /******/ ]);
  11377. });
  11378. //# sourceMappingURL=amplitude.js.map
  11379. Amplitude.init({
  11380. "volume": 100,
  11381. "songs": [
  11382. {
  11383. "name": "Scenes from Childhood, Op. 15 No. 1",
  11384. "artist": "Robert Schumann",
  11385. "album": "",
  11386. "url": "/audio/piano/schumman.mp3",
  11387. "cover_art_url": "/img/schumann.png"
  11388. },
  11389. {
  11390. "name": "Mazurka in A minor, Op. 17 No. 4",
  11391. "artist": "Frédéric Chopin",
  11392. "album": "",
  11393. "url": "/audio/piano/mazurka_am.mp3",
  11394. "cover_art_url": "/img/chopin.png"
  11395. },
  11396. {
  11397. "name": "Doctor Gradus as Parnuassum",
  11398. "artist": "Claude Debussy",
  11399. "album": "Children's Corner Suite, L 113",
  11400. "url": "/audio/piano/dr_gradus.m4a",
  11401. "cover_art_url": "/img/gradus.jpg"
  11402. },
  11403. {
  11404. "name": "Sonatina in C Major, Op. 55 No. 1",
  11405. "artist": "Friedrich Kuhlau",
  11406. "album": "",
  11407. "url": "/audio/piano/Kuhlau.mp3",
  11408. "cover_art_url": "/img/kuhlau.png"
  11409. },
  11410. {
  11411. "name": "China",
  11412. "artist": "2010",
  11413. "album": "Icon",
  11414. "url": "/audio/icon/01_China.mp3",
  11415. "cover_art_url": "/img/icons.jpg"
  11416. },
  11417. {
  11418. "name": "Experiment in C Minor",
  11419. "artist": "2010",
  11420. "album": "Icon",
  11421. "url": "/audio/icon/02_Experiment_in_Cm.mp3",
  11422. "cover_art_url": "/img/icons.jpg"
  11423. },
  11424. {
  11425. "name": "E Minor Diversion",
  11426. "artist": "2010",
  11427. "album": "Icon",
  11428. "url": "/audio/icon/03_EmDiversion.mp3",
  11429. "cover_art_url": "/img/icons.jpg"
  11430. },
  11431. {
  11432. "name": "Poem",
  11433. "artist": "2010",
  11434. "album": "Icon",
  11435. "url": "/audio/icon/06_Poem.mp3",
  11436. "cover_art_url": "/img/icons.jpg"
  11437. },
  11438. {
  11439. "name": "The Other Room",
  11440. "artist": "2010",
  11441. "album": "Icon",
  11442. "url": "/audio/icon/07_The_Other_Room.mp3",
  11443. "cover_art_url": "/img/icons.jpg"
  11444. },
  11445. {
  11446. "name": "Smokin",
  11447. "artist": "2010",
  11448. "album": "Icon",
  11449. "url": "/audio/icon/08_smokin.mp3",
  11450. "cover_art_url": "/img/icons.jpg"
  11451. },
  11452. {
  11453. "name": "Poem #2",
  11454. "artist": "2010",
  11455. "album": "Icon",
  11456. "url": "/audio/icon/09_poem3.mp3",
  11457. "cover_art_url": "/img/icons.jpg"
  11458. },
  11459. {
  11460. "name": "Poem #4",
  11461. "artist": "2010",
  11462. "album": "Icon",
  11463. "url": "/audio/icon/06_poem4.mp3",
  11464. "cover_art_url": "/img/icons.jpg"
  11465. },
  11466. {
  11467. "name": "Prelude in G Minor",
  11468. "artist": "2010",
  11469. "album": "Icon",
  11470. "url": "/audio/icon/11_Prelude_in_Gm.mp3",
  11471. "cover_art_url": "/img/icons.jpg"
  11472. },
  11473. {
  11474. "name": "Farout",
  11475. "artist": "2010",
  11476. "album": "Icon",
  11477. "url": "/audio/icon/12_farout.mp3",
  11478. "cover_art_url": "/img/icons.jpg"
  11479. },
  11480. {
  11481. "name": "China #2",
  11482. "artist": "2010",
  11483. "album": "Icon",
  11484. "url": "/audio/icon/15_china2.mp3",
  11485. "cover_art_url": "/img/icons.jpg"
  11486. },
  11487. {
  11488. "name": "Clementi Sample",
  11489. "artist": "2010",
  11490. "album": "Diversions",
  11491. "url": "/audio/diversions/1_clementisample.mp3",
  11492. "cover_art_url": "/img/diversions.jpg"
  11493. },
  11494. {
  11495. "name": "Clementi Sample #2",
  11496. "artist": "2010",
  11497. "album": "Diversions",
  11498. "url": "/audio/diversions/2_Clementisample2.mp3",
  11499. "cover_art_url": "/img/diversions.jpg"
  11500. },
  11501. {
  11502. "name": "Nocture Sample",
  11503. "artist": "2010",
  11504. "album": "Diversions",
  11505. "url": "/audio/diversions/3_nocturnesample.mp3",
  11506. "cover_art_url": "/img/diversions.jpg"
  11507. },
  11508. {
  11509. "name": "Diversion in D Sharp Minor",
  11510. "artist": "2010",
  11511. "album": "Diversions",
  11512. "url": "/audio/diversions/4_diversion_in_dsharpm.mp3",
  11513. "cover_art_url": "/img/diversions.jpg"
  11514. },
  11515. {
  11516. "name": "Meditation in F Sharp",
  11517. "artist": "2010",
  11518. "album": "Diversions",
  11519. "url": "/audio/diversions/mediation_in_fsharp.mp3",
  11520. "cover_art_url": "/img/diversions.jpg"
  11521. },
  11522. {
  11523. "name": "Poem #2",
  11524. "artist": "2010",
  11525. "album": "Diversions",
  11526. "url": "/audio/diversions/poemnumber2.mp3",
  11527. "cover_art_url": "/img/diversions.jpg"
  11528. },
  11529. {
  11530. "name": "Prelude in C Minor",
  11531. "artist": "2010",
  11532. "album": "Diversions",
  11533. "url": "/audio/diversions/Prelude_in_Cm1.mp3",
  11534. "cover_art_url": "/img/diversions.jpg"
  11535. },
  11536. {
  11537. "name": "Solfeggio",
  11538. "artist": "2010",
  11539. "album": "Diversions",
  11540. "url": "/audio/diversions/solfeggio.mp3",
  11541. "cover_art_url": "/img/diversions.jpg"
  11542. },
  11543. {
  11544. "name": "Waltz in E Minor",
  11545. "artist": "2010",
  11546. "album": "Diversions",
  11547. "url": "/audio/diversions/waltz_in_em.mp3",
  11548. "cover_art_url": "/img/diversions.jpg"
  11549. },
  11550. {
  11551. "name": "Domenica",
  11552. "artist": "Unknown",
  11553. "album": "Unknown",
  11554. "url": "/audio/piano_unknown/domenica.mp3",
  11555. "cover_art_url": "/img/unknown.jpg"
  11556. },
  11557. {
  11558. "name": "Down",
  11559. "artist": "Unknown",
  11560. "album": "Unknown",
  11561. "url": "/audio/piano_unknown/down.mp3",
  11562. "cover_art_url": "/img/unknown.jpg"
  11563. },
  11564. {
  11565. "name": "Feeling Low",
  11566. "artist": "2015",
  11567. "album": "Unknown",
  11568. "url": "/audio/piano_unknown/Feeling_Low.mp3",
  11569. "cover_art_url": "/img/unknown.jpg"
  11570. },
  11571. {
  11572. "name": "First Flight",
  11573. "artist": "Unknown",
  11574. "album": "Unknown",
  11575. "url": "/audio/piano_unknown/first_flight.mp3",
  11576. "cover_art_url": "/img/unknown.jpg"
  11577. },
  11578. {
  11579. "name": "Halftime",
  11580. "artist": "Unknown",
  11581. "album": "Unknown",
  11582. "url": "/audio/piano_unknown/halftime.mp3",
  11583. "cover_art_url": "/img/unknown.jpg"
  11584. },
  11585. {
  11586. "name": "Ice",
  11587. "artist": "Unknown",
  11588. "album": "Unknown",
  11589. "url": "/audio/piano_unknown/Ice.mp3",
  11590. "cover_art_url": "/img/unknown.jpg"
  11591. },
  11592. {
  11593. "name": "Impression",
  11594. "artist": "Unknown",
  11595. "album": "Unknown",
  11596. "url": "/audio/piano_unknown/impression.mp3",
  11597. "cover_art_url": "/img/unknown.jpg"
  11598. },
  11599. {
  11600. "name": "Never Before Heard",
  11601. "artist": "Unknown",
  11602. "album": "Unknown",
  11603. "url": "/audio/piano_unknown/never_before_heard.mp3",
  11604. "cover_art_url": "/img/unknown.jpg"
  11605. },
  11606. {
  11607. "name": "New Years Day",
  11608. "artist": "Unknown",
  11609. "album": "Unknown",
  11610. "url": "/audio/piano_unknown/new-years-day.mp3",
  11611. "cover_art_url": "/img/unknown.jpg"
  11612. },
  11613. {
  11614. "name": "Night Sun",
  11615. "artist": "Unknown",
  11616. "album": "Unknown",
  11617. "url": "/audio/piano_unknown/NightSun.mp3",
  11618. "cover_art_url": "/img/unknown.jpg"
  11619. },
  11620. {
  11621. "name": "Piano with Flute & Strings",
  11622. "artist": "Unknown",
  11623. "album": "Unknown",
  11624. "url": "/audio/piano_unknown/piano-with-flute-strings.mp3",
  11625. "cover_art_url": "/img/unknown.jpg"
  11626. },
  11627. {
  11628. "name": "Piece",
  11629. "artist": "Unknown",
  11630. "album": "Unknown",
  11631. "url": "/audio/piano_unknown/piece-of-dookie.mp3",
  11632. "cover_art_url": "/img/unknown.jpg"
  11633. },
  11634. {
  11635. "name": "Prelude 7",
  11636. "artist": "2017",
  11637. "album": "Unknown",
  11638. "url": "/audio/piano_unknown/Prelude7.mp3",
  11639. "cover_art_url": "/img/unknown.jpg"
  11640. },
  11641. {
  11642. "name": "Sketch",
  11643. "artist": "Unknown",
  11644. "album": "Unknown",
  11645. "url": "/audio/piano_unknown/scketch.mp3",
  11646. "cover_art_url": "/img/unknown.jpg"
  11647. },
  11648. {
  11649. "name": "Soaring",
  11650. "artist": "Unknown",
  11651. "album": "Unknown",
  11652. "url": "/audio/piano_unknown/Soaring.mp3",
  11653. "cover_art_url": "/img/unknown.jpg"
  11654. },
  11655. {
  11656. "name": "Time Slips",
  11657. "artist": "Unknown",
  11658. "album": "Unknown",
  11659. "url": "/audio/piano_unknown/timeslips.mp3",
  11660. "cover_art_url": "/img/unknown.jpg"
  11661. },
  11662. {
  11663. "name": "Valentines",
  11664. "artist": "Unknown",
  11665. "album": "Unknown",
  11666. "url": "/audio/piano_unknown/Valentines.mp3",
  11667. "cover_art_url": "/img/unknown.jpg"
  11668. },
  11669. {
  11670. "name": "Winter",
  11671. "artist": "Unknown",
  11672. "album": "Unknown",
  11673. "url": "/audio/piano_unknown/winter.mp3",
  11674. "cover_art_url": "/img/unknown.jpg"
  11675. },
  11676. {
  11677. "name": "1",
  11678. "artist": "2017",
  11679. "album": "Clips for Film",
  11680. "url": "/audio/clips-for-film/1.mp3",
  11681. "cover_art_url": "/img/clips.jpg"
  11682. },
  11683. {
  11684. "name": "2",
  11685. "artist": "2017",
  11686. "album": "Clips for Film",
  11687. "url": "/audio/clips-for-film/2.mp3",
  11688. "cover_art_url": "/img/clips.jpg"
  11689. },
  11690. {
  11691. "name": "3",
  11692. "artist": "2017",
  11693. "album": "Clips for Film",
  11694. "url": "/audio/clips-for-film/3.mp3",
  11695. "cover_art_url": "/img/clips.jpg"
  11696. },
  11697. {
  11698. "name": "4",
  11699. "artist": "2017",
  11700. "album": "Clips for Film",
  11701. "url": "/audio/clips-for-film/4.mp3",
  11702. "cover_art_url": "/img/clips.jpg"
  11703. },
  11704. {
  11705. "name": "5",
  11706. "artist": "2017",
  11707. "album": "Clips for Film",
  11708. "url": "/audio/clips-for-film/5.mp3",
  11709. "cover_art_url": "/img/clips.jpg"
  11710. },
  11711. {
  11712. "name": "6",
  11713. "artist": "2017",
  11714. "album": "Clips for Film",
  11715. "url": "/audio/clips-for-film/6.mp3",
  11716. "cover_art_url": "/img/clips.jpg"
  11717. },
  11718. {
  11719. "name": "7",
  11720. "artist": "2017",
  11721. "album": "Clips for Film",
  11722. "url": "/audio/clips-for-film/7.mp3",
  11723. "cover_art_url": "/img/clips.jpg"
  11724. },
  11725. {
  11726. "name": "8",
  11727. "artist": "2017",
  11728. "album": "Clips for Film",
  11729. "url": "/audio/clips-for-film/8.mp3",
  11730. "cover_art_url": "/img/clips.jpg"
  11731. },
  11732. {
  11733. "name": "9",
  11734. "artist": "2017",
  11735. "album": "Clips for Film",
  11736. "url": "/audio/clips-for-film/9.mp3",
  11737. "cover_art_url": "/img/clips.jpg"
  11738. },
  11739. {
  11740. "name": "10",
  11741. "artist": "2017",
  11742. "album": "Clips for Film",
  11743. "url": "/audio/clips-for-film/11.mp3",
  11744. "cover_art_url": "/img/clips.jpg"
  11745. },
  11746. {
  11747. "name": "11",
  11748. "artist": "2017",
  11749. "album": "Clips for Film",
  11750. "url": "/audio/clips-for-film/11.mp3",
  11751. "cover_art_url": "/img/clips.jpg"
  11752. },
  11753. {
  11754. "name": "12",
  11755. "artist": "2017",
  11756. "album": "Clips for Film",
  11757. "url": "/audio/clips-for-film/12.mp3",
  11758. "cover_art_url": "/img/clips.jpg"
  11759. },
  11760. {
  11761. "name": "13",
  11762. "artist": "2017",
  11763. "album": "Clips for Film",
  11764. "url": "/audio/clips-for-film/13.mp3",
  11765. "cover_art_url": "/img/clips.jpg"
  11766. },
  11767. {
  11768. "name": "14",
  11769. "artist": "2017",
  11770. "album": "Clips for Film",
  11771. "url": "/audio/clips-for-film/14.mp3",
  11772. "cover_art_url": "/img/clips.jpg"
  11773. },
  11774. {
  11775. "name": "15",
  11776. "artist": "2017",
  11777. "album": "Clips for Film",
  11778. "url": "/audio/clips-for-film/15.mp3",
  11779. "cover_art_url": "/img/clips.jpg"
  11780. },
  11781. {
  11782. "name": "Circle Clip",
  11783. "artist": "2011",
  11784. "album": "Delia",
  11785. "url": "/audio/delia/CircleClip.mp3",
  11786. "cover_art_url": "/img/delia.jpg"
  11787. },
  11788. {
  11789. "name": "No Woman No Cry",
  11790. "artist": "2011",
  11791. "album": "Delia",
  11792. "url": "/audio/delia/NoWomanNoCry.mp3",
  11793. "cover_art_url": "/img/delia.jpg"
  11794. },
  11795. {
  11796. "name": "One More Cup of Coffee",
  11797. "artist": "2011",
  11798. "album": "Delia",
  11799. "url": "/audio/delia/OneMoreCupofCoffee.mp3",
  11800. "cover_art_url": "/img/delia.jpg"
  11801. },
  11802. {
  11803. "name": "Rhapsody In O Flat Minor",
  11804. "artist": "2011",
  11805. "album": "Delia",
  11806. "url": "/audio/delia/RhapsodyInOFlatMinor.mp3",
  11807. "cover_art_url": "/img/delia.jpg"
  11808. },
  11809. {
  11810. "name": "The River",
  11811. "artist": "2011",
  11812. "album": "Delia",
  11813. "url": "/audio/delia/TheRiver.mp3",
  11814. "cover_art_url": "/img/delia.jpg"
  11815. },
  11816. {
  11817. "name": "Protos",
  11818. "artist": "2015",
  11819. "album": "Mystic",
  11820. "url": "/audio/mystic/1-Protos.mp3",
  11821. "cover_art_url": "/img/mystic.png"
  11822. },
  11823. {
  11824. "name": "Mercury",
  11825. "artist": "2015",
  11826. "album": "Mystic",
  11827. "url": "/audio/mystic/2-Mercury.mp3",
  11828. "cover_art_url": "/img/mystic.png"
  11829. },
  11830. {
  11831. "name": "Mystic",
  11832. "artist": "2015",
  11833. "album": "Mystic",
  11834. "url": "/audio/mystic/3-Mystic.mp3",
  11835. "cover_art_url": "/img/mystic.png"
  11836. },
  11837. {
  11838. "name": "Hermes",
  11839. "artist": "2015",
  11840. "album": "Mystic",
  11841. "url": "/audio/mystic/4-Hermes.mp3",
  11842. "cover_art_url": "/img/mystic.png"
  11843. },
  11844. {
  11845. "name": "Agentum",
  11846. "artist": "2015",
  11847. "album": "Mystic",
  11848. "url": "/audio/mystic/5-Argentum.mp3",
  11849. "cover_art_url": "/img/mystic.png"
  11850. },
  11851. {
  11852. "name": "Aurum",
  11853. "artist": "2015",
  11854. "album": "Mystic",
  11855. "url": "/audio/mystic/6-Aurum.mp3",
  11856. "cover_art_url": "/img/mystic.png"
  11857. },
  11858. {
  11859. "name": "Ouroboros",
  11860. "artist": "2015",
  11861. "album": "Mystic",
  11862. "url": "/audio/mystic/7-Ouroboros.mp3",
  11863. "cover_art_url": "/img/mystic.png"
  11864. },
  11865. {
  11866. "name": "Orbital Habitat",
  11867. "artist": "2015",
  11868. "album": "Suka",
  11869. "url": "/audio/suka/1-Orbital_Habitat.mp3",
  11870. "cover_art_url": "/img/suka.jpg"
  11871. },
  11872. {
  11873. "name": "Ogon",
  11874. "artist": "2015",
  11875. "album": "Suka",
  11876. "url": "/audio/suka/2-Ogon.mp3",
  11877. "cover_art_url": "/img/suka.jpg"
  11878. },
  11879. {
  11880. "name": "Onus",
  11881. "artist": "2015",
  11882. "album": "Suka",
  11883. "url": "/audio/suka/3-Onus.mp3",
  11884. "cover_art_url": "/img/suka.jpg"
  11885. },
  11886. {
  11887. "name": "Dom Suka",
  11888. "artist": "2015",
  11889. "album": "Suka",
  11890. "url": "/audio/suka/4-Dom_Suka.mp3",
  11891. "cover_art_url": "/img/suka.jpg"
  11892. },
  11893. {
  11894. "name": "Sedulous",
  11895. "artist": "2015",
  11896. "album": "Suka",
  11897. "url": "/audio/suka/5-Sedulous.mp3",
  11898. "cover_art_url": "/img/suka.jpg"
  11899. },
  11900. {
  11901. "name": "Strakh",
  11902. "artist": "2015",
  11903. "album": "Suka",
  11904. "url": "/audio/suka/6-Strakh.mp3",
  11905. "cover_art_url": "/img/suka.jpg"
  11906. },
  11907. {
  11908. "name": "Blank",
  11909. "artist": "2015",
  11910. "album": "Suka",
  11911. "url": "/audio/suka/7-Blank.mp3",
  11912. "cover_art_url": "/img/suka.jpg"
  11913. },
  11914. {
  11915. "name": "Simple X",
  11916. "artist": "2015",
  11917. "album": "Vox Dei",
  11918. "url": "/audio/vox-dei/1-SimpleX.mp3",
  11919. "cover_art_url": "/img/vox.jpg"
  11920. },
  11921. {
  11922. "name": "Vox Dei",
  11923. "artist": "2015",
  11924. "album": "Vox Dei",
  11925. "url": "/audio/vox-dei/2-Vox_Dei.mp3",
  11926. "cover_art_url": "/img/vox.jpg"
  11927. },
  11928. {
  11929. "name": "Spiritus",
  11930. "artist": "2015",
  11931. "album": "Vox Dei",
  11932. "url": "/audio/vox-dei/3-Spiritus.mp3",
  11933. "cover_art_url": "/img/vox.jpg"
  11934. },
  11935. {
  11936. "name": "Isabellae",
  11937. "artist": "2015",
  11938. "album": "Vox Dei",
  11939. "url": "/audio/vox-dei/4-Isabellae.mp3",
  11940. "cover_art_url": "/img/vox.jpg"
  11941. },
  11942. {
  11943. "name": "Inlustris",
  11944. "artist": "2015",
  11945. "album": "Vox Dei",
  11946. "url": "/audio/vox-dei/5-Inlustris.mp3",
  11947. "cover_art_url": "/img/vox.jpg"
  11948. },
  11949. {
  11950. "name": "Oceanus",
  11951. "artist": "2015",
  11952. "album": "Vox Dei",
  11953. "url": "/audio/vox-dei/6-Oceanus.mp3",
  11954. "cover_art_url": "/img/vox.jpg"
  11955. },
  11956. {
  11957. "name": "Easter",
  11958. "artist": "2016",
  11959. "album": "Live",
  11960. "url": "/audio/LivePiano/KW-Live_Easter_2016.mp3",
  11961. "cover_art_url": "/img/live.jpg"
  11962. },
  11963. {
  11964. "name": "3/26",
  11965. "artist": "2016",
  11966. "album": "Live",
  11967. "url": "/audio/LivePiano/KW-Live_3_26_2016.mp3",
  11968. "cover_art_url": "/img/live.jpg"
  11969. },
  11970. {
  11971. "name": "3/27",
  11972. "artist": "2016",
  11973. "album": "Live",
  11974. "url": "/audio/LivePiano/KW-Live_3_27_2016.mp3",
  11975. "cover_art_url": "/img/live.jpg"
  11976. },
  11977. {
  11978. "name": "3/28",
  11979. "artist": "2016",
  11980. "album": "Live",
  11981. "url": "/audio/LivePiano/KW-Live_3_28_2016.mp3",
  11982. "cover_art_url": "/img/live.jpg"
  11983. },
  11984. {
  11985. "name": "3/29",
  11986. "artist": "2016",
  11987. "album": "Live",
  11988. "url": "/audio/LivePiano/KW-Live_3_29_2016.mp3",
  11989. "cover_art_url": "/img/live.jpg"
  11990. },
  11991. {
  11992. "name": "4/10",
  11993. "artist": "2016",
  11994. "album": "Live",
  11995. "url": "/audio/LivePiano/KW-Live_4_10_2016.mp3",
  11996. "cover_art_url": "/img/live.jpg"
  11997. },
  11998. {
  11999. "name": "4/24",
  12000. "artist": "2016",
  12001. "album": "Live",
  12002. "url": "/audio/LivePiano/KW-Live_4_24_2016.mp3",
  12003. "cover_art_url": "/img/live.jpg"
  12004. },
  12005. {
  12006. "name": "iWoody",
  12007. "artist": "2016",
  12008. "album": "Live",
  12009. "url": "/audio/LivePiano/KW-Live-iwoody.mp3",
  12010. "cover_art_url": "/img/live.jpg"
  12011. },
  12012. {
  12013. "name": "iWoody(2)",
  12014. "artist": "2016",
  12015. "album": "Live",
  12016. "url": "/audio/LivePiano/KW-Live-on-iWoody.mp3",
  12017. "cover_art_url": "/img/live.jpg"
  12018. },
  12019. ],
  12020. "callbacks": {
  12021. 'play': function(){
  12022. document.getElementById('album-art').style.visibility = 'hidden';
  12023. document.getElementById('large-visualization').style.visibility = 'visible';
  12024. },
  12025. 'pause': function(){
  12026. document.getElementById('album-art').style.visibility = 'visible';
  12027. document.getElementById('large-visualization').style.visibility = 'hidden';
  12028. }
  12029. },
  12030. waveforms: {
  12031. sample_rate: 200
  12032. }
  12033. });
  12034. let songElements = document.getElementsByClassName('song');
  12035. for( var i = 0; i < songElements.length; i++ ){
  12036. /*
  12037. Ensure that on mouseover, CSS styles don't get messed up for active songs.
  12038. */
  12039. songElements[i].addEventListener('mouseover', function(){
  12040. this.style.backgroundColor = '#494949';
  12041. this.querySelectorAll('.song-meta-data .song-title')[0].style.color = '#FFFFFF';
  12042. this.querySelectorAll('.song-meta-data .song-artist')[0].style.color = '#FFFFFF';
  12043. if( !this.classList.contains('amplitude-active-song-container') ){
  12044. this.querySelectorAll('.play-button-container')[0].style.display = 'block';
  12045. }
  12046. this.querySelectorAll('.song-duration')[0].style.color = '#FFFFFF';
  12047. });
  12048. /*
  12049. Ensure that on mouseout, CSS styles don't get messed up for active songs.
  12050. */
  12051. songElements[i].addEventListener('mouseout', function(){
  12052. this.style.backgroundColor = '#FFFFFF';
  12053. this.querySelectorAll('.song-meta-data .song-title')[0].style.color = '#272726';
  12054. this.querySelectorAll('.song-meta-data .song-artist')[0].style.color = '#607D8B';
  12055. this.querySelectorAll('.play-button-container')[0].style.display = 'none';
  12056. this.querySelectorAll('.song-duration')[0].style.color = '#607D8B';
  12057. });
  12058. /*
  12059. Show and hide the play button container on the song when the song is clicked.
  12060. */
  12061. songElements[i].addEventListener('click', function(){
  12062. this.querySelectorAll('.play-button-container')[0].style.display = 'none';
  12063. });
  12064. }
  12065. const myModalEl = document.getElementById('Video');
  12066. var video = document.getElementById("redemption");
  12067. var video2 = document.getElementById("hollow");
  12068. function stopVideo() {
  12069. video.pause();
  12070. video.currentTime = 0;
  12071. video2.pause();
  12072. video2.currentTime = 0;
  12073. }
  12074. myModalEl.addEventListener('hidden.bs.modal', event => {
  12075. stopVideo();
  12076. })
  12077. //# sourceMappingURL=site.js.map