layers-ui.js 663 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 28);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. Object.defineProperty(exports, "__esModule", {
  74. value: true
  75. });
  76. var _jquery = __webpack_require__(1);
  77. var _jquery2 = _interopRequireDefault(_jquery);
  78. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  79. /**
  80. * --------------------------------------------------------------------------
  81. * Bootstrap (v4.0.0-beta): util.js
  82. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  83. * --------------------------------------------------------------------------
  84. */
  85. var Util = function () {
  86. /**
  87. * ------------------------------------------------------------------------
  88. * Private TransitionEnd Helpers
  89. * ------------------------------------------------------------------------
  90. */
  91. var transition = false;
  92. var MAX_UID = 1000000;
  93. var TransitionEndEvent = {
  94. WebkitTransition: 'webkitTransitionEnd',
  95. MozTransition: 'transitionend',
  96. OTransition: 'oTransitionEnd otransitionend',
  97. transition: 'transitionend'
  98. // shoutout AngusCroll (https://goo.gl/pxwQGp)
  99. };function toType(obj) {
  100. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  101. }
  102. function getSpecialTransitionEndEvent() {
  103. return {
  104. bindType: transition.end,
  105. delegateType: transition.end,
  106. handle: function handle(event) {
  107. if ((0, _jquery2.default)(event.target).is(this)) {
  108. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  109. }
  110. return undefined; // eslint-disable-line no-undefined
  111. }
  112. };
  113. }
  114. function transitionEndTest() {
  115. if (window.QUnit) {
  116. return false;
  117. }
  118. var el = document.createElement('bootstrap');
  119. for (var name in TransitionEndEvent) {
  120. if (typeof el.style[name] !== 'undefined') {
  121. return {
  122. end: TransitionEndEvent[name]
  123. };
  124. }
  125. }
  126. return false;
  127. }
  128. function transitionEndEmulator(duration) {
  129. var _this = this;
  130. var called = false;
  131. (0, _jquery2.default)(this).one(Util.TRANSITION_END, function () {
  132. called = true;
  133. });
  134. setTimeout(function () {
  135. if (!called) {
  136. Util.triggerTransitionEnd(_this);
  137. }
  138. }, duration);
  139. return this;
  140. }
  141. function setTransitionEndSupport() {
  142. transition = transitionEndTest();
  143. _jquery2.default.fn.emulateTransitionEnd = transitionEndEmulator;
  144. if (Util.supportsTransitionEnd()) {
  145. _jquery2.default.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  146. }
  147. }
  148. function parseOption(item) {
  149. if ('true' === item) {
  150. return true;
  151. } else if ('false' === item) {
  152. return false;
  153. } else if (!isNaN(item * 1)) {
  154. return parseFloat(item);
  155. } else {
  156. return item;
  157. }
  158. }
  159. /**
  160. * --------------------------------------------------------------------------
  161. * Public Util Api
  162. * --------------------------------------------------------------------------
  163. */
  164. var Util = {
  165. TRANSITION_END: 'bsTransitionEnd',
  166. getUID: function getUID(prefix) {
  167. do {
  168. // eslint-disable-next-line no-bitwise
  169. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  170. } while (document.getElementById(prefix));
  171. return prefix;
  172. },
  173. getSelectorFromElement: function getSelectorFromElement(element) {
  174. var selector = element.getAttribute('data-target');
  175. if (!selector || selector === '#') {
  176. selector = element.getAttribute('href') || '';
  177. }
  178. try {
  179. var $selector = (0, _jquery2.default)(document).find(selector);
  180. return $selector.length > 0 ? selector : null;
  181. } catch (error) {
  182. return null;
  183. }
  184. },
  185. reflow: function reflow(element) {
  186. return element.offsetHeight;
  187. },
  188. triggerTransitionEnd: function triggerTransitionEnd(element) {
  189. (0, _jquery2.default)(element).trigger(transition.end);
  190. },
  191. supportsTransitionEnd: function supportsTransitionEnd() {
  192. return Boolean(transition);
  193. },
  194. isElement: function isElement(obj) {
  195. return (obj[0] || obj).nodeType;
  196. },
  197. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  198. for (var property in configTypes) {
  199. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  200. var expectedTypes = configTypes[property];
  201. var value = config[property];
  202. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  203. if (!new RegExp(expectedTypes).test(valueType)) {
  204. throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
  205. }
  206. }
  207. }
  208. },
  209. parseDataOptions: function parseDataOptions(dataOptions) {
  210. var options = [];
  211. var string = dataOptions.split(';');
  212. string.forEach(function (item, index) {
  213. var option = item.split(':');
  214. option = option.map(function (item) {
  215. return item.trim();
  216. });
  217. if (option[0]) {
  218. options[option[0]] = parseOption(option[1]);
  219. }
  220. });
  221. return options;
  222. }
  223. };
  224. setTransitionEndSupport();
  225. return Util;
  226. }(_jquery2.default);
  227. exports.default = Util;
  228. /***/ }),
  229. /* 1 */
  230. /***/ (function(module, exports) {
  231. module.exports = jQuery;
  232. /***/ }),
  233. /* 2 */,
  234. /* 3 */
  235. /***/ (function(module, exports, __webpack_require__) {
  236. "use strict";
  237. Object.defineProperty(exports, "__esModule", {
  238. value: true
  239. });
  240. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  241. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  242. var SELECTORS = {
  243. inputsContainer: '[data-inputs-container]',
  244. virtualInput: '[data-virtual-input]',
  245. isChecked: 'is-selected',
  246. inputTarget: '[data-input-target]',
  247. dataTargetId: '[data-target-id]',
  248. content: '[data-content]',
  249. contentTarget: '[data-content-target]'
  250. };
  251. var selectInput = function () {
  252. function selectInput(inputGroup, drop) {
  253. _classCallCheck(this, selectInput);
  254. this.inputGroup = inputGroup;
  255. this.type = this.inputGroup.data('inputs-container');
  256. this.drop = drop;
  257. this.virtualInputs = this.inputGroup.find(SELECTORS.virtualInput);
  258. this.bindEvents();
  259. }
  260. _createClass(selectInput, [{
  261. key: 'bindEvents',
  262. value: function bindEvents() {
  263. var _this = this;
  264. this.virtualInputs.on('click', function (event) {
  265. return _this.selectItem(event);
  266. });
  267. }
  268. }, {
  269. key: 'selectItem',
  270. value: function selectItem(event) {
  271. if (this.type == 'checkboxes') {
  272. if ($(event.currentTarget).hasClass('is-selected')) {
  273. $(event.currentTarget).removeClass(SELECTORS.isChecked);
  274. $(event.currentTarget).find('input').prop("checked", false);
  275. } else {
  276. $(event.currentTarget).addClass(SELECTORS.isChecked);
  277. $(event.currentTarget).find('input').prop("checked", true);
  278. }
  279. } else {
  280. this.virtualInputs.removeClass(SELECTORS.isChecked);
  281. this.virtualInputs.find('input').prop("checked", false);
  282. $(event.currentTarget).addClass(SELECTORS.isChecked);
  283. $(event.currentTarget).find('input').prop("checked", true);
  284. }
  285. if (this.drop) {
  286. this.getDropdownContent(event);
  287. this.setDropdownContent();
  288. this.drop.close();
  289. }
  290. }
  291. }, {
  292. key: 'setDropdownContent',
  293. value: function setDropdownContent() {
  294. for (var property in this.data) {
  295. $(this.drop.target).find('[data-view-' + property + ']').text(this.data[property]);
  296. }
  297. }
  298. }, {
  299. key: 'getDropdownContent',
  300. value: function getDropdownContent(event) {
  301. this.data = $(event.currentTarget).data('config');
  302. }
  303. }], [{
  304. key: 'init',
  305. value: function init(container, drop) {
  306. if (container) {
  307. new selectInput($(container).find(SELECTORS.inputsContainer), drop);
  308. } else {
  309. $(SELECTORS.inputsContainer).each(function () {
  310. new selectInput($(this), drop);
  311. });
  312. }
  313. }
  314. }]);
  315. return selectInput;
  316. }();
  317. exports.default = selectInput;
  318. /***/ }),
  319. /* 4 */
  320. /***/ (function(module, exports, __webpack_require__) {
  321. "use strict";
  322. 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; };
  323. /**
  324. * Swiper 3.4.2
  325. * Most modern mobile touch slider and framework with hardware accelerated transitions
  326. *
  327. * http://www.idangero.us/swiper/
  328. *
  329. * Copyright 2017, Vladimir Kharlampidi
  330. * The iDangero.us
  331. * http://www.idangero.us/
  332. *
  333. * Licensed under MIT
  334. *
  335. * Released on: March 10, 2017
  336. */
  337. (function () {
  338. 'use strict';
  339. var $;
  340. /*===========================
  341. Swiper
  342. ===========================*/
  343. var Swiper = function Swiper(container, params) {
  344. if (!(this instanceof Swiper)) return new Swiper(container, params);
  345. var defaults = {
  346. direction: 'horizontal',
  347. touchEventsTarget: 'lu-container',
  348. initialSlide: 0,
  349. speed: 300,
  350. // autoplay
  351. autoplay: false,
  352. autoplayDisableOnInteraction: true,
  353. autoplayStopOnLast: false,
  354. // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
  355. iOSEdgeSwipeDetection: false,
  356. iOSEdgeSwipeThreshold: 20,
  357. // Free mode
  358. freeMode: false,
  359. freeModeMomentum: true,
  360. freeModeMomentumRatio: 1,
  361. freeModeMomentumBounce: true,
  362. freeModeMomentumBounceRatio: 1,
  363. freeModeMomentumVelocityRatio: 1,
  364. freeModeSticky: false,
  365. freeModeMinimumVelocity: 0.02,
  366. // Autoheight
  367. autoHeight: false,
  368. // Set wrapper width
  369. setWrapperSize: false,
  370. // Virtual Translate
  371. virtualTranslate: false,
  372. // Effects
  373. effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
  374. coverflow: {
  375. rotate: 50,
  376. stretch: 0,
  377. depth: 100,
  378. modifier: 1,
  379. slideShadows: true
  380. },
  381. flip: {
  382. slideShadows: true,
  383. limitRotation: true
  384. },
  385. cube: {
  386. slideShadows: true,
  387. shadow: true,
  388. shadowOffset: 20,
  389. shadowScale: 0.94
  390. },
  391. fade: {
  392. crossFade: false
  393. },
  394. // Parallax
  395. parallax: false,
  396. // Zoom
  397. zoom: false,
  398. zoomMax: 3,
  399. zoomMin: 1,
  400. zoomToggle: true,
  401. // Scrollbar
  402. scrollbar: null,
  403. scrollbarHide: true,
  404. scrollbarDraggable: false,
  405. scrollbarSnapOnRelease: false,
  406. // Keyboard Mousewheel
  407. keyboardControl: false,
  408. mousewheelControl: false,
  409. mousewheelReleaseOnEdges: false,
  410. mousewheelInvert: false,
  411. mousewheelForceToAxis: false,
  412. mousewheelSensitivity: 1,
  413. mousewheelEventsTarged: 'lu-container',
  414. // Hash Navigation
  415. hashnav: false,
  416. hashnavWatchState: false,
  417. // History
  418. history: false,
  419. // Commong Nav State
  420. replaceState: false,
  421. // Breakpoints
  422. breakpoints: undefined,
  423. // Slides grid
  424. spaceBetween: 0,
  425. slidesPerView: 1,
  426. slidesPerColumn: 1,
  427. slidesPerColumnFill: 'column',
  428. slidesPerGroup: 1,
  429. centeredSlides: false,
  430. slidesOffsetBefore: 0, // in px
  431. slidesOffsetAfter: 0, // in px
  432. // Round length
  433. roundLengths: false,
  434. // Touches
  435. touchRatio: 1,
  436. touchAngle: 45,
  437. simulateTouch: true,
  438. shortSwipes: true,
  439. longSwipes: true,
  440. longSwipesRatio: 0.5,
  441. longSwipesMs: 300,
  442. followFinger: true,
  443. onlyExternal: false,
  444. threshold: 0,
  445. touchMoveStopPropagation: true,
  446. touchReleaseOnEdges: false,
  447. // Unique Navigation Elements
  448. uniqueNavElements: true,
  449. // Pagination
  450. pagination: null,
  451. paginationElement: 'span',
  452. paginationClickable: false,
  453. paginationHide: false,
  454. paginationBulletRender: null,
  455. paginationProgressRender: null,
  456. paginationFractionRender: null,
  457. paginationCustomRender: null,
  458. paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'
  459. // Resistance
  460. resistance: true,
  461. resistanceRatio: 0.85,
  462. // Next/prev buttons
  463. nextButton: null,
  464. prevButton: null,
  465. // Progress
  466. watchSlidesProgress: false,
  467. watchSlidesVisibility: false,
  468. // Cursor
  469. grabCursor: false,
  470. // Clicks
  471. preventClicks: true,
  472. preventClicksPropagation: true,
  473. slideToClickedSlide: false,
  474. // Lazy Loading
  475. lazyLoading: false,
  476. lazyLoadingInPrevNext: false,
  477. lazyLoadingInPrevNextAmount: 1,
  478. lazyLoadingOnTransitionStart: false,
  479. // Images
  480. preloadImages: true,
  481. updateOnImagesReady: true,
  482. // loop
  483. loop: false,
  484. loopAdditionalSlides: 0,
  485. loopedSlides: null,
  486. // Control
  487. control: undefined,
  488. controlInverse: false,
  489. controlBy: 'slide', //or 'container'
  490. normalizeSlideIndex: true,
  491. // Swiping/no swiping
  492. allowSwipeToPrev: true,
  493. allowSwipeToNext: true,
  494. swipeHandler: null, //'.swipe-handler',
  495. noSwiping: true,
  496. noSwipingClass: 'swiper-no-swiping',
  497. // Passive Listeners
  498. passiveListeners: true,
  499. // NS
  500. containerModifierClass: 'swiper-container-', // NEW
  501. slideClass: 'swiper-slide',
  502. slideActiveClass: 'swiper-slide-active',
  503. slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
  504. slideVisibleClass: 'swiper-slide-visible',
  505. slideDuplicateClass: 'swiper-slide-duplicate',
  506. slideNextClass: 'swiper-slide-next',
  507. slideDuplicateNextClass: 'swiper-slide-duplicate-next',
  508. slidePrevClass: 'swiper-slide-prev',
  509. slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
  510. wrapperClass: 'swiper-wrapper',
  511. bulletClass: 'swiper-pagination-bullet',
  512. bulletActiveClass: 'swiper-pagination-bullet-active',
  513. buttonDisabledClass: 'swiper-button-disabled',
  514. paginationCurrentClass: 'swiper-pagination-current',
  515. paginationTotalClass: 'swiper-pagination-total',
  516. paginationHiddenClass: 'swiper-pagination-hidden',
  517. paginationProgressbarClass: 'swiper-pagination-progressbar',
  518. paginationClickableClass: 'swiper-pagination-clickable', // NEW
  519. paginationModifierClass: 'swiper-pagination-', // NEW
  520. lazyLoadingClass: 'swiper-lazy',
  521. lazyStatusLoadingClass: 'swiper-lazy-loading',
  522. lazyStatusLoadedClass: 'swiper-lazy-loaded',
  523. lazyPreloaderClass: 'swiper-lazy-preloader',
  524. notificationClass: 'swiper-notification',
  525. preloaderClass: 'preloader',
  526. zoomContainerClass: 'swiper-zoom-container',
  527. // Observer
  528. observer: false,
  529. observeParents: false,
  530. // Accessibility
  531. a11y: false,
  532. prevSlideMessage: 'Previous slide',
  533. nextSlideMessage: 'Next slide',
  534. firstSlideMessage: 'This is the first slide',
  535. lastSlideMessage: 'This is the last slide',
  536. paginationBulletMessage: 'Go to slide {{index}}',
  537. // Callbacks
  538. runCallbacksOnInit: true
  539. /*
  540. Callbacks:
  541. onInit: function (swiper)
  542. onDestroy: function (swiper)
  543. onBeforeResize: function (swiper)
  544. onAfterResize: function (swiper)
  545. onClick: function (swiper, e)
  546. onTap: function (swiper, e)
  547. onDoubleTap: function (swiper, e)
  548. onSliderMove: function (swiper, e)
  549. onSlideChangeStart: function (swiper)
  550. onSlideChangeEnd: function (swiper)
  551. onTransitionStart: function (swiper)
  552. onTransitionEnd: function (swiper)
  553. onImagesReady: function (swiper)
  554. onProgress: function (swiper, progress)
  555. onTouchStart: function (swiper, e)
  556. onTouchMove: function (swiper, e)
  557. onTouchMoveOpposite: function (swiper, e)
  558. onTouchEnd: function (swiper, e)
  559. onReachBeginning: function (swiper)
  560. onReachEnd: function (swiper)
  561. onSetTransition: function (swiper, duration)
  562. onSetTranslate: function (swiper, translate)
  563. onAutoplayStart: function (swiper)
  564. onAutoplayStop: function (swiper),
  565. onLazyImageLoad: function (swiper, slide, image)
  566. onLazyImageReady: function (swiper, slide, image)
  567. onKeyPress: function (swiper, keyCode)
  568. */
  569. };
  570. var initialVirtualTranslate = params && params.virtualTranslate;
  571. params = params || {};
  572. var originalParams = {};
  573. for (var param in params) {
  574. if (_typeof(params[param]) === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || typeof Dom7 !== 'undefined' && params[param] instanceof Dom7 || typeof jQuery !== 'undefined' && params[param] instanceof jQuery)) {
  575. originalParams[param] = {};
  576. for (var deepParam in params[param]) {
  577. originalParams[param][deepParam] = params[param][deepParam];
  578. }
  579. } else {
  580. originalParams[param] = params[param];
  581. }
  582. }
  583. for (var def in defaults) {
  584. if (typeof params[def] === 'undefined') {
  585. params[def] = defaults[def];
  586. } else if (_typeof(params[def]) === 'object') {
  587. for (var deepDef in defaults[def]) {
  588. if (typeof params[def][deepDef] === 'undefined') {
  589. params[def][deepDef] = defaults[def][deepDef];
  590. }
  591. }
  592. }
  593. }
  594. // Swiper
  595. var s = this;
  596. // Params
  597. s.params = params;
  598. s.originalParams = originalParams;
  599. // Classname
  600. s.classNames = [];
  601. /*=========================
  602. Dom Library and plugins
  603. ===========================*/
  604. if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined') {
  605. $ = Dom7;
  606. }
  607. if (typeof $ === 'undefined') {
  608. if (typeof Dom7 === 'undefined') {
  609. $ = window.Dom7 || window.Zepto || window.jQuery;
  610. } else {
  611. $ = Dom7;
  612. }
  613. if (!$) return;
  614. }
  615. // Export it to Swiper instance
  616. s.$ = $;
  617. /*=========================
  618. Breakpoints
  619. ===========================*/
  620. s.currentBreakpoint = undefined;
  621. s.getActiveBreakpoint = function () {
  622. //Get breakpoint for window width
  623. if (!s.params.breakpoints) return false;
  624. var breakpoint = false;
  625. var points = [],
  626. point;
  627. for (point in s.params.breakpoints) {
  628. if (s.params.breakpoints.hasOwnProperty(point)) {
  629. points.push(point);
  630. }
  631. }
  632. points.sort(function (a, b) {
  633. return parseInt(a, 10) > parseInt(b, 10);
  634. });
  635. for (var i = 0; i < points.length; i++) {
  636. point = points[i];
  637. if (point >= window.innerWidth && !breakpoint) {
  638. breakpoint = point;
  639. }
  640. }
  641. return breakpoint || 'max';
  642. };
  643. s.setBreakpoint = function () {
  644. //Set breakpoint for window width and update parameters
  645. var breakpoint = s.getActiveBreakpoint();
  646. if (breakpoint && s.currentBreakpoint !== breakpoint) {
  647. var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
  648. var needsReLoop = s.params.loop && breakPointsParams.slidesPerView !== s.params.slidesPerView;
  649. for (var param in breakPointsParams) {
  650. s.params[param] = breakPointsParams[param];
  651. }
  652. s.currentBreakpoint = breakpoint;
  653. if (needsReLoop && s.destroyLoop) {
  654. s.reLoop(true);
  655. }
  656. }
  657. };
  658. // Set breakpoint on load
  659. if (s.params.breakpoints) {
  660. s.setBreakpoint();
  661. }
  662. /*=========================
  663. Preparation - Define Container, Wrapper and Pagination
  664. ===========================*/
  665. s.container = $(container);
  666. if (s.container.length === 0) return;
  667. if (s.container.length > 1) {
  668. var swipers = [];
  669. s.container.each(function () {
  670. var container = this;
  671. swipers.push(new Swiper(this, params));
  672. });
  673. return swipers;
  674. }
  675. // Save instance in container HTML Element and in data
  676. s.container[0].swiper = s;
  677. s.container.data('swiper', s);
  678. s.classNames.push(s.params.containerModifierClass + s.params.direction);
  679. if (s.params.freeMode) {
  680. s.classNames.push(s.params.containerModifierClass + 'free-mode');
  681. }
  682. if (!s.support.flexbox) {
  683. s.classNames.push(s.params.containerModifierClass + 'no-flexbox');
  684. s.params.slidesPerColumn = 1;
  685. }
  686. if (s.params.autoHeight) {
  687. s.classNames.push(s.params.containerModifierClass + 'autoheight');
  688. }
  689. // Enable slides progress when required
  690. if (s.params.parallax || s.params.watchSlidesVisibility) {
  691. s.params.watchSlidesProgress = true;
  692. }
  693. // Max resistance when touchReleaseOnEdges
  694. if (s.params.touchReleaseOnEdges) {
  695. s.params.resistanceRatio = 0;
  696. }
  697. // Coverflow / 3D
  698. if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {
  699. if (s.support.transforms3d) {
  700. s.params.watchSlidesProgress = true;
  701. s.classNames.push(s.params.containerModifierClass + '3d');
  702. } else {
  703. s.params.effect = 'slide';
  704. }
  705. }
  706. if (s.params.effect !== 'slide') {
  707. s.classNames.push(s.params.containerModifierClass + s.params.effect);
  708. }
  709. if (s.params.effect === 'cube') {
  710. s.params.resistanceRatio = 0;
  711. s.params.slidesPerView = 1;
  712. s.params.slidesPerColumn = 1;
  713. s.params.slidesPerGroup = 1;
  714. s.params.centeredSlides = false;
  715. s.params.spaceBetween = 0;
  716. s.params.virtualTranslate = true;
  717. }
  718. if (s.params.effect === 'fade' || s.params.effect === 'flip') {
  719. s.params.slidesPerView = 1;
  720. s.params.slidesPerColumn = 1;
  721. s.params.slidesPerGroup = 1;
  722. s.params.watchSlidesProgress = true;
  723. s.params.spaceBetween = 0;
  724. if (typeof initialVirtualTranslate === 'undefined') {
  725. s.params.virtualTranslate = true;
  726. }
  727. }
  728. // Grab Cursor
  729. if (s.params.grabCursor && s.support.touch) {
  730. s.params.grabCursor = false;
  731. }
  732. // Wrapper
  733. s.wrapper = s.container.children('.' + s.params.wrapperClass);
  734. // Pagination
  735. if (s.params.pagination) {
  736. s.paginationContainer = $(s.params.pagination);
  737. if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
  738. s.paginationContainer = s.container.find(s.params.pagination);
  739. }
  740. if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
  741. s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable');
  742. } else {
  743. s.params.paginationClickable = false;
  744. }
  745. s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType);
  746. }
  747. // Next/Prev Buttons
  748. if (s.params.nextButton || s.params.prevButton) {
  749. if (s.params.nextButton) {
  750. s.nextButton = $(s.params.nextButton);
  751. if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
  752. s.nextButton = s.container.find(s.params.nextButton);
  753. }
  754. }
  755. if (s.params.prevButton) {
  756. s.prevButton = $(s.params.prevButton);
  757. if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
  758. s.prevButton = s.container.find(s.params.prevButton);
  759. }
  760. }
  761. }
  762. // Is Horizontal
  763. s.isHorizontal = function () {
  764. return s.params.direction === 'horizontal';
  765. };
  766. // s.isH = isH;
  767. // RTL
  768. s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
  769. if (s.rtl) {
  770. s.classNames.push(s.params.containerModifierClass + 'rtl');
  771. }
  772. // Wrong RTL support
  773. if (s.rtl) {
  774. s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
  775. }
  776. // Columns
  777. if (s.params.slidesPerColumn > 1) {
  778. s.classNames.push(s.params.containerModifierClass + 'multirow');
  779. }
  780. // Check for Android
  781. if (s.device.android) {
  782. s.classNames.push(s.params.containerModifierClass + 'android');
  783. }
  784. // Add classes
  785. s.container.addClass(s.classNames.join(' '));
  786. // Translate
  787. s.translate = 0;
  788. // Progress
  789. s.progress = 0;
  790. // Velocity
  791. s.velocity = 0;
  792. /*=========================
  793. Locks, unlocks
  794. ===========================*/
  795. s.lockSwipeToNext = function () {
  796. s.params.allowSwipeToNext = false;
  797. if (s.params.allowSwipeToPrev === false && s.params.grabCursor) {
  798. s.unsetGrabCursor();
  799. }
  800. };
  801. s.lockSwipeToPrev = function () {
  802. s.params.allowSwipeToPrev = false;
  803. if (s.params.allowSwipeToNext === false && s.params.grabCursor) {
  804. s.unsetGrabCursor();
  805. }
  806. };
  807. s.lockSwipes = function () {
  808. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
  809. if (s.params.grabCursor) s.unsetGrabCursor();
  810. };
  811. s.unlockSwipeToNext = function () {
  812. s.params.allowSwipeToNext = true;
  813. if (s.params.allowSwipeToPrev === true && s.params.grabCursor) {
  814. s.setGrabCursor();
  815. }
  816. };
  817. s.unlockSwipeToPrev = function () {
  818. s.params.allowSwipeToPrev = true;
  819. if (s.params.allowSwipeToNext === true && s.params.grabCursor) {
  820. s.setGrabCursor();
  821. }
  822. };
  823. s.unlockSwipes = function () {
  824. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
  825. if (s.params.grabCursor) s.setGrabCursor();
  826. };
  827. /*=========================
  828. Round helper
  829. ===========================*/
  830. function round(a) {
  831. return Math.floor(a);
  832. }
  833. /*=========================
  834. Set grab cursor
  835. ===========================*/
  836. s.setGrabCursor = function (moving) {
  837. s.container[0].style.cursor = 'move';
  838. s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
  839. s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
  840. s.container[0].style.cursor = moving ? 'grabbing' : 'grab';
  841. };
  842. s.unsetGrabCursor = function () {
  843. s.container[0].style.cursor = '';
  844. };
  845. if (s.params.grabCursor) {
  846. s.setGrabCursor();
  847. }
  848. /*=========================
  849. Update on Images Ready
  850. ===========================*/
  851. s.imagesToLoad = [];
  852. s.imagesLoaded = 0;
  853. s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) {
  854. var image;
  855. function onReady() {
  856. if (callback) callback();
  857. }
  858. if (!imgElement.complete || !checkForComplete) {
  859. if (src) {
  860. image = new window.Image();
  861. image.onload = onReady;
  862. image.onerror = onReady;
  863. if (sizes) {
  864. image.sizes = sizes;
  865. }
  866. if (srcset) {
  867. image.srcset = srcset;
  868. }
  869. if (src) {
  870. image.src = src;
  871. }
  872. } else {
  873. onReady();
  874. }
  875. } else {
  876. //image already loaded...
  877. onReady();
  878. }
  879. };
  880. s.preloadImages = function () {
  881. s.imagesToLoad = s.container.find('img');
  882. function _onReady() {
  883. if (typeof s === 'undefined' || s === null || !s) return;
  884. if (s.imagesLoaded !== undefined) s.imagesLoaded++;
  885. if (s.imagesLoaded === s.imagesToLoad.length) {
  886. if (s.params.updateOnImagesReady) s.update();
  887. s.emit('onImagesReady', s);
  888. }
  889. }
  890. for (var i = 0; i < s.imagesToLoad.length; i++) {
  891. s.loadImage(s.imagesToLoad[i], s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src'), s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset'), s.imagesToLoad[i].sizes || s.imagesToLoad[i].getAttribute('sizes'), true, _onReady);
  892. }
  893. };
  894. /*=========================
  895. Autoplay
  896. ===========================*/
  897. s.autoplayTimeoutId = undefined;
  898. s.autoplaying = false;
  899. s.autoplayPaused = false;
  900. function autoplay() {
  901. var autoplayDelay = s.params.autoplay;
  902. var activeSlide = s.slides.eq(s.activeIndex);
  903. if (activeSlide.attr('data-swiper-autoplay')) {
  904. autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay;
  905. }
  906. s.autoplayTimeoutId = setTimeout(function () {
  907. if (s.params.loop) {
  908. s.fixLoop();
  909. s._slideNext();
  910. s.emit('onAutoplay', s);
  911. } else {
  912. if (!s.isEnd) {
  913. s._slideNext();
  914. s.emit('onAutoplay', s);
  915. } else {
  916. if (!params.autoplayStopOnLast) {
  917. s._slideTo(0);
  918. s.emit('onAutoplay', s);
  919. } else {
  920. s.stopAutoplay();
  921. }
  922. }
  923. }
  924. }, autoplayDelay);
  925. }
  926. s.startAutoplay = function () {
  927. if (typeof s.autoplayTimeoutId !== 'undefined') return false;
  928. if (!s.params.autoplay) return false;
  929. if (s.autoplaying) return false;
  930. s.autoplaying = true;
  931. s.emit('onAutoplayStart', s);
  932. autoplay();
  933. };
  934. s.stopAutoplay = function (internal) {
  935. if (!s.autoplayTimeoutId) return;
  936. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  937. s.autoplaying = false;
  938. s.autoplayTimeoutId = undefined;
  939. s.emit('onAutoplayStop', s);
  940. };
  941. s.pauseAutoplay = function (speed) {
  942. if (s.autoplayPaused) return;
  943. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  944. s.autoplayPaused = true;
  945. if (speed === 0) {
  946. s.autoplayPaused = false;
  947. autoplay();
  948. } else {
  949. s.wrapper.transitionEnd(function () {
  950. if (!s) return;
  951. s.autoplayPaused = false;
  952. if (!s.autoplaying) {
  953. s.stopAutoplay();
  954. } else {
  955. autoplay();
  956. }
  957. });
  958. }
  959. };
  960. /*=========================
  961. Min/Max Translate
  962. ===========================*/
  963. s.minTranslate = function () {
  964. return -s.snapGrid[0];
  965. };
  966. s.maxTranslate = function () {
  967. return -s.snapGrid[s.snapGrid.length - 1];
  968. };
  969. /*=========================
  970. Slider/slides sizes
  971. ===========================*/
  972. s.updateAutoHeight = function () {
  973. var activeSlides = [];
  974. var newHeight = 0;
  975. var i;
  976. // Find slides currently in view
  977. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) {
  978. for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) {
  979. var index = s.activeIndex + i;
  980. if (index > s.slides.length) break;
  981. activeSlides.push(s.slides.eq(index)[0]);
  982. }
  983. } else {
  984. activeSlides.push(s.slides.eq(s.activeIndex)[0]);
  985. }
  986. // Find new height from heighest slide in view
  987. for (i = 0; i < activeSlides.length; i++) {
  988. if (typeof activeSlides[i] !== 'undefined') {
  989. var height = activeSlides[i].offsetHeight;
  990. newHeight = height > newHeight ? height : newHeight;
  991. }
  992. }
  993. // Update Height
  994. if (newHeight) s.wrapper.css('height', newHeight + 'px');
  995. };
  996. s.updateContainerSize = function () {
  997. var width, height;
  998. if (typeof s.params.width !== 'undefined') {
  999. width = s.params.width;
  1000. } else {
  1001. width = s.container[0].clientWidth;
  1002. }
  1003. if (typeof s.params.height !== 'undefined') {
  1004. height = s.params.height;
  1005. } else {
  1006. height = s.container[0].clientHeight;
  1007. }
  1008. if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {
  1009. return;
  1010. }
  1011. //Subtract paddings
  1012. width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
  1013. height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
  1014. // Store values
  1015. s.width = width;
  1016. s.height = height;
  1017. s.size = s.isHorizontal() ? s.width : s.height;
  1018. };
  1019. s.updateSlidesSize = function () {
  1020. s.slides = s.wrapper.children('.' + s.params.slideClass);
  1021. s.snapGrid = [];
  1022. s.slidesGrid = [];
  1023. s.slidesSizesGrid = [];
  1024. var spaceBetween = s.params.spaceBetween,
  1025. slidePosition = -s.params.slidesOffsetBefore,
  1026. i,
  1027. prevSlideSize = 0,
  1028. index = 0;
  1029. if (typeof s.size === 'undefined') return;
  1030. if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
  1031. spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
  1032. }
  1033. s.virtualSize = -spaceBetween;
  1034. // reset margins
  1035. if (s.rtl) s.slides.css({ marginLeft: '', marginTop: '' });else s.slides.css({ marginRight: '', marginBottom: '' });
  1036. var slidesNumberEvenToRows;
  1037. if (s.params.slidesPerColumn > 1) {
  1038. if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
  1039. slidesNumberEvenToRows = s.slides.length;
  1040. } else {
  1041. slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
  1042. }
  1043. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
  1044. slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
  1045. }
  1046. }
  1047. // Calc slides
  1048. var slideSize;
  1049. var slidesPerColumn = s.params.slidesPerColumn;
  1050. var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
  1051. var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
  1052. for (i = 0; i < s.slides.length; i++) {
  1053. slideSize = 0;
  1054. var slide = s.slides.eq(i);
  1055. if (s.params.slidesPerColumn > 1) {
  1056. // Set slides order
  1057. var newSlideOrderIndex;
  1058. var column, row;
  1059. if (s.params.slidesPerColumnFill === 'column') {
  1060. column = Math.floor(i / slidesPerColumn);
  1061. row = i - column * slidesPerColumn;
  1062. if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
  1063. if (++row >= slidesPerColumn) {
  1064. row = 0;
  1065. column++;
  1066. }
  1067. }
  1068. newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
  1069. slide.css({
  1070. '-webkit-box-ordinal-group': newSlideOrderIndex,
  1071. '-moz-box-ordinal-group': newSlideOrderIndex,
  1072. '-ms-flex-order': newSlideOrderIndex,
  1073. '-webkit-order': newSlideOrderIndex,
  1074. 'order': newSlideOrderIndex
  1075. });
  1076. } else {
  1077. row = Math.floor(i / slidesPerRow);
  1078. column = i - row * slidesPerRow;
  1079. }
  1080. slide.css('margin-' + (s.isHorizontal() ? 'top' : 'left'), row !== 0 && s.params.spaceBetween && s.params.spaceBetween + 'px').attr('data-swiper-column', column).attr('data-swiper-row', row);
  1081. }
  1082. if (slide.css('display') === 'none') continue;
  1083. if (s.params.slidesPerView === 'auto') {
  1084. slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
  1085. if (s.params.roundLengths) slideSize = round(slideSize);
  1086. } else {
  1087. slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
  1088. if (s.params.roundLengths) slideSize = round(slideSize);
  1089. if (s.isHorizontal()) {
  1090. s.slides[i].style.width = slideSize + 'px';
  1091. } else {
  1092. s.slides[i].style.height = slideSize + 'px';
  1093. }
  1094. }
  1095. s.slides[i].swiperSlideSize = slideSize;
  1096. s.slidesSizesGrid.push(slideSize);
  1097. if (s.params.centeredSlides) {
  1098. slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
  1099. if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1100. if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1101. if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
  1102. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1103. s.slidesGrid.push(slidePosition);
  1104. } else {
  1105. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1106. s.slidesGrid.push(slidePosition);
  1107. slidePosition = slidePosition + slideSize + spaceBetween;
  1108. }
  1109. s.virtualSize += slideSize + spaceBetween;
  1110. prevSlideSize = slideSize;
  1111. index++;
  1112. }
  1113. s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
  1114. var newSlidesGrid;
  1115. if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
  1116. s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });
  1117. }
  1118. if (!s.support.flexbox || s.params.setWrapperSize) {
  1119. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1120. }
  1121. if (s.params.slidesPerColumn > 1) {
  1122. s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
  1123. s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
  1124. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1125. if (s.params.centeredSlides) {
  1126. newSlidesGrid = [];
  1127. for (i = 0; i < s.snapGrid.length; i++) {
  1128. if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
  1129. }
  1130. s.snapGrid = newSlidesGrid;
  1131. }
  1132. }
  1133. // Remove last grid elements depending on width
  1134. if (!s.params.centeredSlides) {
  1135. newSlidesGrid = [];
  1136. for (i = 0; i < s.snapGrid.length; i++) {
  1137. if (s.snapGrid[i] <= s.virtualSize - s.size) {
  1138. newSlidesGrid.push(s.snapGrid[i]);
  1139. }
  1140. }
  1141. s.snapGrid = newSlidesGrid;
  1142. if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
  1143. s.snapGrid.push(s.virtualSize - s.size);
  1144. }
  1145. }
  1146. if (s.snapGrid.length === 0) s.snapGrid = [0];
  1147. if (s.params.spaceBetween !== 0) {
  1148. if (s.isHorizontal()) {
  1149. if (s.rtl) s.slides.css({ marginLeft: spaceBetween + 'px' });else s.slides.css({ marginRight: spaceBetween + 'px' });
  1150. } else s.slides.css({ marginBottom: spaceBetween + 'px' });
  1151. }
  1152. if (s.params.watchSlidesProgress) {
  1153. s.updateSlidesOffset();
  1154. }
  1155. };
  1156. s.updateSlidesOffset = function () {
  1157. for (var i = 0; i < s.slides.length; i++) {
  1158. s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
  1159. }
  1160. };
  1161. /*=========================
  1162. Dynamic Slides Per View
  1163. ===========================*/
  1164. s.currentSlidesPerView = function () {
  1165. var spv = 1,
  1166. i,
  1167. j;
  1168. if (s.params.centeredSlides) {
  1169. var size = s.slides[s.activeIndex].swiperSlideSize;
  1170. var breakLoop;
  1171. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1172. if (s.slides[i] && !breakLoop) {
  1173. size += s.slides[i].swiperSlideSize;
  1174. spv++;
  1175. if (size > s.size) breakLoop = true;
  1176. }
  1177. }
  1178. for (j = s.activeIndex - 1; j >= 0; j--) {
  1179. if (s.slides[j] && !breakLoop) {
  1180. size += s.slides[j].swiperSlideSize;
  1181. spv++;
  1182. if (size > s.size) breakLoop = true;
  1183. }
  1184. }
  1185. } else {
  1186. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1187. if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) {
  1188. spv++;
  1189. }
  1190. }
  1191. }
  1192. return spv;
  1193. };
  1194. /*=========================
  1195. Slider/slides progress
  1196. ===========================*/
  1197. s.updateSlidesProgress = function (translate) {
  1198. if (typeof translate === 'undefined') {
  1199. translate = s.translate || 0;
  1200. }
  1201. if (s.slides.length === 0) return;
  1202. if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
  1203. var offsetCenter = -translate;
  1204. if (s.rtl) offsetCenter = translate;
  1205. // Visible Slides
  1206. s.slides.removeClass(s.params.slideVisibleClass);
  1207. for (var i = 0; i < s.slides.length; i++) {
  1208. var slide = s.slides[i];
  1209. var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
  1210. if (s.params.watchSlidesVisibility) {
  1211. var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
  1212. var slideAfter = slideBefore + s.slidesSizesGrid[i];
  1213. var isVisible = slideBefore >= 0 && slideBefore < s.size || slideAfter > 0 && slideAfter <= s.size || slideBefore <= 0 && slideAfter >= s.size;
  1214. if (isVisible) {
  1215. s.slides.eq(i).addClass(s.params.slideVisibleClass);
  1216. }
  1217. }
  1218. slide.progress = s.rtl ? -slideProgress : slideProgress;
  1219. }
  1220. };
  1221. s.updateProgress = function (translate) {
  1222. if (typeof translate === 'undefined') {
  1223. translate = s.translate || 0;
  1224. }
  1225. var translatesDiff = s.maxTranslate() - s.minTranslate();
  1226. var wasBeginning = s.isBeginning;
  1227. var wasEnd = s.isEnd;
  1228. if (translatesDiff === 0) {
  1229. s.progress = 0;
  1230. s.isBeginning = s.isEnd = true;
  1231. } else {
  1232. s.progress = (translate - s.minTranslate()) / translatesDiff;
  1233. s.isBeginning = s.progress <= 0;
  1234. s.isEnd = s.progress >= 1;
  1235. }
  1236. if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
  1237. if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);
  1238. if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
  1239. s.emit('onProgress', s, s.progress);
  1240. };
  1241. s.updateActiveIndex = function () {
  1242. var translate = s.rtl ? s.translate : -s.translate;
  1243. var newActiveIndex, i, snapIndex;
  1244. for (i = 0; i < s.slidesGrid.length; i++) {
  1245. if (typeof s.slidesGrid[i + 1] !== 'undefined') {
  1246. if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
  1247. newActiveIndex = i;
  1248. } else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
  1249. newActiveIndex = i + 1;
  1250. }
  1251. } else {
  1252. if (translate >= s.slidesGrid[i]) {
  1253. newActiveIndex = i;
  1254. }
  1255. }
  1256. }
  1257. // Normalize slideIndex
  1258. if (s.params.normalizeSlideIndex) {
  1259. if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
  1260. }
  1261. // for (i = 0; i < s.slidesGrid.length; i++) {
  1262. // if (- translate >= s.slidesGrid[i]) {
  1263. // newActiveIndex = i;
  1264. // }
  1265. // }
  1266. snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
  1267. if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
  1268. if (newActiveIndex === s.activeIndex) {
  1269. return;
  1270. }
  1271. s.snapIndex = snapIndex;
  1272. s.previousIndex = s.activeIndex;
  1273. s.activeIndex = newActiveIndex;
  1274. s.updateClasses();
  1275. s.updateRealIndex();
  1276. };
  1277. s.updateRealIndex = function () {
  1278. s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10);
  1279. };
  1280. /*=========================
  1281. Classes
  1282. ===========================*/
  1283. s.updateClasses = function () {
  1284. s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass);
  1285. var activeSlide = s.slides.eq(s.activeIndex);
  1286. // Active classes
  1287. activeSlide.addClass(s.params.slideActiveClass);
  1288. if (params.loop) {
  1289. // Duplicate to all looped slides
  1290. if (activeSlide.hasClass(s.params.slideDuplicateClass)) {
  1291. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1292. } else {
  1293. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1294. }
  1295. }
  1296. // Next Slide
  1297. var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
  1298. if (s.params.loop && nextSlide.length === 0) {
  1299. nextSlide = s.slides.eq(0);
  1300. nextSlide.addClass(s.params.slideNextClass);
  1301. }
  1302. // Prev Slide
  1303. var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
  1304. if (s.params.loop && prevSlide.length === 0) {
  1305. prevSlide = s.slides.eq(-1);
  1306. prevSlide.addClass(s.params.slidePrevClass);
  1307. }
  1308. if (params.loop) {
  1309. // Duplicate to all looped slides
  1310. if (nextSlide.hasClass(s.params.slideDuplicateClass)) {
  1311. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1312. } else {
  1313. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1314. }
  1315. if (prevSlide.hasClass(s.params.slideDuplicateClass)) {
  1316. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1317. } else {
  1318. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1319. }
  1320. }
  1321. // Pagination
  1322. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1323. // Current/Total
  1324. var current,
  1325. total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1326. if (s.params.loop) {
  1327. current = Math.ceil((s.activeIndex - s.loopedSlides) / s.params.slidesPerGroup);
  1328. if (current > s.slides.length - 1 - s.loopedSlides * 2) {
  1329. current = current - (s.slides.length - s.loopedSlides * 2);
  1330. }
  1331. if (current > total - 1) current = current - total;
  1332. if (current < 0 && s.params.paginationType !== 'bullets') current = total + current;
  1333. } else {
  1334. if (typeof s.snapIndex !== 'undefined') {
  1335. current = s.snapIndex;
  1336. } else {
  1337. current = s.activeIndex || 0;
  1338. }
  1339. }
  1340. // Types
  1341. if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {
  1342. s.bullets.removeClass(s.params.bulletActiveClass);
  1343. if (s.paginationContainer.length > 1) {
  1344. s.bullets.each(function () {
  1345. if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass);
  1346. });
  1347. } else {
  1348. s.bullets.eq(current).addClass(s.params.bulletActiveClass);
  1349. }
  1350. }
  1351. if (s.params.paginationType === 'fraction') {
  1352. s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);
  1353. s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);
  1354. }
  1355. if (s.params.paginationType === 'progress') {
  1356. var scale = (current + 1) / total,
  1357. scaleX = scale,
  1358. scaleY = 1;
  1359. if (!s.isHorizontal()) {
  1360. scaleY = scale;
  1361. scaleX = 1;
  1362. }
  1363. s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);
  1364. }
  1365. if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
  1366. s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
  1367. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1368. }
  1369. }
  1370. // Next/active buttons
  1371. if (!s.params.loop) {
  1372. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1373. if (s.isBeginning) {
  1374. s.prevButton.addClass(s.params.buttonDisabledClass);
  1375. if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
  1376. } else {
  1377. s.prevButton.removeClass(s.params.buttonDisabledClass);
  1378. if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
  1379. }
  1380. }
  1381. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1382. if (s.isEnd) {
  1383. s.nextButton.addClass(s.params.buttonDisabledClass);
  1384. if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
  1385. } else {
  1386. s.nextButton.removeClass(s.params.buttonDisabledClass);
  1387. if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
  1388. }
  1389. }
  1390. }
  1391. };
  1392. /*=========================
  1393. Pagination
  1394. ===========================*/
  1395. s.updatePagination = function () {
  1396. if (!s.params.pagination) return;
  1397. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1398. var paginationHTML = '';
  1399. if (s.params.paginationType === 'bullets') {
  1400. var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1401. for (var i = 0; i < numberOfBullets; i++) {
  1402. if (s.params.paginationBulletRender) {
  1403. paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass);
  1404. } else {
  1405. paginationHTML += '<' + s.params.paginationElement + ' class="' + s.params.bulletClass + '"></' + s.params.paginationElement + '>';
  1406. }
  1407. }
  1408. s.paginationContainer.html(paginationHTML);
  1409. s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
  1410. if (s.params.paginationClickable && s.params.a11y && s.a11y) {
  1411. s.a11y.initPagination();
  1412. }
  1413. }
  1414. if (s.params.paginationType === 'fraction') {
  1415. if (s.params.paginationFractionRender) {
  1416. paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);
  1417. } else {
  1418. paginationHTML = '<span class="' + s.params.paginationCurrentClass + '"></span>' + ' / ' + '<span class="' + s.params.paginationTotalClass + '"></span>';
  1419. }
  1420. s.paginationContainer.html(paginationHTML);
  1421. }
  1422. if (s.params.paginationType === 'progress') {
  1423. if (s.params.paginationProgressRender) {
  1424. paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);
  1425. } else {
  1426. paginationHTML = '<span class="' + s.params.paginationProgressbarClass + '"></span>';
  1427. }
  1428. s.paginationContainer.html(paginationHTML);
  1429. }
  1430. if (s.params.paginationType !== 'custom') {
  1431. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1432. }
  1433. }
  1434. };
  1435. /*=========================
  1436. Common update method
  1437. ===========================*/
  1438. s.update = function (updateTranslate) {
  1439. if (!s) return;
  1440. s.updateContainerSize();
  1441. s.updateSlidesSize();
  1442. s.updateProgress();
  1443. s.updatePagination();
  1444. s.updateClasses();
  1445. if (s.params.scrollbar && s.scrollbar) {
  1446. s.scrollbar.set();
  1447. }
  1448. var newTranslate;
  1449. function forceSetTranslate() {
  1450. var translate = s.rtl ? -s.translate : s.translate;
  1451. newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1452. s.setWrapperTranslate(newTranslate);
  1453. s.updateActiveIndex();
  1454. s.updateClasses();
  1455. }
  1456. if (updateTranslate) {
  1457. var translated;
  1458. if (s.controller && s.controller.spline) {
  1459. s.controller.spline = undefined;
  1460. }
  1461. if (s.params.freeMode) {
  1462. forceSetTranslate();
  1463. if (s.params.autoHeight) {
  1464. s.updateAutoHeight();
  1465. }
  1466. } else {
  1467. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1468. translated = s.slideTo(s.slides.length - 1, 0, false, true);
  1469. } else {
  1470. translated = s.slideTo(s.activeIndex, 0, false, true);
  1471. }
  1472. if (!translated) {
  1473. forceSetTranslate();
  1474. }
  1475. }
  1476. } else if (s.params.autoHeight) {
  1477. s.updateAutoHeight();
  1478. }
  1479. };
  1480. /*=========================
  1481. Resize Handler
  1482. ===========================*/
  1483. s.onResize = function (forceUpdatePagination) {
  1484. if (s.params.onBeforeResize) s.params.onBeforeResize(s);
  1485. //Breakpoints
  1486. if (s.params.breakpoints) {
  1487. s.setBreakpoint();
  1488. }
  1489. // Disable locks on resize
  1490. var allowSwipeToPrev = s.params.allowSwipeToPrev;
  1491. var allowSwipeToNext = s.params.allowSwipeToNext;
  1492. s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
  1493. s.updateContainerSize();
  1494. s.updateSlidesSize();
  1495. if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();
  1496. if (s.params.scrollbar && s.scrollbar) {
  1497. s.scrollbar.set();
  1498. }
  1499. if (s.controller && s.controller.spline) {
  1500. s.controller.spline = undefined;
  1501. }
  1502. var slideChangedBySlideTo = false;
  1503. if (s.params.freeMode) {
  1504. var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1505. s.setWrapperTranslate(newTranslate);
  1506. s.updateActiveIndex();
  1507. s.updateClasses();
  1508. if (s.params.autoHeight) {
  1509. s.updateAutoHeight();
  1510. }
  1511. } else {
  1512. s.updateClasses();
  1513. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1514. slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
  1515. } else {
  1516. slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
  1517. }
  1518. }
  1519. if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
  1520. s.lazy.load();
  1521. }
  1522. // Return locks after resize
  1523. s.params.allowSwipeToPrev = allowSwipeToPrev;
  1524. s.params.allowSwipeToNext = allowSwipeToNext;
  1525. if (s.params.onAfterResize) s.params.onAfterResize(s);
  1526. };
  1527. /*=========================
  1528. Events
  1529. ===========================*/
  1530. //Define Touch Events
  1531. s.touchEventsDesktop = { start: 'mousedown', move: 'mousemove', end: 'mouseup' };
  1532. if (window.navigator.pointerEnabled) s.touchEventsDesktop = { start: 'pointerdown', move: 'pointermove', end: 'pointerup' };else if (window.navigator.msPointerEnabled) s.touchEventsDesktop = { start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp' };
  1533. s.touchEvents = {
  1534. start: s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start,
  1535. move: s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move,
  1536. end: s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end
  1537. };
  1538. // WP8 Touch Events Fix
  1539. if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
  1540. //console.log('1669', s.params.touchEventsTarget);
  1541. (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
  1542. }
  1543. // Attach/detach events
  1544. s.initEvents = function (detach) {
  1545. var actionDom = detach ? 'off' : 'on';
  1546. var action = detach ? 'removeEventListener' : 'addEventListener';
  1547. var touchEventsTarget = s.params.touchEventsTarget === 'lu-container' ? s.container[0] : s.wrapper[0];
  1548. var target = s.support.touch ? touchEventsTarget : document;
  1549. var moveCapture = s.params.nested ? true : false;
  1550. //Touch Events
  1551. if (s.browser.ie) {
  1552. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
  1553. target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1554. target[action](s.touchEvents.end, s.onTouchEnd, false);
  1555. } else {
  1556. if (s.support.touch) {
  1557. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  1558. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener);
  1559. touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1560. touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener);
  1561. }
  1562. if (params.simulateTouch && !s.device.ios && !s.device.android || params.simulateTouch && !s.support.touch && s.device.ios) {
  1563. touchEventsTarget[action]('mousedown', s.onTouchStart, false);
  1564. document[action]('mousemove', s.onTouchMove, moveCapture);
  1565. document[action]('mouseup', s.onTouchEnd, false);
  1566. }
  1567. }
  1568. window[action]('resize', s.onResize);
  1569. // Next, Prev, Index
  1570. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1571. s.nextButton[actionDom]('click', s.onClickNext);
  1572. if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
  1573. }
  1574. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1575. s.prevButton[actionDom]('click', s.onClickPrev);
  1576. if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
  1577. }
  1578. if (s.params.pagination && s.params.paginationClickable) {
  1579. s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
  1580. if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
  1581. }
  1582. // Prevent Links Clicks
  1583. if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
  1584. };
  1585. s.attachEvents = function () {
  1586. s.initEvents();
  1587. };
  1588. s.detachEvents = function () {
  1589. s.initEvents(true);
  1590. };
  1591. /*=========================
  1592. Handle Clicks
  1593. ===========================*/
  1594. // Prevent Clicks
  1595. s.allowClick = true;
  1596. s.preventClicks = function (e) {
  1597. if (!s.allowClick) {
  1598. if (s.params.preventClicks) e.preventDefault();
  1599. if (s.params.preventClicksPropagation && s.animating) {
  1600. e.stopPropagation();
  1601. e.stopImmediatePropagation();
  1602. }
  1603. }
  1604. };
  1605. // Clicks
  1606. s.onClickNext = function (e) {
  1607. e.preventDefault();
  1608. if (s.isEnd && !s.params.loop) return;
  1609. s.slideNext();
  1610. };
  1611. s.onClickPrev = function (e) {
  1612. e.preventDefault();
  1613. if (s.isBeginning && !s.params.loop) return;
  1614. s.slidePrev();
  1615. };
  1616. s.onClickIndex = function (e) {
  1617. e.preventDefault();
  1618. var index = $(this).index() * s.params.slidesPerGroup;
  1619. if (s.params.loop) index = index + s.loopedSlides;
  1620. s.slideTo(index);
  1621. };
  1622. /*=========================
  1623. Handle Touches
  1624. ===========================*/
  1625. function findElementInEvent(e, selector) {
  1626. var el = $(e.target);
  1627. if (!el.is(selector)) {
  1628. if (typeof selector === 'string') {
  1629. el = el.parents(selector);
  1630. } else if (selector.nodeType) {
  1631. var found;
  1632. el.parents().each(function (index, _el) {
  1633. if (_el === selector) found = selector;
  1634. });
  1635. if (!found) return undefined;else return selector;
  1636. }
  1637. }
  1638. if (el.length === 0) {
  1639. return undefined;
  1640. }
  1641. return el[0];
  1642. }
  1643. s.updateClickedSlide = function (e) {
  1644. var slide = findElementInEvent(e, '.' + s.params.slideClass);
  1645. var slideFound = false;
  1646. if (slide) {
  1647. for (var i = 0; i < s.slides.length; i++) {
  1648. if (s.slides[i] === slide) slideFound = true;
  1649. }
  1650. }
  1651. if (slide && slideFound) {
  1652. s.clickedSlide = slide;
  1653. s.clickedIndex = $(slide).index();
  1654. } else {
  1655. s.clickedSlide = undefined;
  1656. s.clickedIndex = undefined;
  1657. return;
  1658. }
  1659. if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
  1660. var slideToIndex = s.clickedIndex,
  1661. realIndex,
  1662. duplicatedSlides,
  1663. slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView;
  1664. if (s.params.loop) {
  1665. if (s.animating) return;
  1666. realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);
  1667. if (s.params.centeredSlides) {
  1668. if (slideToIndex < s.loopedSlides - slidesPerView / 2 || slideToIndex > s.slides.length - s.loopedSlides + slidesPerView / 2) {
  1669. s.fixLoop();
  1670. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1671. setTimeout(function () {
  1672. s.slideTo(slideToIndex);
  1673. }, 0);
  1674. } else {
  1675. s.slideTo(slideToIndex);
  1676. }
  1677. } else {
  1678. if (slideToIndex > s.slides.length - slidesPerView) {
  1679. s.fixLoop();
  1680. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1681. setTimeout(function () {
  1682. s.slideTo(slideToIndex);
  1683. }, 0);
  1684. } else {
  1685. s.slideTo(slideToIndex);
  1686. }
  1687. }
  1688. } else {
  1689. s.slideTo(slideToIndex);
  1690. }
  1691. }
  1692. };
  1693. var isTouched,
  1694. isMoved,
  1695. allowTouchCallbacks,
  1696. touchStartTime,
  1697. isScrolling,
  1698. currentTranslate,
  1699. startTranslate,
  1700. allowThresholdMove,
  1701. // Form elements to match
  1702. formElements = 'input, select, textarea, button, video',
  1703. // Last click time
  1704. lastClickTime = Date.now(),
  1705. clickTimeout,
  1706. //Velocities
  1707. velocities = [],
  1708. allowMomentumBounce;
  1709. // Animating Flag
  1710. s.animating = false;
  1711. // Touches information
  1712. s.touches = {
  1713. startX: 0,
  1714. startY: 0,
  1715. currentX: 0,
  1716. currentY: 0,
  1717. diff: 0
  1718. };
  1719. // Touch handlers
  1720. var isTouchEvent, startMoving;
  1721. s.onTouchStart = function (e) {
  1722. if (e.originalEvent) e = e.originalEvent;
  1723. isTouchEvent = e.type === 'touchstart';
  1724. if (!isTouchEvent && 'which' in e && e.which === 3) return;
  1725. if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
  1726. s.allowClick = true;
  1727. return;
  1728. }
  1729. if (s.params.swipeHandler) {
  1730. if (!findElementInEvent(e, s.params.swipeHandler)) return;
  1731. }
  1732. var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  1733. var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  1734. // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
  1735. if (s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
  1736. return;
  1737. }
  1738. isTouched = true;
  1739. isMoved = false;
  1740. allowTouchCallbacks = true;
  1741. isScrolling = undefined;
  1742. startMoving = undefined;
  1743. s.touches.startX = startX;
  1744. s.touches.startY = startY;
  1745. touchStartTime = Date.now();
  1746. s.allowClick = true;
  1747. s.updateContainerSize();
  1748. s.swipeDirection = undefined;
  1749. if (s.params.threshold > 0) allowThresholdMove = false;
  1750. if (e.type !== 'touchstart') {
  1751. var preventDefault = true;
  1752. if ($(e.target).is(formElements)) preventDefault = false;
  1753. if (document.activeElement && $(document.activeElement).is(formElements)) {
  1754. document.activeElement.blur();
  1755. }
  1756. if (preventDefault) {
  1757. e.preventDefault();
  1758. }
  1759. }
  1760. s.emit('onTouchStart', s, e);
  1761. };
  1762. s.onTouchMove = function (e) {
  1763. if (e.originalEvent) e = e.originalEvent;
  1764. if (isTouchEvent && e.type === 'mousemove') return;
  1765. if (e.preventedByNestedSwiper) {
  1766. s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1767. s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1768. return;
  1769. }
  1770. if (s.params.onlyExternal) {
  1771. // isMoved = true;
  1772. s.allowClick = false;
  1773. if (isTouched) {
  1774. s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1775. s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1776. touchStartTime = Date.now();
  1777. }
  1778. return;
  1779. }
  1780. if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) {
  1781. if (!s.isHorizontal()) {
  1782. // Vertical
  1783. if (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate() || s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate()) {
  1784. return;
  1785. }
  1786. } else {
  1787. if (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate() || s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate()) {
  1788. return;
  1789. }
  1790. }
  1791. }
  1792. if (isTouchEvent && document.activeElement) {
  1793. if (e.target === document.activeElement && $(e.target).is(formElements)) {
  1794. isMoved = true;
  1795. s.allowClick = false;
  1796. return;
  1797. }
  1798. }
  1799. if (allowTouchCallbacks) {
  1800. s.emit('onTouchMove', s, e);
  1801. }
  1802. if (e.targetTouches && e.targetTouches.length > 1) return;
  1803. s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1804. s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1805. if (typeof isScrolling === 'undefined') {
  1806. var touchAngle;
  1807. if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) {
  1808. isScrolling = false;
  1809. } else {
  1810. touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
  1811. isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : 90 - touchAngle > s.params.touchAngle;
  1812. }
  1813. }
  1814. if (isScrolling) {
  1815. s.emit('onTouchMoveOpposite', s, e);
  1816. }
  1817. if (typeof startMoving === 'undefined') {
  1818. if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
  1819. startMoving = true;
  1820. }
  1821. }
  1822. if (!isTouched) return;
  1823. if (isScrolling) {
  1824. isTouched = false;
  1825. return;
  1826. }
  1827. if (!startMoving) {
  1828. return;
  1829. }
  1830. s.allowClick = false;
  1831. s.emit('onSliderMove', s, e);
  1832. e.preventDefault();
  1833. if (s.params.touchMoveStopPropagation && !s.params.nested) {
  1834. e.stopPropagation();
  1835. }
  1836. if (!isMoved) {
  1837. if (params.loop) {
  1838. s.fixLoop();
  1839. }
  1840. startTranslate = s.getWrapperTranslate();
  1841. s.setWrapperTransition(0);
  1842. if (s.animating) {
  1843. s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
  1844. }
  1845. if (s.params.autoplay && s.autoplaying) {
  1846. if (s.params.autoplayDisableOnInteraction) {
  1847. s.stopAutoplay();
  1848. } else {
  1849. s.pauseAutoplay();
  1850. }
  1851. }
  1852. allowMomentumBounce = false;
  1853. //Grab Cursor
  1854. if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1855. s.setGrabCursor(true);
  1856. }
  1857. }
  1858. isMoved = true;
  1859. var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1860. diff = diff * s.params.touchRatio;
  1861. if (s.rtl) diff = -diff;
  1862. s.swipeDirection = diff > 0 ? 'prev' : 'next';
  1863. currentTranslate = diff + startTranslate;
  1864. var disableParentSwiper = true;
  1865. if (diff > 0 && currentTranslate > s.minTranslate()) {
  1866. disableParentSwiper = false;
  1867. if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
  1868. } else if (diff < 0 && currentTranslate < s.maxTranslate()) {
  1869. disableParentSwiper = false;
  1870. if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
  1871. }
  1872. if (disableParentSwiper) {
  1873. e.preventedByNestedSwiper = true;
  1874. }
  1875. // Directions locks
  1876. if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
  1877. currentTranslate = startTranslate;
  1878. }
  1879. if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
  1880. currentTranslate = startTranslate;
  1881. }
  1882. // Threshold
  1883. if (s.params.threshold > 0) {
  1884. if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
  1885. if (!allowThresholdMove) {
  1886. allowThresholdMove = true;
  1887. s.touches.startX = s.touches.currentX;
  1888. s.touches.startY = s.touches.currentY;
  1889. currentTranslate = startTranslate;
  1890. s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1891. return;
  1892. }
  1893. } else {
  1894. currentTranslate = startTranslate;
  1895. return;
  1896. }
  1897. }
  1898. if (!s.params.followFinger) return;
  1899. // Update active index in free mode
  1900. if (s.params.freeMode || s.params.watchSlidesProgress) {
  1901. s.updateActiveIndex();
  1902. }
  1903. if (s.params.freeMode) {
  1904. //Velocity
  1905. if (velocities.length === 0) {
  1906. velocities.push({
  1907. position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],
  1908. time: touchStartTime
  1909. });
  1910. }
  1911. velocities.push({
  1912. position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],
  1913. time: new window.Date().getTime()
  1914. });
  1915. }
  1916. // Update progress
  1917. s.updateProgress(currentTranslate);
  1918. // Update translate
  1919. s.setWrapperTranslate(currentTranslate);
  1920. };
  1921. s.onTouchEnd = function (e) {
  1922. if (e.originalEvent) e = e.originalEvent;
  1923. if (allowTouchCallbacks) {
  1924. s.emit('onTouchEnd', s, e);
  1925. }
  1926. allowTouchCallbacks = false;
  1927. if (!isTouched) return;
  1928. //Return Grab Cursor
  1929. if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1930. s.setGrabCursor(false);
  1931. }
  1932. // Time diff
  1933. var touchEndTime = Date.now();
  1934. var timeDiff = touchEndTime - touchStartTime;
  1935. // Tap, doubleTap, Click
  1936. if (s.allowClick) {
  1937. s.updateClickedSlide(e);
  1938. s.emit('onTap', s, e);
  1939. if (timeDiff < 300 && touchEndTime - lastClickTime > 300) {
  1940. if (clickTimeout) clearTimeout(clickTimeout);
  1941. clickTimeout = setTimeout(function () {
  1942. if (!s) return;
  1943. if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
  1944. s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
  1945. }
  1946. s.emit('onClick', s, e);
  1947. }, 300);
  1948. }
  1949. if (timeDiff < 300 && touchEndTime - lastClickTime < 300) {
  1950. if (clickTimeout) clearTimeout(clickTimeout);
  1951. s.emit('onDoubleTap', s, e);
  1952. }
  1953. }
  1954. lastClickTime = Date.now();
  1955. setTimeout(function () {
  1956. if (s) s.allowClick = true;
  1957. }, 0);
  1958. if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
  1959. isTouched = isMoved = false;
  1960. return;
  1961. }
  1962. isTouched = isMoved = false;
  1963. var currentPos;
  1964. if (s.params.followFinger) {
  1965. currentPos = s.rtl ? s.translate : -s.translate;
  1966. } else {
  1967. currentPos = -currentTranslate;
  1968. }
  1969. if (s.params.freeMode) {
  1970. if (currentPos < -s.minTranslate()) {
  1971. s.slideTo(s.activeIndex);
  1972. return;
  1973. } else if (currentPos > -s.maxTranslate()) {
  1974. if (s.slides.length < s.snapGrid.length) {
  1975. s.slideTo(s.snapGrid.length - 1);
  1976. } else {
  1977. s.slideTo(s.slides.length - 1);
  1978. }
  1979. return;
  1980. }
  1981. if (s.params.freeModeMomentum) {
  1982. if (velocities.length > 1) {
  1983. var lastMoveEvent = velocities.pop(),
  1984. velocityEvent = velocities.pop();
  1985. var distance = lastMoveEvent.position - velocityEvent.position;
  1986. var time = lastMoveEvent.time - velocityEvent.time;
  1987. s.velocity = distance / time;
  1988. s.velocity = s.velocity / 2;
  1989. if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
  1990. s.velocity = 0;
  1991. }
  1992. // this implies that the user stopped moving a finger then released.
  1993. // There would be no events with distance zero, so the last event is stale.
  1994. if (time > 150 || new window.Date().getTime() - lastMoveEvent.time > 300) {
  1995. s.velocity = 0;
  1996. }
  1997. } else {
  1998. s.velocity = 0;
  1999. }
  2000. s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio;
  2001. velocities.length = 0;
  2002. var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
  2003. var momentumDistance = s.velocity * momentumDuration;
  2004. var newPosition = s.translate + momentumDistance;
  2005. if (s.rtl) newPosition = -newPosition;
  2006. var doBounce = false;
  2007. var afterBouncePosition;
  2008. var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
  2009. if (newPosition < s.maxTranslate()) {
  2010. if (s.params.freeModeMomentumBounce) {
  2011. if (newPosition + s.maxTranslate() < -bounceAmount) {
  2012. newPosition = s.maxTranslate() - bounceAmount;
  2013. }
  2014. afterBouncePosition = s.maxTranslate();
  2015. doBounce = true;
  2016. allowMomentumBounce = true;
  2017. } else {
  2018. newPosition = s.maxTranslate();
  2019. }
  2020. } else if (newPosition > s.minTranslate()) {
  2021. if (s.params.freeModeMomentumBounce) {
  2022. if (newPosition - s.minTranslate() > bounceAmount) {
  2023. newPosition = s.minTranslate() + bounceAmount;
  2024. }
  2025. afterBouncePosition = s.minTranslate();
  2026. doBounce = true;
  2027. allowMomentumBounce = true;
  2028. } else {
  2029. newPosition = s.minTranslate();
  2030. }
  2031. } else if (s.params.freeModeSticky) {
  2032. var j = 0,
  2033. nextSlide;
  2034. for (j = 0; j < s.snapGrid.length; j += 1) {
  2035. if (s.snapGrid[j] > -newPosition) {
  2036. nextSlide = j;
  2037. break;
  2038. }
  2039. }
  2040. if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
  2041. newPosition = s.snapGrid[nextSlide];
  2042. } else {
  2043. newPosition = s.snapGrid[nextSlide - 1];
  2044. }
  2045. if (!s.rtl) newPosition = -newPosition;
  2046. }
  2047. //Fix duration
  2048. if (s.velocity !== 0) {
  2049. if (s.rtl) {
  2050. momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
  2051. } else {
  2052. momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
  2053. }
  2054. } else if (s.params.freeModeSticky) {
  2055. s.slideReset();
  2056. return;
  2057. }
  2058. if (s.params.freeModeMomentumBounce && doBounce) {
  2059. s.updateProgress(afterBouncePosition);
  2060. s.setWrapperTransition(momentumDuration);
  2061. s.setWrapperTranslate(newPosition);
  2062. s.onTransitionStart();
  2063. s.animating = true;
  2064. s.wrapper.transitionEnd(function () {
  2065. if (!s || !allowMomentumBounce) return;
  2066. s.emit('onMomentumBounce', s);
  2067. s.setWrapperTransition(s.params.speed);
  2068. s.setWrapperTranslate(afterBouncePosition);
  2069. s.wrapper.transitionEnd(function () {
  2070. if (!s) return;
  2071. s.onTransitionEnd();
  2072. });
  2073. });
  2074. } else if (s.velocity) {
  2075. s.updateProgress(newPosition);
  2076. s.setWrapperTransition(momentumDuration);
  2077. s.setWrapperTranslate(newPosition);
  2078. s.onTransitionStart();
  2079. if (!s.animating) {
  2080. s.animating = true;
  2081. s.wrapper.transitionEnd(function () {
  2082. if (!s) return;
  2083. s.onTransitionEnd();
  2084. });
  2085. }
  2086. } else {
  2087. s.updateProgress(newPosition);
  2088. }
  2089. s.updateActiveIndex();
  2090. }
  2091. if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
  2092. s.updateProgress();
  2093. s.updateActiveIndex();
  2094. }
  2095. return;
  2096. }
  2097. // Find current slide
  2098. var i,
  2099. stopIndex = 0,
  2100. groupSize = s.slidesSizesGrid[0];
  2101. for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
  2102. if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
  2103. if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
  2104. stopIndex = i;
  2105. groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
  2106. }
  2107. } else {
  2108. if (currentPos >= s.slidesGrid[i]) {
  2109. stopIndex = i;
  2110. groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
  2111. }
  2112. }
  2113. }
  2114. // Find current slide size
  2115. var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
  2116. if (timeDiff > s.params.longSwipesMs) {
  2117. // Long touches
  2118. if (!s.params.longSwipes) {
  2119. s.slideTo(s.activeIndex);
  2120. return;
  2121. }
  2122. if (s.swipeDirection === 'next') {
  2123. if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2124. }
  2125. if (s.swipeDirection === 'prev') {
  2126. if (ratio > 1 - s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2127. }
  2128. } else {
  2129. // Short swipes
  2130. if (!s.params.shortSwipes) {
  2131. s.slideTo(s.activeIndex);
  2132. return;
  2133. }
  2134. if (s.swipeDirection === 'next') {
  2135. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2136. }
  2137. if (s.swipeDirection === 'prev') {
  2138. s.slideTo(stopIndex);
  2139. }
  2140. }
  2141. };
  2142. /*=========================
  2143. Transitions
  2144. ===========================*/
  2145. s._slideTo = function (slideIndex, speed) {
  2146. return s.slideTo(slideIndex, speed, true, true);
  2147. };
  2148. s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
  2149. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2150. if (typeof slideIndex === 'undefined') slideIndex = 0;
  2151. if (slideIndex < 0) slideIndex = 0;
  2152. s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
  2153. if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
  2154. var translate = -s.snapGrid[s.snapIndex];
  2155. // Stop autoplay
  2156. if (s.params.autoplay && s.autoplaying) {
  2157. if (internal || !s.params.autoplayDisableOnInteraction) {
  2158. s.pauseAutoplay(speed);
  2159. } else {
  2160. s.stopAutoplay();
  2161. }
  2162. }
  2163. // Update progress
  2164. s.updateProgress(translate);
  2165. // Normalize slideIndex
  2166. if (s.params.normalizeSlideIndex) {
  2167. for (var i = 0; i < s.slidesGrid.length; i++) {
  2168. if (-Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
  2169. slideIndex = i;
  2170. }
  2171. }
  2172. }
  2173. // Directions locks
  2174. if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
  2175. return false;
  2176. }
  2177. if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
  2178. if ((s.activeIndex || 0) !== slideIndex) return false;
  2179. }
  2180. // Update Index
  2181. if (typeof speed === 'undefined') speed = s.params.speed;
  2182. s.previousIndex = s.activeIndex || 0;
  2183. s.activeIndex = slideIndex;
  2184. s.updateRealIndex();
  2185. if (s.rtl && -translate === s.translate || !s.rtl && translate === s.translate) {
  2186. // Update Height
  2187. if (s.params.autoHeight) {
  2188. s.updateAutoHeight();
  2189. }
  2190. s.updateClasses();
  2191. if (s.params.effect !== 'slide') {
  2192. s.setWrapperTranslate(translate);
  2193. }
  2194. return false;
  2195. }
  2196. s.updateClasses();
  2197. s.onTransitionStart(runCallbacks);
  2198. if (speed === 0 || s.browser.lteIE9) {
  2199. s.setWrapperTranslate(translate);
  2200. s.setWrapperTransition(0);
  2201. s.onTransitionEnd(runCallbacks);
  2202. } else {
  2203. s.setWrapperTranslate(translate);
  2204. s.setWrapperTransition(speed);
  2205. if (!s.animating) {
  2206. s.animating = true;
  2207. s.wrapper.transitionEnd(function () {
  2208. if (!s) return;
  2209. s.onTransitionEnd(runCallbacks);
  2210. });
  2211. }
  2212. }
  2213. return true;
  2214. };
  2215. s.onTransitionStart = function (runCallbacks) {
  2216. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2217. if (s.params.autoHeight) {
  2218. s.updateAutoHeight();
  2219. }
  2220. if (s.lazy) s.lazy.onTransitionStart();
  2221. if (runCallbacks) {
  2222. s.emit('onTransitionStart', s);
  2223. if (s.activeIndex !== s.previousIndex) {
  2224. s.emit('onSlideChangeStart', s);
  2225. if (s.activeIndex > s.previousIndex) {
  2226. s.emit('onSlideNextStart', s);
  2227. } else {
  2228. s.emit('onSlidePrevStart', s);
  2229. }
  2230. }
  2231. }
  2232. };
  2233. s.onTransitionEnd = function (runCallbacks) {
  2234. s.animating = false;
  2235. s.setWrapperTransition(0);
  2236. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2237. if (s.lazy) s.lazy.onTransitionEnd();
  2238. if (runCallbacks) {
  2239. s.emit('onTransitionEnd', s);
  2240. if (s.activeIndex !== s.previousIndex) {
  2241. s.emit('onSlideChangeEnd', s);
  2242. if (s.activeIndex > s.previousIndex) {
  2243. s.emit('onSlideNextEnd', s);
  2244. } else {
  2245. s.emit('onSlidePrevEnd', s);
  2246. }
  2247. }
  2248. }
  2249. if (s.params.history && s.history) {
  2250. s.history.setHistory(s.params.history, s.activeIndex);
  2251. }
  2252. if (s.params.hashnav && s.hashnav) {
  2253. s.hashnav.setHash();
  2254. }
  2255. };
  2256. s.slideNext = function (runCallbacks, speed, internal) {
  2257. if (s.params.loop) {
  2258. if (s.animating) return false;
  2259. s.fixLoop();
  2260. var clientLeft = s.container[0].clientLeft;
  2261. return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2262. } else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2263. };
  2264. s._slideNext = function (speed) {
  2265. return s.slideNext(true, speed, true);
  2266. };
  2267. s.slidePrev = function (runCallbacks, speed, internal) {
  2268. if (s.params.loop) {
  2269. if (s.animating) return false;
  2270. s.fixLoop();
  2271. var clientLeft = s.container[0].clientLeft;
  2272. return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2273. } else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2274. };
  2275. s._slidePrev = function (speed) {
  2276. return s.slidePrev(true, speed, true);
  2277. };
  2278. s.slideReset = function (runCallbacks, speed, internal) {
  2279. return s.slideTo(s.activeIndex, speed, runCallbacks);
  2280. };
  2281. s.disableTouchControl = function () {
  2282. s.params.onlyExternal = true;
  2283. return true;
  2284. };
  2285. s.enableTouchControl = function () {
  2286. s.params.onlyExternal = false;
  2287. return true;
  2288. };
  2289. /*=========================
  2290. Translate/transition helpers
  2291. ===========================*/
  2292. s.setWrapperTransition = function (duration, byController) {
  2293. s.wrapper.transition(duration);
  2294. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2295. s.effects[s.params.effect].setTransition(duration);
  2296. }
  2297. if (s.params.parallax && s.parallax) {
  2298. s.parallax.setTransition(duration);
  2299. }
  2300. if (s.params.scrollbar && s.scrollbar) {
  2301. s.scrollbar.setTransition(duration);
  2302. }
  2303. if (s.params.control && s.controller) {
  2304. s.controller.setTransition(duration, byController);
  2305. }
  2306. s.emit('onSetTransition', s, duration);
  2307. };
  2308. s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
  2309. var x = 0,
  2310. y = 0,
  2311. z = 0;
  2312. if (s.isHorizontal()) {
  2313. x = s.rtl ? -translate : translate;
  2314. } else {
  2315. y = translate;
  2316. }
  2317. if (s.params.roundLengths) {
  2318. x = round(x);
  2319. y = round(y);
  2320. }
  2321. if (!s.params.virtualTranslate) {
  2322. if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
  2323. }
  2324. s.translate = s.isHorizontal() ? x : y;
  2325. // Check if we need to update progress
  2326. var progress;
  2327. var translatesDiff = s.maxTranslate() - s.minTranslate();
  2328. if (translatesDiff === 0) {
  2329. progress = 0;
  2330. } else {
  2331. progress = (translate - s.minTranslate()) / translatesDiff;
  2332. }
  2333. if (progress !== s.progress) {
  2334. s.updateProgress(translate);
  2335. }
  2336. if (updateActiveIndex) s.updateActiveIndex();
  2337. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2338. s.effects[s.params.effect].setTranslate(s.translate);
  2339. }
  2340. if (s.params.parallax && s.parallax) {
  2341. s.parallax.setTranslate(s.translate);
  2342. }
  2343. if (s.params.scrollbar && s.scrollbar) {
  2344. s.scrollbar.setTranslate(s.translate);
  2345. }
  2346. if (s.params.control && s.controller) {
  2347. s.controller.setTranslate(s.translate, byController);
  2348. }
  2349. s.emit('onSetTranslate', s, s.translate);
  2350. };
  2351. s.getTranslate = function (el, axis) {
  2352. var matrix, curTransform, curStyle, transformMatrix;
  2353. // automatic axis detection
  2354. if (typeof axis === 'undefined') {
  2355. axis = 'x';
  2356. }
  2357. if (s.params.virtualTranslate) {
  2358. return s.rtl ? -s.translate : s.translate;
  2359. }
  2360. //console.log(el)
  2361. curStyle = window.getComputedStyle(el, null);
  2362. if (window.WebKitCSSMatrix) {
  2363. curTransform = curStyle.transform || curStyle.webkitTransform;
  2364. if (curTransform.split(',').length > 6) {
  2365. curTransform = curTransform.split(', ').map(function (a) {
  2366. return a.replace(',', '.');
  2367. }).join(', ');
  2368. }
  2369. // Some old versions of Webkit choke when 'none' is passed; pass
  2370. // empty string instead in this case
  2371. transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
  2372. } else {
  2373. transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
  2374. matrix = transformMatrix.toString().split(',');
  2375. }
  2376. if (axis === 'x') {
  2377. //Latest Chrome and webkits Fix
  2378. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
  2379. //Crazy IE10 Matrix
  2380. else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
  2381. //Normal Browsers
  2382. else curTransform = parseFloat(matrix[4]);
  2383. }
  2384. if (axis === 'y') {
  2385. //Latest Chrome and webkits Fix
  2386. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
  2387. //Crazy IE10 Matrix
  2388. else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
  2389. //Normal Browsers
  2390. else curTransform = parseFloat(matrix[5]);
  2391. }
  2392. if (s.rtl && curTransform) curTransform = -curTransform;
  2393. return curTransform || 0;
  2394. };
  2395. s.getWrapperTranslate = function (axis) {
  2396. if (typeof axis === 'undefined') {
  2397. axis = s.isHorizontal() ? 'x' : 'y';
  2398. }
  2399. return s.getTranslate(s.wrapper[0], axis);
  2400. };
  2401. /*=========================
  2402. Observer
  2403. ===========================*/
  2404. s.observers = [];
  2405. function initObserver(target, options) {
  2406. options = options || {};
  2407. // create an observer instance
  2408. var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
  2409. var observer = new ObserverFunc(function (mutations) {
  2410. mutations.forEach(function (mutation) {
  2411. s.onResize(true);
  2412. s.emit('onObserverUpdate', s, mutation);
  2413. });
  2414. });
  2415. observer.observe(target, {
  2416. attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
  2417. childList: typeof options.childList === 'undefined' ? true : options.childList,
  2418. characterData: typeof options.characterData === 'undefined' ? true : options.characterData
  2419. });
  2420. s.observers.push(observer);
  2421. }
  2422. s.initObservers = function () {
  2423. if (s.params.observeParents) {
  2424. var containerParents = s.container.parents();
  2425. for (var i = 0; i < containerParents.length; i++) {
  2426. initObserver(containerParents[i]);
  2427. }
  2428. }
  2429. // Observe container
  2430. initObserver(s.container[0], { childList: false });
  2431. // Observe wrapper
  2432. initObserver(s.wrapper[0], { attributes: false });
  2433. };
  2434. s.disconnectObservers = function () {
  2435. for (var i = 0; i < s.observers.length; i++) {
  2436. s.observers[i].disconnect();
  2437. }
  2438. s.observers = [];
  2439. };
  2440. /*=========================
  2441. Loop
  2442. ===========================*/
  2443. // Create looped slides
  2444. s.createLoop = function () {
  2445. // Remove duplicated slides
  2446. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2447. var slides = s.wrapper.children('.' + s.params.slideClass);
  2448. if (s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;
  2449. s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
  2450. s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
  2451. if (s.loopedSlides > slides.length) {
  2452. s.loopedSlides = slides.length;
  2453. }
  2454. var prependSlides = [],
  2455. appendSlides = [],
  2456. i;
  2457. slides.each(function (index, el) {
  2458. var slide = $(this);
  2459. if (index < s.loopedSlides) appendSlides.push(el);
  2460. if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
  2461. slide.attr('data-swiper-slide-index', index);
  2462. });
  2463. for (i = 0; i < appendSlides.length; i++) {
  2464. s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2465. }
  2466. for (i = prependSlides.length - 1; i >= 0; i--) {
  2467. s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2468. }
  2469. };
  2470. s.destroyLoop = function () {
  2471. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2472. s.slides.removeAttr('data-swiper-slide-index');
  2473. };
  2474. s.reLoop = function (updatePosition) {
  2475. var oldIndex = s.activeIndex - s.loopedSlides;
  2476. s.destroyLoop();
  2477. s.createLoop();
  2478. s.updateSlidesSize();
  2479. if (updatePosition) {
  2480. s.slideTo(oldIndex + s.loopedSlides, 0, false);
  2481. }
  2482. };
  2483. s.fixLoop = function () {
  2484. var newIndex;
  2485. //Fix For Negative Oversliding
  2486. if (s.activeIndex < s.loopedSlides) {
  2487. newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
  2488. newIndex = newIndex + s.loopedSlides;
  2489. s.slideTo(newIndex, 0, false, true);
  2490. }
  2491. //Fix For Positive Oversliding
  2492. else if (s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2 || s.activeIndex > s.slides.length - s.params.slidesPerView * 2) {
  2493. newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
  2494. newIndex = newIndex + s.loopedSlides;
  2495. s.slideTo(newIndex, 0, false, true);
  2496. }
  2497. };
  2498. /*=========================
  2499. Append/Prepend/Remove Slides
  2500. ===========================*/
  2501. s.appendSlide = function (slides) {
  2502. if (s.params.loop) {
  2503. s.destroyLoop();
  2504. }
  2505. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2506. for (var i = 0; i < slides.length; i++) {
  2507. if (slides[i]) s.wrapper.append(slides[i]);
  2508. }
  2509. } else {
  2510. s.wrapper.append(slides);
  2511. }
  2512. if (s.params.loop) {
  2513. s.createLoop();
  2514. }
  2515. if (!(s.params.observer && s.support.observer)) {
  2516. s.update(true);
  2517. }
  2518. };
  2519. s.prependSlide = function (slides) {
  2520. if (s.params.loop) {
  2521. s.destroyLoop();
  2522. }
  2523. var newActiveIndex = s.activeIndex + 1;
  2524. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2525. for (var i = 0; i < slides.length; i++) {
  2526. if (slides[i]) s.wrapper.prepend(slides[i]);
  2527. }
  2528. newActiveIndex = s.activeIndex + slides.length;
  2529. } else {
  2530. s.wrapper.prepend(slides);
  2531. }
  2532. if (s.params.loop) {
  2533. s.createLoop();
  2534. }
  2535. if (!(s.params.observer && s.support.observer)) {
  2536. s.update(true);
  2537. }
  2538. s.slideTo(newActiveIndex, 0, false);
  2539. };
  2540. s.removeSlide = function (slidesIndexes) {
  2541. if (s.params.loop) {
  2542. s.destroyLoop();
  2543. s.slides = s.wrapper.children('.' + s.params.slideClass);
  2544. }
  2545. var newActiveIndex = s.activeIndex,
  2546. indexToRemove;
  2547. if ((typeof slidesIndexes === 'undefined' ? 'undefined' : _typeof(slidesIndexes)) === 'object' && slidesIndexes.length) {
  2548. for (var i = 0; i < slidesIndexes.length; i++) {
  2549. indexToRemove = slidesIndexes[i];
  2550. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2551. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2552. }
  2553. newActiveIndex = Math.max(newActiveIndex, 0);
  2554. } else {
  2555. indexToRemove = slidesIndexes;
  2556. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2557. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2558. newActiveIndex = Math.max(newActiveIndex, 0);
  2559. }
  2560. if (s.params.loop) {
  2561. s.createLoop();
  2562. }
  2563. if (!(s.params.observer && s.support.observer)) {
  2564. s.update(true);
  2565. }
  2566. if (s.params.loop) {
  2567. s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
  2568. } else {
  2569. s.slideTo(newActiveIndex, 0, false);
  2570. }
  2571. };
  2572. s.removeAllSlides = function () {
  2573. var slidesIndexes = [];
  2574. for (var i = 0; i < s.slides.length; i++) {
  2575. slidesIndexes.push(i);
  2576. }
  2577. s.removeSlide(slidesIndexes);
  2578. };
  2579. /*=========================
  2580. Effects
  2581. ===========================*/
  2582. s.effects = {
  2583. fade: {
  2584. setTranslate: function setTranslate() {
  2585. for (var i = 0; i < s.slides.length; i++) {
  2586. var slide = s.slides.eq(i);
  2587. var offset = slide[0].swiperSlideOffset;
  2588. var tx = -offset;
  2589. if (!s.params.virtualTranslate) tx = tx - s.translate;
  2590. var ty = 0;
  2591. if (!s.isHorizontal()) {
  2592. ty = tx;
  2593. tx = 0;
  2594. }
  2595. var slideOpacity = s.params.fade.crossFade ? Math.max(1 - Math.abs(slide[0].progress), 0) : 1 + Math.min(Math.max(slide[0].progress, -1), 0);
  2596. slide.css({
  2597. opacity: slideOpacity
  2598. }).transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
  2599. }
  2600. },
  2601. setTransition: function setTransition(duration) {
  2602. s.slides.transition(duration);
  2603. if (s.params.virtualTranslate && duration !== 0) {
  2604. var eventTriggered = false;
  2605. s.slides.transitionEnd(function () {
  2606. if (eventTriggered) return;
  2607. if (!s) return;
  2608. eventTriggered = true;
  2609. s.animating = false;
  2610. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2611. for (var i = 0; i < triggerEvents.length; i++) {
  2612. s.wrapper.trigger(triggerEvents[i]);
  2613. }
  2614. });
  2615. }
  2616. }
  2617. },
  2618. flip: {
  2619. setTranslate: function setTranslate() {
  2620. for (var i = 0; i < s.slides.length; i++) {
  2621. var slide = s.slides.eq(i);
  2622. var progress = slide[0].progress;
  2623. if (s.params.flip.limitRotation) {
  2624. progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2625. }
  2626. var offset = slide[0].swiperSlideOffset;
  2627. var rotate = -180 * progress,
  2628. rotateY = rotate,
  2629. rotateX = 0,
  2630. tx = -offset,
  2631. ty = 0;
  2632. if (!s.isHorizontal()) {
  2633. ty = tx;
  2634. tx = 0;
  2635. rotateX = -rotateY;
  2636. rotateY = 0;
  2637. } else if (s.rtl) {
  2638. rotateY = -rotateY;
  2639. }
  2640. slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length;
  2641. if (s.params.flip.slideShadows) {
  2642. //Set shadows
  2643. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2644. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2645. if (shadowBefore.length === 0) {
  2646. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2647. slide.append(shadowBefore);
  2648. }
  2649. if (shadowAfter.length === 0) {
  2650. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2651. slide.append(shadowAfter);
  2652. }
  2653. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2654. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2655. }
  2656. slide.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
  2657. }
  2658. },
  2659. setTransition: function setTransition(duration) {
  2660. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2661. if (s.params.virtualTranslate && duration !== 0) {
  2662. var eventTriggered = false;
  2663. s.slides.eq(s.activeIndex).transitionEnd(function () {
  2664. if (eventTriggered) return;
  2665. if (!s) return;
  2666. if (!$(this).hasClass(s.params.slideActiveClass)) return;
  2667. eventTriggered = true;
  2668. s.animating = false;
  2669. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2670. for (var i = 0; i < triggerEvents.length; i++) {
  2671. s.wrapper.trigger(triggerEvents[i]);
  2672. }
  2673. });
  2674. }
  2675. }
  2676. },
  2677. cube: {
  2678. setTranslate: function setTranslate() {
  2679. var wrapperRotate = 0,
  2680. cubeShadow;
  2681. if (s.params.cube.shadow) {
  2682. if (s.isHorizontal()) {
  2683. cubeShadow = s.wrapper.find('.swiper-cube-shadow');
  2684. if (cubeShadow.length === 0) {
  2685. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2686. s.wrapper.append(cubeShadow);
  2687. }
  2688. cubeShadow.css({ height: s.width + 'px' });
  2689. } else {
  2690. cubeShadow = s.container.find('.swiper-cube-shadow');
  2691. if (cubeShadow.length === 0) {
  2692. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2693. s.container.append(cubeShadow);
  2694. }
  2695. }
  2696. }
  2697. for (var i = 0; i < s.slides.length; i++) {
  2698. var slide = s.slides.eq(i);
  2699. var slideAngle = i * 90;
  2700. var round = Math.floor(slideAngle / 360);
  2701. if (s.rtl) {
  2702. slideAngle = -slideAngle;
  2703. round = Math.floor(-slideAngle / 360);
  2704. }
  2705. var progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2706. var tx = 0,
  2707. ty = 0,
  2708. tz = 0;
  2709. if (i % 4 === 0) {
  2710. tx = -round * 4 * s.size;
  2711. tz = 0;
  2712. } else if ((i - 1) % 4 === 0) {
  2713. tx = 0;
  2714. tz = -round * 4 * s.size;
  2715. } else if ((i - 2) % 4 === 0) {
  2716. tx = s.size + round * 4 * s.size;
  2717. tz = s.size;
  2718. } else if ((i - 3) % 4 === 0) {
  2719. tx = -s.size;
  2720. tz = 3 * s.size + s.size * 4 * round;
  2721. }
  2722. if (s.rtl) {
  2723. tx = -tx;
  2724. }
  2725. if (!s.isHorizontal()) {
  2726. ty = tx;
  2727. tx = 0;
  2728. }
  2729. var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
  2730. if (progress <= 1 && progress > -1) {
  2731. wrapperRotate = i * 90 + progress * 90;
  2732. if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
  2733. }
  2734. slide.transform(transform);
  2735. if (s.params.cube.slideShadows) {
  2736. //Set shadows
  2737. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2738. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2739. if (shadowBefore.length === 0) {
  2740. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2741. slide.append(shadowBefore);
  2742. }
  2743. if (shadowAfter.length === 0) {
  2744. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2745. slide.append(shadowAfter);
  2746. }
  2747. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2748. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2749. }
  2750. }
  2751. s.wrapper.css({
  2752. '-webkit-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2753. '-moz-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2754. '-ms-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2755. 'transform-origin': '50% 50% -' + s.size / 2 + 'px'
  2756. });
  2757. if (s.params.cube.shadow) {
  2758. if (s.isHorizontal()) {
  2759. cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + -s.width / 2 + 'px) rotateX(90deg) rotateZ(0deg) scale(' + s.params.cube.shadowScale + ')');
  2760. } else {
  2761. var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
  2762. var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
  2763. var scale1 = s.params.cube.shadowScale,
  2764. scale2 = s.params.cube.shadowScale / multiplier,
  2765. offset = s.params.cube.shadowOffset;
  2766. cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + -s.height / 2 / scale2 + 'px) rotateX(-90deg)');
  2767. }
  2768. }
  2769. var zFactor = s.isSafari || s.isUiWebView ? -s.size / 2 : 0;
  2770. s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)');
  2771. },
  2772. setTransition: function setTransition(duration) {
  2773. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2774. if (s.params.cube.shadow && !s.isHorizontal()) {
  2775. s.container.find('.swiper-cube-shadow').transition(duration);
  2776. }
  2777. }
  2778. },
  2779. coverflow: {
  2780. setTranslate: function setTranslate() {
  2781. var transform = s.translate;
  2782. var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2;
  2783. var rotate = s.isHorizontal() ? s.params.coverflow.rotate : -s.params.coverflow.rotate;
  2784. var translate = s.params.coverflow.depth;
  2785. //Each slide offset from center
  2786. for (var i = 0, length = s.slides.length; i < length; i++) {
  2787. var slide = s.slides.eq(i);
  2788. var slideSize = s.slidesSizesGrid[i];
  2789. var slideOffset = slide[0].swiperSlideOffset;
  2790. var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
  2791. var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;
  2792. var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;
  2793. // var rotateZ = 0
  2794. var translateZ = -translate * Math.abs(offsetMultiplier);
  2795. var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * offsetMultiplier;
  2796. var translateX = s.isHorizontal() ? s.params.coverflow.stretch * offsetMultiplier : 0;
  2797. //Fix for ultra small values
  2798. if (Math.abs(translateX) < 0.001) translateX = 0;
  2799. if (Math.abs(translateY) < 0.001) translateY = 0;
  2800. if (Math.abs(translateZ) < 0.001) translateZ = 0;
  2801. if (Math.abs(rotateY) < 0.001) rotateY = 0;
  2802. if (Math.abs(rotateX) < 0.001) rotateX = 0;
  2803. var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
  2804. slide.transform(slideTransform);
  2805. slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
  2806. if (s.params.coverflow.slideShadows) {
  2807. //Set shadows
  2808. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2809. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2810. if (shadowBefore.length === 0) {
  2811. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2812. slide.append(shadowBefore);
  2813. }
  2814. if (shadowAfter.length === 0) {
  2815. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2816. slide.append(shadowAfter);
  2817. }
  2818. if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
  2819. if (shadowAfter.length) shadowAfter[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
  2820. }
  2821. }
  2822. //Set correct perspective for IE10
  2823. if (s.browser.ie) {
  2824. var ws = s.wrapper[0].style;
  2825. ws.perspectiveOrigin = center + 'px 50%';
  2826. }
  2827. },
  2828. setTransition: function setTransition(duration) {
  2829. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2830. }
  2831. }
  2832. };
  2833. /*=========================
  2834. Images Lazy Loading
  2835. ===========================*/
  2836. s.lazy = {
  2837. initialImageLoaded: false,
  2838. loadImageInSlide: function loadImageInSlide(index, loadInDuplicate) {
  2839. if (typeof index === 'undefined') return;
  2840. if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;
  2841. if (s.slides.length === 0) return;
  2842. var slide = s.slides.eq(index);
  2843. var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')');
  2844. if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) {
  2845. img = img.add(slide[0]);
  2846. }
  2847. if (img.length === 0) return;
  2848. img.each(function () {
  2849. var _img = $(this);
  2850. _img.addClass(s.params.lazyStatusLoadingClass);
  2851. var background = _img.attr('data-background');
  2852. var src = _img.attr('data-src'),
  2853. srcset = _img.attr('data-srcset'),
  2854. sizes = _img.attr('data-sizes');
  2855. s.loadImage(_img[0], src || background, srcset, sizes, false, function () {
  2856. if (typeof s === 'undefined' || s === null || !s) return;
  2857. if (background) {
  2858. _img.css('background-image', 'url("' + background + '")');
  2859. _img.removeAttr('data-background');
  2860. } else {
  2861. if (srcset) {
  2862. _img.attr('srcset', srcset);
  2863. _img.removeAttr('data-srcset');
  2864. }
  2865. if (sizes) {
  2866. _img.attr('sizes', sizes);
  2867. _img.removeAttr('data-sizes');
  2868. }
  2869. if (src) {
  2870. _img.attr('src', src);
  2871. _img.removeAttr('data-src');
  2872. }
  2873. }
  2874. _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass);
  2875. slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove();
  2876. if (s.params.loop && loadInDuplicate) {
  2877. var slideOriginalIndex = slide.attr('data-swiper-slide-index');
  2878. if (slide.hasClass(s.params.slideDuplicateClass)) {
  2879. var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
  2880. s.lazy.loadImageInSlide(originalSlide.index(), false);
  2881. } else {
  2882. var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
  2883. s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
  2884. }
  2885. }
  2886. s.emit('onLazyImageReady', s, slide[0], _img[0]);
  2887. });
  2888. s.emit('onLazyImageLoad', s, slide[0], _img[0]);
  2889. });
  2890. },
  2891. load: function load() {
  2892. var i;
  2893. var slidesPerView = s.params.slidesPerView;
  2894. if (slidesPerView === 'auto') {
  2895. slidesPerView = 0;
  2896. }
  2897. if (!s.lazy.initialImageLoaded) s.lazy.initialImageLoaded = true;
  2898. if (s.params.watchSlidesVisibility) {
  2899. s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
  2900. s.lazy.loadImageInSlide($(this).index());
  2901. });
  2902. } else {
  2903. if (slidesPerView > 1) {
  2904. for (i = s.activeIndex; i < s.activeIndex + slidesPerView; i++) {
  2905. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2906. }
  2907. } else {
  2908. s.lazy.loadImageInSlide(s.activeIndex);
  2909. }
  2910. }
  2911. if (s.params.lazyLoadingInPrevNext) {
  2912. if (slidesPerView > 1 || s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1) {
  2913. var amount = s.params.lazyLoadingInPrevNextAmount;
  2914. var spv = slidesPerView;
  2915. var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);
  2916. var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);
  2917. // Next Slides
  2918. for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) {
  2919. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2920. }
  2921. // Prev Slides
  2922. for (i = minIndex; i < s.activeIndex; i++) {
  2923. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2924. }
  2925. } else {
  2926. var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
  2927. if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
  2928. var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
  2929. if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
  2930. }
  2931. }
  2932. },
  2933. onTransitionStart: function onTransitionStart() {
  2934. if (s.params.lazyLoading) {
  2935. if (s.params.lazyLoadingOnTransitionStart || !s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded) {
  2936. s.lazy.load();
  2937. }
  2938. }
  2939. },
  2940. onTransitionEnd: function onTransitionEnd() {
  2941. if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
  2942. s.lazy.load();
  2943. }
  2944. }
  2945. };
  2946. /*=========================
  2947. Scrollbar
  2948. ===========================*/
  2949. s.scrollbar = {
  2950. isTouched: false,
  2951. setDragPosition: function setDragPosition(e) {
  2952. var sb = s.scrollbar;
  2953. var x = 0,
  2954. y = 0;
  2955. var translate;
  2956. var pointerPosition = s.isHorizontal() ? e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX || e.clientX : e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY || e.clientY;
  2957. var position = pointerPosition - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;
  2958. var positionMin = -s.minTranslate() * sb.moveDivider;
  2959. var positionMax = -s.maxTranslate() * sb.moveDivider;
  2960. if (position < positionMin) {
  2961. position = positionMin;
  2962. } else if (position > positionMax) {
  2963. position = positionMax;
  2964. }
  2965. position = -position / sb.moveDivider;
  2966. s.updateProgress(position);
  2967. s.setWrapperTranslate(position, true);
  2968. },
  2969. dragStart: function dragStart(e) {
  2970. var sb = s.scrollbar;
  2971. sb.isTouched = true;
  2972. e.preventDefault();
  2973. e.stopPropagation();
  2974. sb.setDragPosition(e);
  2975. clearTimeout(sb.dragTimeout);
  2976. sb.track.transition(0);
  2977. if (s.params.scrollbarHide) {
  2978. sb.track.css('opacity', 1);
  2979. }
  2980. s.wrapper.transition(100);
  2981. sb.drag.transition(100);
  2982. s.emit('onScrollbarDragStart', s);
  2983. },
  2984. dragMove: function dragMove(e) {
  2985. var sb = s.scrollbar;
  2986. if (!sb.isTouched) return;
  2987. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  2988. sb.setDragPosition(e);
  2989. s.wrapper.transition(0);
  2990. sb.track.transition(0);
  2991. sb.drag.transition(0);
  2992. s.emit('onScrollbarDragMove', s);
  2993. },
  2994. dragEnd: function dragEnd(e) {
  2995. var sb = s.scrollbar;
  2996. if (!sb.isTouched) return;
  2997. sb.isTouched = false;
  2998. if (s.params.scrollbarHide) {
  2999. clearTimeout(sb.dragTimeout);
  3000. sb.dragTimeout = setTimeout(function () {
  3001. sb.track.css('opacity', 0);
  3002. sb.track.transition(400);
  3003. }, 1000);
  3004. }
  3005. s.emit('onScrollbarDragEnd', s);
  3006. if (s.params.scrollbarSnapOnRelease) {
  3007. s.slideReset();
  3008. }
  3009. },
  3010. draggableEvents: function () {
  3011. if (s.params.simulateTouch === false && !s.support.touch) return s.touchEventsDesktop;else return s.touchEvents;
  3012. }(),
  3013. enableDraggable: function enableDraggable() {
  3014. var sb = s.scrollbar;
  3015. var target = s.support.touch ? sb.track : document;
  3016. $(sb.track).on(sb.draggableEvents.start, sb.dragStart);
  3017. $(target).on(sb.draggableEvents.move, sb.dragMove);
  3018. $(target).on(sb.draggableEvents.end, sb.dragEnd);
  3019. },
  3020. disableDraggable: function disableDraggable() {
  3021. var sb = s.scrollbar;
  3022. var target = s.support.touch ? sb.track : document;
  3023. $(sb.track).off(sb.draggableEvents.start, sb.dragStart);
  3024. $(target).off(sb.draggableEvents.move, sb.dragMove);
  3025. $(target).off(sb.draggableEvents.end, sb.dragEnd);
  3026. },
  3027. set: function set() {
  3028. if (!s.params.scrollbar) return;
  3029. var sb = s.scrollbar;
  3030. sb.track = $(s.params.scrollbar);
  3031. if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
  3032. sb.track = s.container.find(s.params.scrollbar);
  3033. }
  3034. sb.drag = sb.track.find('.swiper-scrollbar-drag');
  3035. if (sb.drag.length === 0) {
  3036. sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
  3037. sb.track.append(sb.drag);
  3038. }
  3039. sb.drag[0].style.width = '';
  3040. sb.drag[0].style.height = '';
  3041. sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
  3042. sb.divider = s.size / s.virtualSize;
  3043. sb.moveDivider = sb.divider * (sb.trackSize / s.size);
  3044. sb.dragSize = sb.trackSize * sb.divider;
  3045. if (s.isHorizontal()) {
  3046. sb.drag[0].style.width = sb.dragSize + 'px';
  3047. } else {
  3048. sb.drag[0].style.height = sb.dragSize + 'px';
  3049. }
  3050. if (sb.divider >= 1) {
  3051. sb.track[0].style.display = 'none';
  3052. } else {
  3053. sb.track[0].style.display = '';
  3054. }
  3055. if (s.params.scrollbarHide) {
  3056. sb.track[0].style.opacity = 0;
  3057. }
  3058. },
  3059. setTranslate: function setTranslate() {
  3060. if (!s.params.scrollbar) return;
  3061. var diff;
  3062. var sb = s.scrollbar;
  3063. var translate = s.translate || 0;
  3064. var newPos;
  3065. var newSize = sb.dragSize;
  3066. newPos = (sb.trackSize - sb.dragSize) * s.progress;
  3067. if (s.rtl && s.isHorizontal()) {
  3068. newPos = -newPos;
  3069. if (newPos > 0) {
  3070. newSize = sb.dragSize - newPos;
  3071. newPos = 0;
  3072. } else if (-newPos + sb.dragSize > sb.trackSize) {
  3073. newSize = sb.trackSize + newPos;
  3074. }
  3075. } else {
  3076. if (newPos < 0) {
  3077. newSize = sb.dragSize + newPos;
  3078. newPos = 0;
  3079. } else if (newPos + sb.dragSize > sb.trackSize) {
  3080. newSize = sb.trackSize - newPos;
  3081. }
  3082. }
  3083. if (s.isHorizontal()) {
  3084. if (s.support.transforms3d) {
  3085. sb.drag.transform('translate3d(' + newPos + 'px, 0, 0)');
  3086. } else {
  3087. sb.drag.transform('translateX(' + newPos + 'px)');
  3088. }
  3089. sb.drag[0].style.width = newSize + 'px';
  3090. } else {
  3091. if (s.support.transforms3d) {
  3092. sb.drag.transform('translate3d(0px, ' + newPos + 'px, 0)');
  3093. } else {
  3094. sb.drag.transform('translateY(' + newPos + 'px)');
  3095. }
  3096. sb.drag[0].style.height = newSize + 'px';
  3097. }
  3098. if (s.params.scrollbarHide) {
  3099. clearTimeout(sb.timeout);
  3100. sb.track[0].style.opacity = 1;
  3101. sb.timeout = setTimeout(function () {
  3102. sb.track[0].style.opacity = 0;
  3103. sb.track.transition(400);
  3104. }, 1000);
  3105. }
  3106. },
  3107. setTransition: function setTransition(duration) {
  3108. if (!s.params.scrollbar) return;
  3109. s.scrollbar.drag.transition(duration);
  3110. }
  3111. };
  3112. /*=========================
  3113. Controller
  3114. ===========================*/
  3115. s.controller = {
  3116. LinearSpline: function LinearSpline(x, y) {
  3117. var binarySearch = function () {
  3118. var maxIndex, minIndex, guess;
  3119. return function (array, val) {
  3120. minIndex = -1;
  3121. maxIndex = array.length;
  3122. while (maxIndex - minIndex > 1) {
  3123. if (array[guess = maxIndex + minIndex >> 1] <= val) {
  3124. minIndex = guess;
  3125. } else {
  3126. maxIndex = guess;
  3127. }
  3128. }return maxIndex;
  3129. };
  3130. }();
  3131. this.x = x;
  3132. this.y = y;
  3133. this.lastIndex = x.length - 1;
  3134. // Given an x value (x2), return the expected y2 value:
  3135. // (x1,y1) is the known point before given value,
  3136. // (x3,y3) is the known point after given value.
  3137. var i1, i3;
  3138. var l = this.x.length;
  3139. this.interpolate = function (x2) {
  3140. if (!x2) return 0;
  3141. // Get the indexes of x1 and x3 (the array indexes before and after given x2):
  3142. i3 = binarySearch(this.x, x2);
  3143. i1 = i3 - 1;
  3144. // We have our indexes i1 & i3, so we can calculate already:
  3145. // y2 := ((x2�x1) × (y3�y1)) ÷ (x3�x1) + y1
  3146. return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
  3147. };
  3148. },
  3149. //xxx: for now i will just save one spline function to to
  3150. getInterpolateFunction: function getInterpolateFunction(c) {
  3151. if (!s.controller.spline) s.controller.spline = s.params.loop ? new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) : new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
  3152. },
  3153. setTranslate: function setTranslate(translate, byController) {
  3154. var controlled = s.params.control;
  3155. var multiplier, controlledTranslate;
  3156. function setControlledTranslate(c) {
  3157. // this will create an Interpolate function based on the snapGrids
  3158. // x is the Grid of the scrolled scroller and y will be the controlled scroller
  3159. // it makes sense to create this only once and recall it for the interpolation
  3160. // the function does a lot of value caching for performance
  3161. translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;
  3162. if (s.params.controlBy === 'slide') {
  3163. s.controller.getInterpolateFunction(c);
  3164. // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
  3165. // but it did not work out
  3166. controlledTranslate = -s.controller.spline.interpolate(-translate);
  3167. }
  3168. console.log('3402', s.params.controlBy);
  3169. if (!controlledTranslate || s.params.controlBy === 'container') {
  3170. multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
  3171. controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
  3172. }
  3173. if (s.params.controlInverse) {
  3174. controlledTranslate = c.maxTranslate() - controlledTranslate;
  3175. }
  3176. c.updateProgress(controlledTranslate);
  3177. c.setWrapperTranslate(controlledTranslate, false, s);
  3178. c.updateActiveIndex();
  3179. }
  3180. if (Array.isArray(controlled)) {
  3181. for (var i = 0; i < controlled.length; i++) {
  3182. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3183. setControlledTranslate(controlled[i]);
  3184. }
  3185. }
  3186. } else if (controlled instanceof Swiper && byController !== controlled) {
  3187. setControlledTranslate(controlled);
  3188. }
  3189. },
  3190. setTransition: function setTransition(duration, byController) {
  3191. var controlled = s.params.control;
  3192. var i;
  3193. function setControlledTransition(c) {
  3194. c.setWrapperTransition(duration, s);
  3195. if (duration !== 0) {
  3196. c.onTransitionStart();
  3197. c.wrapper.transitionEnd(function () {
  3198. if (!controlled) return;
  3199. if (c.params.loop && s.params.controlBy === 'slide') {
  3200. c.fixLoop();
  3201. }
  3202. c.onTransitionEnd();
  3203. });
  3204. }
  3205. }
  3206. if (Array.isArray(controlled)) {
  3207. for (i = 0; i < controlled.length; i++) {
  3208. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3209. setControlledTransition(controlled[i]);
  3210. }
  3211. }
  3212. } else if (controlled instanceof Swiper && byController !== controlled) {
  3213. setControlledTransition(controlled);
  3214. }
  3215. }
  3216. };
  3217. /*=========================
  3218. Hash Navigation
  3219. ===========================*/
  3220. s.hashnav = {
  3221. onHashCange: function onHashCange(e, a) {
  3222. var newHash = document.location.hash.replace('#', '');
  3223. var activeSlideHash = s.slides.eq(s.activeIndex).attr('data-hash');
  3224. if (newHash !== activeSlideHash) {
  3225. s.slideTo(s.wrapper.children('.' + s.params.slideClass + '[data-hash="' + newHash + '"]').index());
  3226. }
  3227. },
  3228. attachEvents: function attachEvents(detach) {
  3229. var action = detach ? 'off' : 'on';
  3230. $(window)[action]('hashchange', s.hashnav.onHashCange);
  3231. },
  3232. setHash: function setHash() {
  3233. if (!s.hashnav.initialized || !s.params.hashnav) return;
  3234. if (s.params.replaceState && window.history && window.history.replaceState) {
  3235. window.history.replaceState(null, null, '#' + s.slides.eq(s.activeIndex).attr('data-hash') || '');
  3236. } else {
  3237. var slide = s.slides.eq(s.activeIndex);
  3238. var hash = slide.attr('data-hash') || slide.attr('data-history');
  3239. document.location.hash = hash || '';
  3240. }
  3241. },
  3242. init: function init() {
  3243. if (!s.params.hashnav || s.params.history) return;
  3244. s.hashnav.initialized = true;
  3245. var hash = document.location.hash.replace('#', '');
  3246. if (hash) {
  3247. var speed = 0;
  3248. for (var i = 0, length = s.slides.length; i < length; i++) {
  3249. var slide = s.slides.eq(i);
  3250. var slideHash = slide.attr('data-hash') || slide.attr('data-history');
  3251. if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
  3252. var index = slide.index();
  3253. s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
  3254. }
  3255. }
  3256. }
  3257. if (s.params.hashnavWatchState) s.hashnav.attachEvents();
  3258. },
  3259. destroy: function destroy() {
  3260. if (s.params.hashnavWatchState) s.hashnav.attachEvents(true);
  3261. }
  3262. };
  3263. /*=========================
  3264. History Api with fallback to Hashnav
  3265. ===========================*/
  3266. s.history = {
  3267. init: function init() {
  3268. if (!s.params.history) return;
  3269. if (!window.history || !window.history.pushState) {
  3270. s.params.history = false;
  3271. s.params.hashnav = true;
  3272. return;
  3273. }
  3274. s.history.initialized = true;
  3275. this.paths = this.getPathValues();
  3276. if (!this.paths.key && !this.paths.value) return;
  3277. this.scrollToSlide(0, this.paths.value, s.params.runCallbacksOnInit);
  3278. if (!s.params.replaceState) {
  3279. window.addEventListener('popstate', this.setHistoryPopState);
  3280. }
  3281. },
  3282. setHistoryPopState: function setHistoryPopState() {
  3283. s.history.paths = s.history.getPathValues();
  3284. s.history.scrollToSlide(s.params.speed, s.history.paths.value, false);
  3285. },
  3286. getPathValues: function getPathValues() {
  3287. var pathArray = window.location.pathname.slice(1).split('/');
  3288. var total = pathArray.length;
  3289. var key = pathArray[total - 2];
  3290. var value = pathArray[total - 1];
  3291. return { key: key, value: value };
  3292. },
  3293. setHistory: function setHistory(key, index) {
  3294. if (!s.history.initialized || !s.params.history) return;
  3295. var slide = s.slides.eq(index);
  3296. var value = this.slugify(slide.attr('data-history'));
  3297. if (!window.location.pathname.includes(key)) {
  3298. value = key + '/' + value;
  3299. }
  3300. if (s.params.replaceState) {
  3301. window.history.replaceState(null, null, value);
  3302. } else {
  3303. window.history.pushState(null, null, value);
  3304. }
  3305. },
  3306. slugify: function slugify(text) {
  3307. return text.toString().toLowerCase().replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
  3308. },
  3309. scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
  3310. if (value) {
  3311. for (var i = 0, length = s.slides.length; i < length; i++) {
  3312. var slide = s.slides.eq(i);
  3313. var slideHistory = this.slugify(slide.attr('data-history'));
  3314. if (slideHistory === value && !slide.hasClass(s.params.slideDuplicateClass)) {
  3315. var index = slide.index();
  3316. s.slideTo(index, speed, runCallbacks);
  3317. }
  3318. }
  3319. } else {
  3320. s.slideTo(0, speed, runCallbacks);
  3321. }
  3322. }
  3323. };
  3324. /*=========================
  3325. Keyboard Control
  3326. ===========================*/
  3327. function handleKeyboard(e) {
  3328. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3329. var kc = e.keyCode || e.charCode;
  3330. // Directions locks
  3331. if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) {
  3332. return false;
  3333. }
  3334. if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) {
  3335. return false;
  3336. }
  3337. if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  3338. return;
  3339. }
  3340. if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
  3341. return;
  3342. }
  3343. if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
  3344. var inView = false;
  3345. //Check that swiper should be inside of visible area of window
  3346. if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) {
  3347. return;
  3348. }
  3349. var windowScroll = {
  3350. left: window.pageXOffset,
  3351. top: window.pageYOffset
  3352. };
  3353. var windowWidth = window.innerWidth;
  3354. var windowHeight = window.innerHeight;
  3355. var swiperOffset = s.container.offset();
  3356. if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
  3357. var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + s.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + s.height], [swiperOffset.left + s.width, swiperOffset.top + s.height]];
  3358. for (var i = 0; i < swiperCoord.length; i++) {
  3359. var point = swiperCoord[i];
  3360. if (point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight) {
  3361. inView = true;
  3362. }
  3363. }
  3364. if (!inView) return;
  3365. }
  3366. if (s.isHorizontal()) {
  3367. if (kc === 37 || kc === 39) {
  3368. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3369. }
  3370. if (kc === 39 && !s.rtl || kc === 37 && s.rtl) s.slideNext();
  3371. if (kc === 37 && !s.rtl || kc === 39 && s.rtl) s.slidePrev();
  3372. } else {
  3373. if (kc === 38 || kc === 40) {
  3374. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3375. }
  3376. if (kc === 40) s.slideNext();
  3377. if (kc === 38) s.slidePrev();
  3378. }
  3379. s.emit('onKeyPress', s, kc);
  3380. }
  3381. s.disableKeyboardControl = function () {
  3382. s.params.keyboardControl = false;
  3383. $(document).off('keydown', handleKeyboard);
  3384. };
  3385. s.enableKeyboardControl = function () {
  3386. s.params.keyboardControl = true;
  3387. $(document).on('keydown', handleKeyboard);
  3388. };
  3389. /*=========================
  3390. Mousewheel Control
  3391. ===========================*/
  3392. s.mousewheel = {
  3393. event: false,
  3394. lastScrollTime: new window.Date().getTime()
  3395. };
  3396. function isEventSupported() {
  3397. var eventName = 'onwheel';
  3398. var isSupported = eventName in document;
  3399. if (!isSupported) {
  3400. var element = document.createElement('div');
  3401. element.setAttribute(eventName, 'return;');
  3402. isSupported = typeof element[eventName] === 'function';
  3403. }
  3404. if (!isSupported && document.implementation && document.implementation.hasFeature &&
  3405. // always returns true in newer browsers as per the standard.
  3406. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  3407. document.implementation.hasFeature('', '') !== true) {
  3408. // This is the only way to test support for the `wheel` event in IE9+.
  3409. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  3410. }
  3411. return isSupported;
  3412. }
  3413. /**
  3414. * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
  3415. * complicated, thus this doc is long and (hopefully) detailed enough to answer
  3416. * your questions.
  3417. *
  3418. * If you need to react to the mouse wheel in a predictable way, this code is
  3419. * like your bestest friend. * hugs *
  3420. *
  3421. * As of today, there are 4 DOM event types you can listen to:
  3422. *
  3423. * 'wheel' -- Chrome(31+), FF(17+), IE(9+)
  3424. * 'mousewheel' -- Chrome, IE(6+), Opera, Safari
  3425. * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
  3426. * 'DOMMouseScroll' -- FF(0.9.7+) since 2003
  3427. *
  3428. * So what to do? The is the best:
  3429. *
  3430. * normalizeWheel.getEventType();
  3431. *
  3432. * In your event callback, use this code to get sane interpretation of the
  3433. * deltas. This code will return an object with properties:
  3434. *
  3435. * spinX -- normalized spin speed (use for zoom) - x plane
  3436. * spinY -- " - y plane
  3437. * pixelX -- normalized distance (to pixels) - x plane
  3438. * pixelY -- " - y plane
  3439. *
  3440. * Wheel values are provided by the browser assuming you are using the wheel to
  3441. * scroll a web page by a number of lines or pixels (or pages). Values can vary
  3442. * significantly on different platforms and browsers, forgetting that you can
  3443. * scroll at different speeds. Some devices (like trackpads) emit more events
  3444. * at smaller increments with fine granularity, and some emit massive jumps with
  3445. * linear speed or acceleration.
  3446. *
  3447. * This code does its best to normalize the deltas for you:
  3448. *
  3449. * - spin is trying to normalize how far the wheel was spun (or trackpad
  3450. * dragged). This is super useful for zoom support where you want to
  3451. * throw away the chunky scroll steps on the PC and make those equal to
  3452. * the slow and smooth tiny steps on the Mac. Key data: This code tries to
  3453. * resolve a single slow step on a wheel to 1.
  3454. *
  3455. * - pixel is normalizing the desired scroll delta in pixel units. You'll
  3456. * get the crazy differences between browsers, but at least it'll be in
  3457. * pixels!
  3458. *
  3459. * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
  3460. * should translate to positive value zooming IN, negative zooming OUT.
  3461. * This matches the newer 'wheel' event.
  3462. *
  3463. * Why are there spinX, spinY (or pixels)?
  3464. *
  3465. * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
  3466. * with a mouse. It results in side-scrolling in the browser by default.
  3467. *
  3468. * - spinY is what you expect -- it's the classic axis of a mouse wheel.
  3469. *
  3470. * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
  3471. * probably is by browsers in conjunction with fancy 3D controllers .. but
  3472. * you know.
  3473. *
  3474. * Implementation info:
  3475. *
  3476. * Examples of 'wheel' event if you scroll slowly (down) by one step with an
  3477. * average mouse:
  3478. *
  3479. * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
  3480. * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
  3481. * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
  3482. * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
  3483. * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
  3484. *
  3485. * On the trackpad:
  3486. *
  3487. * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
  3488. * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
  3489. *
  3490. * On other/older browsers.. it's more complicated as there can be multiple and
  3491. * also missing delta values.
  3492. *
  3493. * The 'wheel' event is more standard:
  3494. *
  3495. * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
  3496. *
  3497. * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
  3498. * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
  3499. * backward compatibility with older events. Those other values help us
  3500. * better normalize spin speed. Example of what the browsers provide:
  3501. *
  3502. * | event.wheelDelta | event.detail
  3503. * ------------------+------------------+--------------
  3504. * Safari v5/OS X | -120 | 0
  3505. * Safari v5/Win7 | -120 | 0
  3506. * Chrome v17/OS X | -120 | 0
  3507. * Chrome v17/Win7 | -120 | 0
  3508. * IE9/Win7 | -120 | undefined
  3509. * Firefox v4/OS X | undefined | 1
  3510. * Firefox v4/Win7 | undefined | 3
  3511. *
  3512. */
  3513. function normalizeWheel( /*object*/event) /*object*/{
  3514. // Reasonable defaults
  3515. var PIXEL_STEP = 10;
  3516. var LINE_HEIGHT = 40;
  3517. var PAGE_HEIGHT = 800;
  3518. var sX = 0,
  3519. sY = 0,
  3520. // spinX, spinY
  3521. pX = 0,
  3522. pY = 0; // pixelX, pixelY
  3523. // Legacy
  3524. if ('detail' in event) {
  3525. sY = event.detail;
  3526. }
  3527. if ('wheelDelta' in event) {
  3528. sY = -event.wheelDelta / 120;
  3529. }
  3530. if ('wheelDeltaY' in event) {
  3531. sY = -event.wheelDeltaY / 120;
  3532. }
  3533. if ('wheelDeltaX' in event) {
  3534. sX = -event.wheelDeltaX / 120;
  3535. }
  3536. // side scrolling on FF with DOMMouseScroll
  3537. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  3538. sX = sY;
  3539. sY = 0;
  3540. }
  3541. pX = sX * PIXEL_STEP;
  3542. pY = sY * PIXEL_STEP;
  3543. if ('deltaY' in event) {
  3544. pY = event.deltaY;
  3545. }
  3546. if ('deltaX' in event) {
  3547. pX = event.deltaX;
  3548. }
  3549. if ((pX || pY) && event.deltaMode) {
  3550. if (event.deltaMode === 1) {
  3551. // delta in LINE units
  3552. pX *= LINE_HEIGHT;
  3553. pY *= LINE_HEIGHT;
  3554. } else {
  3555. // delta in PAGE units
  3556. pX *= PAGE_HEIGHT;
  3557. pY *= PAGE_HEIGHT;
  3558. }
  3559. }
  3560. // Fall-back if spin cannot be determined
  3561. if (pX && !sX) {
  3562. sX = pX < 1 ? -1 : 1;
  3563. }
  3564. if (pY && !sY) {
  3565. sY = pY < 1 ? -1 : 1;
  3566. }
  3567. return {
  3568. spinX: sX,
  3569. spinY: sY,
  3570. pixelX: pX,
  3571. pixelY: pY
  3572. };
  3573. }
  3574. if (s.params.mousewheelControl) {
  3575. /**
  3576. * The best combination if you prefer spinX + spinY normalization. It favors
  3577. * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
  3578. * 'wheel' event, making spin speed determination impossible.
  3579. */
  3580. s.mousewheel.event = navigator.userAgent.indexOf('firefox') > -1 ? 'DOMMouseScroll' : isEventSupported() ? 'wheel' : 'mousewheel';
  3581. }
  3582. function handleMousewheel(e) {
  3583. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3584. var delta = 0;
  3585. var rtlFactor = s.rtl ? -1 : 1;
  3586. var data = normalizeWheel(e);
  3587. if (s.params.mousewheelForceToAxis) {
  3588. if (s.isHorizontal()) {
  3589. if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = data.pixelX * rtlFactor;else return;
  3590. } else {
  3591. if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = data.pixelY;else return;
  3592. }
  3593. } else {
  3594. delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
  3595. }
  3596. if (delta === 0) return;
  3597. if (s.params.mousewheelInvert) delta = -delta;
  3598. if (!s.params.freeMode) {
  3599. if (new window.Date().getTime() - s.mousewheel.lastScrollTime > 60) {
  3600. if (delta < 0) {
  3601. if ((!s.isEnd || s.params.loop) && !s.animating) {
  3602. s.slideNext();
  3603. s.emit('onScroll', s, e);
  3604. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3605. } else {
  3606. if ((!s.isBeginning || s.params.loop) && !s.animating) {
  3607. s.slidePrev();
  3608. s.emit('onScroll', s, e);
  3609. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3610. }
  3611. }
  3612. s.mousewheel.lastScrollTime = new window.Date().getTime();
  3613. } else {
  3614. //Freemode or scrollContainer:
  3615. var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
  3616. var wasBeginning = s.isBeginning,
  3617. wasEnd = s.isEnd;
  3618. if (position >= s.minTranslate()) position = s.minTranslate();
  3619. if (position <= s.maxTranslate()) position = s.maxTranslate();
  3620. s.setWrapperTransition(0);
  3621. s.setWrapperTranslate(position);
  3622. s.updateProgress();
  3623. s.updateActiveIndex();
  3624. if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
  3625. s.updateClasses();
  3626. }
  3627. if (s.params.freeModeSticky) {
  3628. clearTimeout(s.mousewheel.timeout);
  3629. s.mousewheel.timeout = setTimeout(function () {
  3630. s.slideReset();
  3631. }, 300);
  3632. } else {
  3633. if (s.params.lazyLoading && s.lazy) {
  3634. s.lazy.load();
  3635. }
  3636. }
  3637. // Emit event
  3638. s.emit('onScroll', s, e);
  3639. // Stop autoplay
  3640. if (s.params.autoplay && s.params.autoplayDisableOnInteraction) s.stopAutoplay();
  3641. // Return page scroll on edge positions
  3642. if (position === 0 || position === s.maxTranslate()) return;
  3643. }
  3644. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3645. return false;
  3646. }
  3647. s.disableMousewheelControl = function () {
  3648. if (!s.mousewheel.event) return false;
  3649. var target = s.container;
  3650. console.log('3913', s.params.mousewheelEventsTarged)
  3651. if (s.params.mousewheelEventsTarged !== 'container') {
  3652. target = $(s.params.mousewheelEventsTarged);
  3653. }
  3654. target.off(s.mousewheel.event, handleMousewheel);
  3655. s.params.mousewheelControl = false;
  3656. return true;
  3657. };
  3658. s.enableMousewheelControl = function () {
  3659. if (!s.mousewheel.event) return false;
  3660. var target = s.container;
  3661. console.log('3925', s.params.mousewheelEventsTarged)
  3662. if (s.params.mousewheelEventsTarged !== 'container') {
  3663. target = $(s.params.mousewheelEventsTarged);
  3664. }
  3665. target.on(s.mousewheel.event, handleMousewheel);
  3666. s.params.mousewheelControl = true;
  3667. return true;
  3668. };
  3669. /*=========================
  3670. Parallax
  3671. ===========================*/
  3672. function setParallaxTransform(el, progress) {
  3673. el = $(el);
  3674. var p, pX, pY;
  3675. var rtlFactor = s.rtl ? -1 : 1;
  3676. p = el.attr('data-swiper-parallax') || '0';
  3677. pX = el.attr('data-swiper-parallax-x');
  3678. pY = el.attr('data-swiper-parallax-y');
  3679. if (pX || pY) {
  3680. pX = pX || '0';
  3681. pY = pY || '0';
  3682. } else {
  3683. if (s.isHorizontal()) {
  3684. pX = p;
  3685. pY = '0';
  3686. } else {
  3687. pY = p;
  3688. pX = '0';
  3689. }
  3690. }
  3691. if (pX.indexOf('%') >= 0) {
  3692. pX = parseInt(pX, 10) * progress * rtlFactor + '%';
  3693. } else {
  3694. pX = pX * progress * rtlFactor + 'px';
  3695. }
  3696. if (pY.indexOf('%') >= 0) {
  3697. pY = parseInt(pY, 10) * progress + '%';
  3698. } else {
  3699. pY = pY * progress + 'px';
  3700. }
  3701. el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
  3702. }
  3703. s.parallax = {
  3704. setTranslate: function setTranslate() {
  3705. s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3706. setParallaxTransform(this, s.progress);
  3707. });
  3708. s.slides.each(function () {
  3709. var slide = $(this);
  3710. slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3711. var progress = Math.min(Math.max(slide[0].progress, -1), 1);
  3712. setParallaxTransform(this, progress);
  3713. });
  3714. });
  3715. },
  3716. setTransition: function setTransition(duration) {
  3717. if (typeof duration === 'undefined') duration = s.params.speed;
  3718. s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3719. var el = $(this);
  3720. var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
  3721. if (duration === 0) parallaxDuration = 0;
  3722. el.transition(parallaxDuration);
  3723. });
  3724. }
  3725. };
  3726. /*=========================
  3727. Zoom
  3728. ===========================*/
  3729. s.zoom = {
  3730. // "Global" Props
  3731. scale: 1,
  3732. currentScale: 1,
  3733. isScaling: false,
  3734. gesture: {
  3735. slide: undefined,
  3736. slideWidth: undefined,
  3737. slideHeight: undefined,
  3738. image: undefined,
  3739. imageWrap: undefined,
  3740. zoomMax: s.params.zoomMax
  3741. },
  3742. image: {
  3743. isTouched: undefined,
  3744. isMoved: undefined,
  3745. currentX: undefined,
  3746. currentY: undefined,
  3747. minX: undefined,
  3748. minY: undefined,
  3749. maxX: undefined,
  3750. maxY: undefined,
  3751. width: undefined,
  3752. height: undefined,
  3753. startX: undefined,
  3754. startY: undefined,
  3755. touchesStart: {},
  3756. touchesCurrent: {}
  3757. },
  3758. velocity: {
  3759. x: undefined,
  3760. y: undefined,
  3761. prevPositionX: undefined,
  3762. prevPositionY: undefined,
  3763. prevTime: undefined
  3764. },
  3765. // Calc Scale From Multi-touches
  3766. getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
  3767. if (e.targetTouches.length < 2) return 1;
  3768. var x1 = e.targetTouches[0].pageX,
  3769. y1 = e.targetTouches[0].pageY,
  3770. x2 = e.targetTouches[1].pageX,
  3771. y2 = e.targetTouches[1].pageY;
  3772. var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  3773. return distance;
  3774. },
  3775. // Events
  3776. onGestureStart: function onGestureStart(e) {
  3777. var z = s.zoom;
  3778. if (!s.support.gestures) {
  3779. if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
  3780. return;
  3781. }
  3782. z.gesture.scaleStart = z.getDistanceBetweenTouches(e);
  3783. }
  3784. if (!z.gesture.slide || !z.gesture.slide.length) {
  3785. z.gesture.slide = $(this);
  3786. if (z.gesture.slide.length === 0) z.gesture.slide = s.slides.eq(s.activeIndex);
  3787. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3788. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3789. z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3790. if (z.gesture.imageWrap.length === 0) {
  3791. z.gesture.image = undefined;
  3792. return;
  3793. }
  3794. }
  3795. z.gesture.image.transition(0);
  3796. z.isScaling = true;
  3797. },
  3798. onGestureChange: function onGestureChange(e) {
  3799. var z = s.zoom;
  3800. if (!s.support.gestures) {
  3801. if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
  3802. return;
  3803. }
  3804. z.gesture.scaleMove = z.getDistanceBetweenTouches(e);
  3805. }
  3806. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3807. if (s.support.gestures) {
  3808. z.scale = e.scale * z.currentScale;
  3809. } else {
  3810. z.scale = z.gesture.scaleMove / z.gesture.scaleStart * z.currentScale;
  3811. }
  3812. if (z.scale > z.gesture.zoomMax) {
  3813. z.scale = z.gesture.zoomMax - 1 + Math.pow(z.scale - z.gesture.zoomMax + 1, 0.5);
  3814. }
  3815. if (z.scale < s.params.zoomMin) {
  3816. z.scale = s.params.zoomMin + 1 - Math.pow(s.params.zoomMin - z.scale + 1, 0.5);
  3817. }
  3818. z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3819. },
  3820. onGestureEnd: function onGestureEnd(e) {
  3821. var z = s.zoom;
  3822. if (!s.support.gestures) {
  3823. if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) {
  3824. return;
  3825. }
  3826. }
  3827. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3828. z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin);
  3829. z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3830. z.currentScale = z.scale;
  3831. z.isScaling = false;
  3832. if (z.scale === 1) z.gesture.slide = undefined;
  3833. },
  3834. onTouchStart: function onTouchStart(s, e) {
  3835. var z = s.zoom;
  3836. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3837. if (z.image.isTouched) return;
  3838. if (s.device.os === 'android') e.preventDefault();
  3839. z.image.isTouched = true;
  3840. z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  3841. z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  3842. },
  3843. onTouchMove: function onTouchMove(e) {
  3844. var z = s.zoom;
  3845. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3846. s.allowClick = false;
  3847. if (!z.image.isTouched || !z.gesture.slide) return;
  3848. if (!z.image.isMoved) {
  3849. z.image.width = z.gesture.image[0].offsetWidth;
  3850. z.image.height = z.gesture.image[0].offsetHeight;
  3851. z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0;
  3852. z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0;
  3853. z.gesture.slideWidth = z.gesture.slide[0].offsetWidth;
  3854. z.gesture.slideHeight = z.gesture.slide[0].offsetHeight;
  3855. z.gesture.imageWrap.transition(0);
  3856. if (s.rtl) z.image.startX = -z.image.startX;
  3857. if (s.rtl) z.image.startY = -z.image.startY;
  3858. }
  3859. // Define if we need image drag
  3860. var scaledWidth = z.image.width * z.scale;
  3861. var scaledHeight = z.image.height * z.scale;
  3862. if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) return;
  3863. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3864. z.image.maxX = -z.image.minX;
  3865. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3866. z.image.maxY = -z.image.minY;
  3867. z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  3868. z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  3869. if (!z.image.isMoved && !z.isScaling) {
  3870. if (s.isHorizontal() && Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x || Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x) {
  3871. z.image.isTouched = false;
  3872. return;
  3873. } else if (!s.isHorizontal() && Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y || Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y) {
  3874. z.image.isTouched = false;
  3875. return;
  3876. }
  3877. }
  3878. e.preventDefault();
  3879. e.stopPropagation();
  3880. z.image.isMoved = true;
  3881. z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;
  3882. z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;
  3883. if (z.image.currentX < z.image.minX) {
  3884. z.image.currentX = z.image.minX + 1 - Math.pow(z.image.minX - z.image.currentX + 1, 0.8);
  3885. }
  3886. if (z.image.currentX > z.image.maxX) {
  3887. z.image.currentX = z.image.maxX - 1 + Math.pow(z.image.currentX - z.image.maxX + 1, 0.8);
  3888. }
  3889. if (z.image.currentY < z.image.minY) {
  3890. z.image.currentY = z.image.minY + 1 - Math.pow(z.image.minY - z.image.currentY + 1, 0.8);
  3891. }
  3892. if (z.image.currentY > z.image.maxY) {
  3893. z.image.currentY = z.image.maxY - 1 + Math.pow(z.image.currentY - z.image.maxY + 1, 0.8);
  3894. }
  3895. //Velocity
  3896. if (!z.velocity.prevPositionX) z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3897. if (!z.velocity.prevPositionY) z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3898. if (!z.velocity.prevTime) z.velocity.prevTime = Date.now();
  3899. z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;
  3900. z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;
  3901. if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2) z.velocity.x = 0;
  3902. if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2) z.velocity.y = 0;
  3903. z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3904. z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3905. z.velocity.prevTime = Date.now();
  3906. z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3907. },
  3908. onTouchEnd: function onTouchEnd(s, e) {
  3909. var z = s.zoom;
  3910. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3911. if (!z.image.isTouched || !z.image.isMoved) {
  3912. z.image.isTouched = false;
  3913. z.image.isMoved = false;
  3914. return;
  3915. }
  3916. z.image.isTouched = false;
  3917. z.image.isMoved = false;
  3918. var momentumDurationX = 300;
  3919. var momentumDurationY = 300;
  3920. var momentumDistanceX = z.velocity.x * momentumDurationX;
  3921. var newPositionX = z.image.currentX + momentumDistanceX;
  3922. var momentumDistanceY = z.velocity.y * momentumDurationY;
  3923. var newPositionY = z.image.currentY + momentumDistanceY;
  3924. //Fix duration
  3925. if (z.velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);
  3926. if (z.velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);
  3927. var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
  3928. z.image.currentX = newPositionX;
  3929. z.image.currentY = newPositionY;
  3930. // Define if we need image drag
  3931. var scaledWidth = z.image.width * z.scale;
  3932. var scaledHeight = z.image.height * z.scale;
  3933. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3934. z.image.maxX = -z.image.minX;
  3935. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3936. z.image.maxY = -z.image.minY;
  3937. z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);
  3938. z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);
  3939. z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3940. },
  3941. onTransitionEnd: function onTransitionEnd(s) {
  3942. var z = s.zoom;
  3943. if (z.gesture.slide && s.previousIndex !== s.activeIndex) {
  3944. z.gesture.image.transform('translate3d(0,0,0) scale(1)');
  3945. z.gesture.imageWrap.transform('translate3d(0,0,0)');
  3946. z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;
  3947. z.scale = z.currentScale = 1;
  3948. }
  3949. },
  3950. // Toggle Zoom
  3951. toggleZoom: function toggleZoom(s, e) {
  3952. var z = s.zoom;
  3953. if (!z.gesture.slide) {
  3954. z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex);
  3955. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3956. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3957. }
  3958. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3959. var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;
  3960. if (typeof z.image.touchesStart.x === 'undefined' && e) {
  3961. touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
  3962. touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
  3963. } else {
  3964. touchX = z.image.touchesStart.x;
  3965. touchY = z.image.touchesStart.y;
  3966. }
  3967. if (z.scale && z.scale !== 1) {
  3968. // Zoom Out
  3969. z.scale = z.currentScale = 1;
  3970. z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)');
  3971. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)');
  3972. z.gesture.slide = undefined;
  3973. } else {
  3974. // Zoom In
  3975. z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3976. if (e) {
  3977. slideWidth = z.gesture.slide[0].offsetWidth;
  3978. slideHeight = z.gesture.slide[0].offsetHeight;
  3979. offsetX = z.gesture.slide.offset().left;
  3980. offsetY = z.gesture.slide.offset().top;
  3981. diffX = offsetX + slideWidth / 2 - touchX;
  3982. diffY = offsetY + slideHeight / 2 - touchY;
  3983. imageWidth = z.gesture.image[0].offsetWidth;
  3984. imageHeight = z.gesture.image[0].offsetHeight;
  3985. scaledWidth = imageWidth * z.scale;
  3986. scaledHeight = imageHeight * z.scale;
  3987. translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
  3988. translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
  3989. translateMaxX = -translateMinX;
  3990. translateMaxY = -translateMinY;
  3991. translateX = diffX * z.scale;
  3992. translateY = diffY * z.scale;
  3993. if (translateX < translateMinX) {
  3994. translateX = translateMinX;
  3995. }
  3996. if (translateX > translateMaxX) {
  3997. translateX = translateMaxX;
  3998. }
  3999. if (translateY < translateMinY) {
  4000. translateY = translateMinY;
  4001. }
  4002. if (translateY > translateMaxY) {
  4003. translateY = translateMaxY;
  4004. }
  4005. } else {
  4006. translateX = 0;
  4007. translateY = 0;
  4008. }
  4009. z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)');
  4010. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4011. }
  4012. },
  4013. // Attach/Detach Events
  4014. attachEvents: function attachEvents(detach) {
  4015. var action = detach ? 'off' : 'on';
  4016. if (s.params.zoom) {
  4017. var target = s.slides;
  4018. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  4019. // Scale image
  4020. if (s.support.gestures) {
  4021. s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener);
  4022. s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener);
  4023. s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener);
  4024. } else if (s.touchEvents.start === 'touchstart') {
  4025. s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener);
  4026. s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener);
  4027. s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener);
  4028. }
  4029. // Move image
  4030. s[action]('touchStart', s.zoom.onTouchStart);
  4031. s.slides.each(function (index, slide) {
  4032. if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) {
  4033. $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove);
  4034. }
  4035. });
  4036. s[action]('touchEnd', s.zoom.onTouchEnd);
  4037. // Scale Out
  4038. s[action]('transitionEnd', s.zoom.onTransitionEnd);
  4039. if (s.params.zoomToggle) {
  4040. s.on('doubleTap', s.zoom.toggleZoom);
  4041. }
  4042. }
  4043. },
  4044. init: function init() {
  4045. s.zoom.attachEvents();
  4046. },
  4047. destroy: function destroy() {
  4048. s.zoom.attachEvents(true);
  4049. }
  4050. };
  4051. /*=========================
  4052. Plugins API. Collect all and init all plugins
  4053. ===========================*/
  4054. s._plugins = [];
  4055. for (var plugin in s.plugins) {
  4056. var p = s.plugins[plugin](s, s.params[plugin]);
  4057. if (p) s._plugins.push(p);
  4058. }
  4059. // Method to call all plugins event/method
  4060. s.callPlugins = function (eventName) {
  4061. for (var i = 0; i < s._plugins.length; i++) {
  4062. if (eventName in s._plugins[i]) {
  4063. s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4064. }
  4065. }
  4066. };
  4067. /*=========================
  4068. Events/Callbacks/Plugins Emitter
  4069. ===========================*/
  4070. function normalizeEventName(eventName) {
  4071. if (eventName.indexOf('on') !== 0) {
  4072. if (eventName[0] !== eventName[0].toUpperCase()) {
  4073. eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
  4074. } else {
  4075. eventName = 'on' + eventName;
  4076. }
  4077. }
  4078. return eventName;
  4079. }
  4080. s.emitterEventListeners = {};
  4081. s.emit = function (eventName) {
  4082. // Trigger callbacks
  4083. if (s.params[eventName]) {
  4084. s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4085. }
  4086. var i;
  4087. // Trigger events
  4088. if (s.emitterEventListeners[eventName]) {
  4089. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4090. s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4091. }
  4092. }
  4093. // Trigger plugins
  4094. if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4095. };
  4096. s.on = function (eventName, handler) {
  4097. eventName = normalizeEventName(eventName);
  4098. if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
  4099. s.emitterEventListeners[eventName].push(handler);
  4100. return s;
  4101. };
  4102. s.off = function (eventName, handler) {
  4103. var i;
  4104. eventName = normalizeEventName(eventName);
  4105. if (typeof handler === 'undefined') {
  4106. // Remove all handlers for such event
  4107. s.emitterEventListeners[eventName] = [];
  4108. return s;
  4109. }
  4110. if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
  4111. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4112. if (s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
  4113. }
  4114. return s;
  4115. };
  4116. s.once = function (eventName, handler) {
  4117. eventName = normalizeEventName(eventName);
  4118. var _handler = function _handler() {
  4119. handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
  4120. s.off(eventName, _handler);
  4121. };
  4122. s.on(eventName, _handler);
  4123. return s;
  4124. };
  4125. // Accessibility tools
  4126. s.a11y = {
  4127. makeFocusable: function makeFocusable($el) {
  4128. $el.attr('tabIndex', '0');
  4129. return $el;
  4130. },
  4131. addRole: function addRole($el, role) {
  4132. $el.attr('role', role);
  4133. return $el;
  4134. },
  4135. addLabel: function addLabel($el, label) {
  4136. $el.attr('aria-label', label);
  4137. return $el;
  4138. },
  4139. disable: function disable($el) {
  4140. $el.attr('aria-disabled', true);
  4141. return $el;
  4142. },
  4143. enable: function enable($el) {
  4144. $el.attr('aria-disabled', false);
  4145. return $el;
  4146. },
  4147. onEnterKey: function onEnterKey(event) {
  4148. if (event.keyCode !== 13) return;
  4149. if ($(event.target).is(s.params.nextButton)) {
  4150. s.onClickNext(event);
  4151. if (s.isEnd) {
  4152. s.a11y.notify(s.params.lastSlideMessage);
  4153. } else {
  4154. s.a11y.notify(s.params.nextSlideMessage);
  4155. }
  4156. } else if ($(event.target).is(s.params.prevButton)) {
  4157. s.onClickPrev(event);
  4158. if (s.isBeginning) {
  4159. s.a11y.notify(s.params.firstSlideMessage);
  4160. } else {
  4161. s.a11y.notify(s.params.prevSlideMessage);
  4162. }
  4163. }
  4164. if ($(event.target).is('.' + s.params.bulletClass)) {
  4165. $(event.target)[0].click();
  4166. }
  4167. },
  4168. liveRegion: $('<span class="' + s.params.notificationClass + '" aria-live="assertive" aria-atomic="true"></span>'),
  4169. notify: function notify(message) {
  4170. var notification = s.a11y.liveRegion;
  4171. if (notification.length === 0) return;
  4172. notification.html('');
  4173. notification.html(message);
  4174. },
  4175. init: function init() {
  4176. // Setup accessibility
  4177. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  4178. s.a11y.makeFocusable(s.nextButton);
  4179. s.a11y.addRole(s.nextButton, 'button');
  4180. s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
  4181. }
  4182. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  4183. s.a11y.makeFocusable(s.prevButton);
  4184. s.a11y.addRole(s.prevButton, 'button');
  4185. s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
  4186. }
  4187. $(s.container).append(s.a11y.liveRegion);
  4188. },
  4189. initPagination: function initPagination() {
  4190. if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
  4191. s.bullets.each(function () {
  4192. var bullet = $(this);
  4193. s.a11y.makeFocusable(bullet);
  4194. s.a11y.addRole(bullet, 'button');
  4195. s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
  4196. });
  4197. }
  4198. },
  4199. destroy: function destroy() {
  4200. if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
  4201. }
  4202. };
  4203. /*=========================
  4204. Init/Destroy
  4205. ===========================*/
  4206. s.init = function () {
  4207. if (s.params.loop) s.createLoop();
  4208. s.updateContainerSize();
  4209. s.updateSlidesSize();
  4210. s.updatePagination();
  4211. if (s.params.scrollbar && s.scrollbar) {
  4212. s.scrollbar.set();
  4213. if (s.params.scrollbarDraggable) {
  4214. s.scrollbar.enableDraggable();
  4215. }
  4216. }
  4217. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  4218. if (!s.params.loop) s.updateProgress();
  4219. s.effects[s.params.effect].setTranslate();
  4220. }
  4221. if (s.params.loop) {
  4222. s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
  4223. } else {
  4224. s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
  4225. if (s.params.initialSlide === 0) {
  4226. if (s.parallax && s.params.parallax) s.parallax.setTranslate();
  4227. if (s.lazy && s.params.lazyLoading) {
  4228. s.lazy.load();
  4229. s.lazy.initialImageLoaded = true;
  4230. }
  4231. }
  4232. }
  4233. s.attachEvents();
  4234. if (s.params.observer && s.support.observer) {
  4235. s.initObservers();
  4236. }
  4237. if (s.params.preloadImages && !s.params.lazyLoading) {
  4238. s.preloadImages();
  4239. }
  4240. if (s.params.zoom && s.zoom) {
  4241. s.zoom.init();
  4242. }
  4243. if (s.params.autoplay) {
  4244. s.startAutoplay();
  4245. }
  4246. if (s.params.keyboardControl) {
  4247. if (s.enableKeyboardControl) s.enableKeyboardControl();
  4248. }
  4249. if (s.params.mousewheelControl) {
  4250. if (s.enableMousewheelControl) s.enableMousewheelControl();
  4251. }
  4252. // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history
  4253. if (s.params.hashnavReplaceState) {
  4254. s.params.replaceState = s.params.hashnavReplaceState;
  4255. }
  4256. if (s.params.history) {
  4257. if (s.history) s.history.init();
  4258. }
  4259. if (s.params.hashnav) {
  4260. if (s.hashnav) s.hashnav.init();
  4261. }
  4262. if (s.params.a11y && s.a11y) s.a11y.init();
  4263. s.emit('onInit', s);
  4264. };
  4265. // Cleanup dynamic styles
  4266. s.cleanupStyles = function () {
  4267. // Container
  4268. s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
  4269. // Wrapper
  4270. s.wrapper.removeAttr('style');
  4271. // Slides
  4272. if (s.slides && s.slides.length) {
  4273. s.slides.removeClass([s.params.slideVisibleClass, s.params.slideActiveClass, s.params.slideNextClass, s.params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-column').removeAttr('data-swiper-row');
  4274. }
  4275. // Pagination/Bullets
  4276. if (s.paginationContainer && s.paginationContainer.length) {
  4277. s.paginationContainer.removeClass(s.params.paginationHiddenClass);
  4278. }
  4279. if (s.bullets && s.bullets.length) {
  4280. s.bullets.removeClass(s.params.bulletActiveClass);
  4281. }
  4282. // Buttons
  4283. if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
  4284. if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
  4285. // Scrollbar
  4286. if (s.params.scrollbar && s.scrollbar) {
  4287. if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
  4288. if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
  4289. }
  4290. };
  4291. // Destroy
  4292. s.destroy = function (deleteInstance, cleanupStyles) {
  4293. // Detach evebts
  4294. s.detachEvents();
  4295. // Stop autoplay
  4296. s.stopAutoplay();
  4297. // Disable draggable
  4298. if (s.params.scrollbar && s.scrollbar) {
  4299. if (s.params.scrollbarDraggable) {
  4300. s.scrollbar.disableDraggable();
  4301. }
  4302. }
  4303. // Destroy loop
  4304. if (s.params.loop) {
  4305. s.destroyLoop();
  4306. }
  4307. // Cleanup styles
  4308. if (cleanupStyles) {
  4309. s.cleanupStyles();
  4310. }
  4311. // Disconnect observer
  4312. s.disconnectObservers();
  4313. // Destroy zoom
  4314. if (s.params.zoom && s.zoom) {
  4315. s.zoom.destroy();
  4316. }
  4317. // Disable keyboard/mousewheel
  4318. if (s.params.keyboardControl) {
  4319. if (s.disableKeyboardControl) s.disableKeyboardControl();
  4320. }
  4321. if (s.params.mousewheelControl) {
  4322. if (s.disableMousewheelControl) s.disableMousewheelControl();
  4323. }
  4324. // Disable a11y
  4325. if (s.params.a11y && s.a11y) s.a11y.destroy();
  4326. // Delete history popstate
  4327. if (s.params.history && !s.params.replaceState) {
  4328. window.removeEventListener('popstate', s.history.setHistoryPopState);
  4329. }
  4330. if (s.params.hashnav && s.hashnav) {
  4331. s.hashnav.destroy();
  4332. }
  4333. // Destroy callback
  4334. s.emit('onDestroy');
  4335. // Delete instance
  4336. if (deleteInstance !== false) s = null;
  4337. };
  4338. s.init();
  4339. // Return swiper instance
  4340. return s;
  4341. };
  4342. /*==================================================
  4343. Prototype
  4344. ====================================================*/
  4345. Swiper.prototype = {
  4346. isSafari: function () {
  4347. var ua = window.navigator.userAgent.toLowerCase();
  4348. return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
  4349. }(),
  4350. isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
  4351. isArray: function isArray(arr) {
  4352. return Object.prototype.toString.apply(arr) === '[object Array]';
  4353. },
  4354. /*==================================================
  4355. Browser
  4356. ====================================================*/
  4357. browser: {
  4358. ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
  4359. ieTouch: window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1,
  4360. lteIE9: function () {
  4361. // create temporary DIV
  4362. var div = document.createElement('div');
  4363. // add content to tmp DIV which is wrapped into the IE HTML conditional statement
  4364. div.innerHTML = '<!--[if lte IE 9]><i></i><![endif]-->';
  4365. // return true / false value based on what will browser render
  4366. return div.getElementsByTagName('i').length === 1;
  4367. }()
  4368. },
  4369. /*==================================================
  4370. Devices
  4371. ====================================================*/
  4372. device: function () {
  4373. var ua = window.navigator.userAgent;
  4374. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  4375. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  4376. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  4377. var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
  4378. return {
  4379. ios: ipad || iphone || ipod,
  4380. android: android
  4381. };
  4382. }(),
  4383. /*==================================================
  4384. Feature Detection
  4385. ====================================================*/
  4386. support: {
  4387. touch: window.Modernizr && Modernizr.touch === true || function () {
  4388. return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch);
  4389. }(),
  4390. transforms3d: window.Modernizr && Modernizr.csstransforms3d === true || function () {
  4391. var div = document.createElement('div').style;
  4392. return 'webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div;
  4393. }(),
  4394. flexbox: function () {
  4395. var div = document.createElement('div').style;
  4396. var styles = 'alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient'.split(' ');
  4397. for (var i = 0; i < styles.length; i++) {
  4398. if (styles[i] in div) return true;
  4399. }
  4400. }(),
  4401. observer: function () {
  4402. return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
  4403. }(),
  4404. passiveListener: function () {
  4405. var supportsPassive = false;
  4406. try {
  4407. var opts = Object.defineProperty({}, 'passive', {
  4408. get: function get() {
  4409. supportsPassive = true;
  4410. }
  4411. });
  4412. window.addEventListener('testPassiveListener', null, opts);
  4413. } catch (e) {}
  4414. return supportsPassive;
  4415. }(),
  4416. gestures: function () {
  4417. return 'ongesturestart' in window;
  4418. }()
  4419. },
  4420. /*==================================================
  4421. Plugins
  4422. ====================================================*/
  4423. plugins: {}
  4424. };
  4425. /*===========================
  4426. Dom7 Library
  4427. ===========================*/
  4428. var Dom7 = function () {
  4429. var Dom7 = function Dom7(arr) {
  4430. var _this = this,
  4431. i = 0;
  4432. // Create array-like object
  4433. for (i = 0; i < arr.length; i++) {
  4434. _this[i] = arr[i];
  4435. }
  4436. _this.length = arr.length;
  4437. // Return collection with methods
  4438. return this;
  4439. };
  4440. var $ = function $(selector, context) {
  4441. var arr = [],
  4442. i = 0;
  4443. if (selector && !context) {
  4444. if (selector instanceof Dom7) {
  4445. return selector;
  4446. }
  4447. }
  4448. if (selector) {
  4449. // String
  4450. if (typeof selector === 'string') {
  4451. var els,
  4452. tempParent,
  4453. html = selector.trim();
  4454. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  4455. var toCreate = 'div';
  4456. if (html.indexOf('<li') === 0) toCreate = 'ul';
  4457. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  4458. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  4459. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  4460. if (html.indexOf('<option') === 0) toCreate = 'select';
  4461. tempParent = document.createElement(toCreate);
  4462. tempParent.innerHTML = selector;
  4463. for (i = 0; i < tempParent.childNodes.length; i++) {
  4464. arr.push(tempParent.childNodes[i]);
  4465. }
  4466. } else {
  4467. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  4468. // Pure ID selector
  4469. els = [document.getElementById(selector.split('#')[1])];
  4470. } else {
  4471. // Other selectors
  4472. els = (context || document).querySelectorAll(selector);
  4473. }
  4474. for (i = 0; i < els.length; i++) {
  4475. if (els[i]) arr.push(els[i]);
  4476. }
  4477. }
  4478. }
  4479. // Node/element
  4480. else if (selector.nodeType || selector === window || selector === document) {
  4481. arr.push(selector);
  4482. }
  4483. //Array of elements or instance of Dom
  4484. else if (selector.length > 0 && selector[0].nodeType) {
  4485. for (i = 0; i < selector.length; i++) {
  4486. arr.push(selector[i]);
  4487. }
  4488. }
  4489. }
  4490. return new Dom7(arr);
  4491. };
  4492. Dom7.prototype = {
  4493. // Classes and attriutes
  4494. addClass: function addClass(className) {
  4495. if (typeof className === 'undefined') {
  4496. return this;
  4497. }
  4498. var classes = className.split(' ');
  4499. for (var i = 0; i < classes.length; i++) {
  4500. for (var j = 0; j < this.length; j++) {
  4501. this[j].classList.add(classes[i]);
  4502. }
  4503. }
  4504. return this;
  4505. },
  4506. removeClass: function removeClass(className) {
  4507. var classes = className.split(' ');
  4508. for (var i = 0; i < classes.length; i++) {
  4509. for (var j = 0; j < this.length; j++) {
  4510. this[j].classList.remove(classes[i]);
  4511. }
  4512. }
  4513. return this;
  4514. },
  4515. hasClass: function hasClass(className) {
  4516. if (!this[0]) return false;else return this[0].classList.contains(className);
  4517. },
  4518. toggleClass: function toggleClass(className) {
  4519. var classes = className.split(' ');
  4520. for (var i = 0; i < classes.length; i++) {
  4521. for (var j = 0; j < this.length; j++) {
  4522. this[j].classList.toggle(classes[i]);
  4523. }
  4524. }
  4525. return this;
  4526. },
  4527. attr: function attr(attrs, value) {
  4528. if (arguments.length === 1 && typeof attrs === 'string') {
  4529. // Get attr
  4530. if (this[0]) return this[0].getAttribute(attrs);else return undefined;
  4531. } else {
  4532. // Set attrs
  4533. for (var i = 0; i < this.length; i++) {
  4534. if (arguments.length === 2) {
  4535. // String
  4536. this[i].setAttribute(attrs, value);
  4537. } else {
  4538. // Object
  4539. for (var attrName in attrs) {
  4540. this[i][attrName] = attrs[attrName];
  4541. this[i].setAttribute(attrName, attrs[attrName]);
  4542. }
  4543. }
  4544. }
  4545. return this;
  4546. }
  4547. },
  4548. removeAttr: function removeAttr(attr) {
  4549. for (var i = 0; i < this.length; i++) {
  4550. this[i].removeAttribute(attr);
  4551. }
  4552. return this;
  4553. },
  4554. data: function data(key, value) {
  4555. if (typeof value === 'undefined') {
  4556. // Get value
  4557. if (this[0]) {
  4558. var dataKey = this[0].getAttribute('data-' + key);
  4559. if (dataKey) return dataKey;else if (this[0].dom7ElementDataStorage && key in this[0].dom7ElementDataStorage) return this[0].dom7ElementDataStorage[key];else return undefined;
  4560. } else return undefined;
  4561. } else {
  4562. // Set value
  4563. for (var i = 0; i < this.length; i++) {
  4564. var el = this[i];
  4565. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  4566. el.dom7ElementDataStorage[key] = value;
  4567. }
  4568. return this;
  4569. }
  4570. },
  4571. // Transforms
  4572. transform: function transform(_transform) {
  4573. for (var i = 0; i < this.length; i++) {
  4574. var elStyle = this[i].style;
  4575. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = _transform;
  4576. }
  4577. return this;
  4578. },
  4579. transition: function transition(duration) {
  4580. if (typeof duration !== 'string') {
  4581. duration = duration + 'ms';
  4582. }
  4583. for (var i = 0; i < this.length; i++) {
  4584. var elStyle = this[i].style;
  4585. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  4586. }
  4587. return this;
  4588. },
  4589. //Events
  4590. on: function on(eventName, targetSelector, listener, capture) {
  4591. function handleLiveEvent(e) {
  4592. var target = e.target;
  4593. if ($(target).is(targetSelector)) listener.call(target, e);else {
  4594. var parents = $(target).parents();
  4595. for (var k = 0; k < parents.length; k++) {
  4596. if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);
  4597. }
  4598. }
  4599. }
  4600. var events = eventName.split(' ');
  4601. var i, j;
  4602. for (i = 0; i < this.length; i++) {
  4603. if (typeof targetSelector === 'function' || targetSelector === false) {
  4604. // Usual events
  4605. if (typeof targetSelector === 'function') {
  4606. listener = arguments[1];
  4607. capture = arguments[2] || false;
  4608. }
  4609. for (j = 0; j < events.length; j++) {
  4610. this[i].addEventListener(events[j], listener, capture);
  4611. }
  4612. } else {
  4613. //Live events
  4614. for (j = 0; j < events.length; j++) {
  4615. if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];
  4616. this[i].dom7LiveListeners.push({ listener: listener, liveListener: handleLiveEvent });
  4617. this[i].addEventListener(events[j], handleLiveEvent, capture);
  4618. }
  4619. }
  4620. }
  4621. return this;
  4622. },
  4623. off: function off(eventName, targetSelector, listener, capture) {
  4624. var events = eventName.split(' ');
  4625. for (var i = 0; i < events.length; i++) {
  4626. for (var j = 0; j < this.length; j++) {
  4627. if (typeof targetSelector === 'function' || targetSelector === false) {
  4628. // Usual events
  4629. if (typeof targetSelector === 'function') {
  4630. listener = arguments[1];
  4631. capture = arguments[2] || false;
  4632. }
  4633. this[j].removeEventListener(events[i], listener, capture);
  4634. } else {
  4635. // Live event
  4636. if (this[j].dom7LiveListeners) {
  4637. for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
  4638. if (this[j].dom7LiveListeners[k].listener === listener) {
  4639. this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
  4640. }
  4641. }
  4642. }
  4643. }
  4644. }
  4645. }
  4646. return this;
  4647. },
  4648. once: function once(eventName, targetSelector, listener, capture) {
  4649. var dom = this;
  4650. if (typeof targetSelector === 'function') {
  4651. targetSelector = false;
  4652. listener = arguments[1];
  4653. capture = arguments[2];
  4654. }
  4655. function proxy(e) {
  4656. listener(e);
  4657. dom.off(eventName, targetSelector, proxy, capture);
  4658. }
  4659. dom.on(eventName, targetSelector, proxy, capture);
  4660. },
  4661. trigger: function trigger(eventName, eventData) {
  4662. for (var i = 0; i < this.length; i++) {
  4663. var evt;
  4664. try {
  4665. evt = new window.CustomEvent(eventName, { detail: eventData, bubbles: true, cancelable: true });
  4666. } catch (e) {
  4667. evt = document.createEvent('Event');
  4668. evt.initEvent(eventName, true, true);
  4669. evt.detail = eventData;
  4670. }
  4671. this[i].dispatchEvent(evt);
  4672. }
  4673. return this;
  4674. },
  4675. transitionEnd: function transitionEnd(callback) {
  4676. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  4677. i,
  4678. j,
  4679. dom = this;
  4680. function fireCallBack(e) {
  4681. /*jshint validthis:true */
  4682. if (e.target !== this) return;
  4683. callback.call(this, e);
  4684. for (i = 0; i < events.length; i++) {
  4685. dom.off(events[i], fireCallBack);
  4686. }
  4687. }
  4688. if (callback) {
  4689. for (i = 0; i < events.length; i++) {
  4690. dom.on(events[i], fireCallBack);
  4691. }
  4692. }
  4693. return this;
  4694. },
  4695. // Sizing/Styles
  4696. width: function width() {
  4697. if (this[0] === window) {
  4698. return window.innerWidth;
  4699. } else {
  4700. if (this.length > 0) {
  4701. return parseFloat(this.css('width'));
  4702. } else {
  4703. return null;
  4704. }
  4705. }
  4706. },
  4707. outerWidth: function outerWidth(includeMargins) {
  4708. if (this.length > 0) {
  4709. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  4710. } else return null;
  4711. },
  4712. height: function height() {
  4713. if (this[0] === window) {
  4714. return window.innerHeight;
  4715. } else {
  4716. if (this.length > 0) {
  4717. return parseFloat(this.css('height'));
  4718. } else {
  4719. return null;
  4720. }
  4721. }
  4722. },
  4723. outerHeight: function outerHeight(includeMargins) {
  4724. if (this.length > 0) {
  4725. if (includeMargins) return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));else return this[0].offsetHeight;
  4726. } else return null;
  4727. },
  4728. offset: function offset() {
  4729. if (this.length > 0) {
  4730. var el = this[0];
  4731. var box = el.getBoundingClientRect();
  4732. var body = document.body;
  4733. var clientTop = el.clientTop || body.clientTop || 0;
  4734. var clientLeft = el.clientLeft || body.clientLeft || 0;
  4735. var scrollTop = window.pageYOffset || el.scrollTop;
  4736. var scrollLeft = window.pageXOffset || el.scrollLeft;
  4737. return {
  4738. top: box.top + scrollTop - clientTop,
  4739. left: box.left + scrollLeft - clientLeft
  4740. };
  4741. } else {
  4742. return null;
  4743. }
  4744. },
  4745. css: function css(props, value) {
  4746. var i;
  4747. if (arguments.length === 1) {
  4748. if (typeof props === 'string') {
  4749. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  4750. } else {
  4751. for (i = 0; i < this.length; i++) {
  4752. for (var prop in props) {
  4753. this[i].style[prop] = props[prop];
  4754. }
  4755. }
  4756. return this;
  4757. }
  4758. }
  4759. if (arguments.length === 2 && typeof props === 'string') {
  4760. for (i = 0; i < this.length; i++) {
  4761. this[i].style[props] = value;
  4762. }
  4763. return this;
  4764. }
  4765. return this;
  4766. },
  4767. //Dom manipulation
  4768. each: function each(callback) {
  4769. for (var i = 0; i < this.length; i++) {
  4770. callback.call(this[i], i, this[i]);
  4771. }
  4772. return this;
  4773. },
  4774. html: function html(_html) {
  4775. if (typeof _html === 'undefined') {
  4776. return this[0] ? this[0].innerHTML : undefined;
  4777. } else {
  4778. for (var i = 0; i < this.length; i++) {
  4779. this[i].innerHTML = _html;
  4780. }
  4781. return this;
  4782. }
  4783. },
  4784. text: function text(_text) {
  4785. if (typeof _text === 'undefined') {
  4786. if (this[0]) {
  4787. return this[0].textContent.trim();
  4788. } else return null;
  4789. } else {
  4790. for (var i = 0; i < this.length; i++) {
  4791. this[i].textContent = _text;
  4792. }
  4793. return this;
  4794. }
  4795. },
  4796. is: function is(selector) {
  4797. if (!this[0]) return false;
  4798. var compareWith, i;
  4799. if (typeof selector === 'string') {
  4800. var el = this[0];
  4801. if (el === document) return selector === document;
  4802. if (el === window) return selector === window;
  4803. if (el.matches) return el.matches(selector);else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);else if (el.msMatchesSelector) return el.msMatchesSelector(selector);else {
  4804. compareWith = $(selector);
  4805. for (i = 0; i < compareWith.length; i++) {
  4806. if (compareWith[i] === this[0]) return true;
  4807. }
  4808. return false;
  4809. }
  4810. } else if (selector === document) return this[0] === document;else if (selector === window) return this[0] === window;else {
  4811. if (selector.nodeType || selector instanceof Dom7) {
  4812. compareWith = selector.nodeType ? [selector] : selector;
  4813. for (i = 0; i < compareWith.length; i++) {
  4814. if (compareWith[i] === this[0]) return true;
  4815. }
  4816. return false;
  4817. }
  4818. return false;
  4819. }
  4820. },
  4821. index: function index() {
  4822. if (this[0]) {
  4823. var child = this[0];
  4824. var i = 0;
  4825. while ((child = child.previousSibling) !== null) {
  4826. if (child.nodeType === 1) i++;
  4827. }
  4828. return i;
  4829. } else return undefined;
  4830. },
  4831. eq: function eq(index) {
  4832. if (typeof index === 'undefined') return this;
  4833. var length = this.length;
  4834. var returnIndex;
  4835. if (index > length - 1) {
  4836. return new Dom7([]);
  4837. }
  4838. if (index < 0) {
  4839. returnIndex = length + index;
  4840. if (returnIndex < 0) return new Dom7([]);else return new Dom7([this[returnIndex]]);
  4841. }
  4842. return new Dom7([this[index]]);
  4843. },
  4844. append: function append(newChild) {
  4845. var i, j;
  4846. for (i = 0; i < this.length; i++) {
  4847. if (typeof newChild === 'string') {
  4848. var tempDiv = document.createElement('div');
  4849. tempDiv.innerHTML = newChild;
  4850. while (tempDiv.firstChild) {
  4851. this[i].appendChild(tempDiv.firstChild);
  4852. }
  4853. } else if (newChild instanceof Dom7) {
  4854. for (j = 0; j < newChild.length; j++) {
  4855. this[i].appendChild(newChild[j]);
  4856. }
  4857. } else {
  4858. this[i].appendChild(newChild);
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. prepend: function prepend(newChild) {
  4864. var i, j;
  4865. for (i = 0; i < this.length; i++) {
  4866. if (typeof newChild === 'string') {
  4867. var tempDiv = document.createElement('div');
  4868. tempDiv.innerHTML = newChild;
  4869. for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
  4870. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  4871. }
  4872. // this[i].insertAdjacentHTML('afterbegin', newChild);
  4873. } else if (newChild instanceof Dom7) {
  4874. for (j = 0; j < newChild.length; j++) {
  4875. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  4876. }
  4877. } else {
  4878. this[i].insertBefore(newChild, this[i].childNodes[0]);
  4879. }
  4880. }
  4881. return this;
  4882. },
  4883. insertBefore: function insertBefore(selector) {
  4884. var before = $(selector);
  4885. for (var i = 0; i < this.length; i++) {
  4886. if (before.length === 1) {
  4887. before[0].parentNode.insertBefore(this[i], before[0]);
  4888. } else if (before.length > 1) {
  4889. for (var j = 0; j < before.length; j++) {
  4890. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  4891. }
  4892. }
  4893. }
  4894. },
  4895. insertAfter: function insertAfter(selector) {
  4896. var after = $(selector);
  4897. for (var i = 0; i < this.length; i++) {
  4898. if (after.length === 1) {
  4899. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  4900. } else if (after.length > 1) {
  4901. for (var j = 0; j < after.length; j++) {
  4902. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  4903. }
  4904. }
  4905. }
  4906. },
  4907. next: function next(selector) {
  4908. if (this.length > 0) {
  4909. if (selector) {
  4910. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4911. } else {
  4912. if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4913. }
  4914. } else return new Dom7([]);
  4915. },
  4916. nextAll: function nextAll(selector) {
  4917. var nextEls = [];
  4918. var el = this[0];
  4919. if (!el) return new Dom7([]);
  4920. while (el.nextElementSibling) {
  4921. var next = el.nextElementSibling;
  4922. if (selector) {
  4923. if ($(next).is(selector)) nextEls.push(next);
  4924. } else nextEls.push(next);
  4925. el = next;
  4926. }
  4927. return new Dom7(nextEls);
  4928. },
  4929. prev: function prev(selector) {
  4930. if (this.length > 0) {
  4931. if (selector) {
  4932. if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4933. } else {
  4934. if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4935. }
  4936. } else return new Dom7([]);
  4937. },
  4938. prevAll: function prevAll(selector) {
  4939. var prevEls = [];
  4940. var el = this[0];
  4941. if (!el) return new Dom7([]);
  4942. while (el.previousElementSibling) {
  4943. var prev = el.previousElementSibling;
  4944. if (selector) {
  4945. if ($(prev).is(selector)) prevEls.push(prev);
  4946. } else prevEls.push(prev);
  4947. el = prev;
  4948. }
  4949. return new Dom7(prevEls);
  4950. },
  4951. parent: function parent(selector) {
  4952. var parents = [];
  4953. for (var i = 0; i < this.length; i++) {
  4954. if (selector) {
  4955. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  4956. } else {
  4957. parents.push(this[i].parentNode);
  4958. }
  4959. }
  4960. return $($.unique(parents));
  4961. },
  4962. parents: function parents(selector) {
  4963. var parents = [];
  4964. for (var i = 0; i < this.length; i++) {
  4965. var parent = this[i].parentNode;
  4966. while (parent) {
  4967. if (selector) {
  4968. if ($(parent).is(selector)) parents.push(parent);
  4969. } else {
  4970. parents.push(parent);
  4971. }
  4972. parent = parent.parentNode;
  4973. }
  4974. }
  4975. return $($.unique(parents));
  4976. },
  4977. find: function find(selector) {
  4978. var foundElements = [];
  4979. for (var i = 0; i < this.length; i++) {
  4980. var found = this[i].querySelectorAll(selector);
  4981. for (var j = 0; j < found.length; j++) {
  4982. foundElements.push(found[j]);
  4983. }
  4984. }
  4985. return new Dom7(foundElements);
  4986. },
  4987. children: function children(selector) {
  4988. var children = [];
  4989. for (var i = 0; i < this.length; i++) {
  4990. var childNodes = this[i].childNodes;
  4991. for (var j = 0; j < childNodes.length; j++) {
  4992. if (!selector) {
  4993. if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
  4994. } else {
  4995. if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);
  4996. }
  4997. }
  4998. }
  4999. return new Dom7($.unique(children));
  5000. },
  5001. remove: function remove() {
  5002. for (var i = 0; i < this.length; i++) {
  5003. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  5004. }
  5005. return this;
  5006. },
  5007. add: function add() {
  5008. var dom = this;
  5009. var i, j;
  5010. for (i = 0; i < arguments.length; i++) {
  5011. var toAdd = $(arguments[i]);
  5012. for (j = 0; j < toAdd.length; j++) {
  5013. dom[dom.length] = toAdd[j];
  5014. dom.length++;
  5015. }
  5016. }
  5017. return dom;
  5018. }
  5019. };
  5020. $.fn = Dom7.prototype;
  5021. $.unique = function (arr) {
  5022. var unique = [];
  5023. for (var i = 0; i < arr.length; i++) {
  5024. if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);
  5025. }
  5026. return unique;
  5027. };
  5028. return $;
  5029. }();
  5030. /*===========================
  5031. Get Dom libraries
  5032. ===========================*/
  5033. var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
  5034. for (var i = 0; i < swiperDomPlugins.length; i++) {
  5035. if (window[swiperDomPlugins[i]]) {
  5036. addLibraryPlugin(window[swiperDomPlugins[i]]);
  5037. }
  5038. }
  5039. // Required DOM Plugins
  5040. var domLib;
  5041. if (typeof Dom7 === 'undefined') {
  5042. domLib = window.Dom7 || window.Zepto || window.jQuery;
  5043. } else {
  5044. domLib = Dom7;
  5045. }
  5046. /*===========================
  5047. Add .swiper plugin from Dom libraries
  5048. ===========================*/
  5049. function addLibraryPlugin(lib) {
  5050. lib.fn.swiper = function (params) {
  5051. var firstInstance;
  5052. lib(this).each(function () {
  5053. var s = new Swiper(this, params);
  5054. if (!firstInstance) firstInstance = s;
  5055. });
  5056. return firstInstance;
  5057. };
  5058. }
  5059. if (domLib) {
  5060. if (!('transitionEnd' in domLib.fn)) {
  5061. domLib.fn.transitionEnd = function (callback) {
  5062. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  5063. i,
  5064. j,
  5065. dom = this;
  5066. function fireCallBack(e) {
  5067. /*jshint validthis:true */
  5068. if (e.target !== this) return;
  5069. callback.call(this, e);
  5070. for (i = 0; i < events.length; i++) {
  5071. dom.off(events[i], fireCallBack);
  5072. }
  5073. }
  5074. if (callback) {
  5075. for (i = 0; i < events.length; i++) {
  5076. dom.on(events[i], fireCallBack);
  5077. }
  5078. }
  5079. return this;
  5080. };
  5081. }
  5082. if (!('transform' in domLib.fn)) {
  5083. domLib.fn.transform = function (transform) {
  5084. for (var i = 0; i < this.length; i++) {
  5085. var elStyle = this[i].style;
  5086. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
  5087. }
  5088. return this;
  5089. };
  5090. }
  5091. if (!('transition' in domLib.fn)) {
  5092. domLib.fn.transition = function (duration) {
  5093. if (typeof duration !== 'string') {
  5094. duration = duration + 'ms';
  5095. }
  5096. for (var i = 0; i < this.length; i++) {
  5097. var elStyle = this[i].style;
  5098. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  5099. }
  5100. return this;
  5101. };
  5102. }
  5103. if (!('outerWidth' in domLib.fn)) {
  5104. domLib.fn.outerWidth = function (includeMargins) {
  5105. if (this.length > 0) {
  5106. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  5107. } else return null;
  5108. };
  5109. }
  5110. }
  5111. window.Swiper = Swiper;
  5112. })();
  5113. /*===========================
  5114. Swiper AMD Export
  5115. ===========================*/
  5116. if (true) {
  5117. module.exports = window.Swiper;
  5118. } else if (typeof define === 'function' && define.amd) {
  5119. define([], function () {
  5120. 'use strict';
  5121. return window.Swiper;
  5122. });
  5123. }
  5124. //# sourceMappingURL=maps/swiper.js.map
  5125. /***/ }),
  5126. /* 5 */
  5127. /***/ (function(module, exports, __webpack_require__) {
  5128. "use strict";
  5129. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5130. 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; };
  5131. /*! tether-drop 1.4.1 */
  5132. (function (root, factory) {
  5133. if (true) {
  5134. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(34)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  5135. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  5136. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  5137. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5138. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  5139. module.exports = factory(require('tether'));
  5140. } else {
  5141. root.Drop = factory(root.Tether);
  5142. }
  5143. })(undefined, function (Tether) {
  5144. /* global Tether */
  5145. 'use strict';
  5146. var _bind = Function.prototype.bind;
  5147. var _slicedToArray = function () {
  5148. function sliceIterator(arr, i) {
  5149. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  5150. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  5151. _arr.push(_s.value);if (i && _arr.length === i) break;
  5152. }
  5153. } catch (err) {
  5154. _d = true;_e = err;
  5155. } finally {
  5156. try {
  5157. if (!_n && _i['return']) _i['return']();
  5158. } finally {
  5159. if (_d) throw _e;
  5160. }
  5161. }return _arr;
  5162. }return function (arr, i) {
  5163. if (Array.isArray(arr)) {
  5164. return arr;
  5165. } else if (Symbol.iterator in Object(arr)) {
  5166. return sliceIterator(arr, i);
  5167. } else {
  5168. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  5169. }
  5170. };
  5171. }();
  5172. var _createClass = function () {
  5173. function defineProperties(target, props) {
  5174. for (var i = 0; i < props.length; i++) {
  5175. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  5176. }
  5177. }return function (Constructor, protoProps, staticProps) {
  5178. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  5179. };
  5180. }();
  5181. var _get = function get(_x2, _x3, _x4) {
  5182. var _again = true;_function: while (_again) {
  5183. var object = _x2,
  5184. property = _x3,
  5185. receiver = _x4;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  5186. var parent = Object.getPrototypeOf(object);if (parent === null) {
  5187. return undefined;
  5188. } else {
  5189. _x2 = parent;_x3 = property;_x4 = receiver;_again = true;desc = parent = undefined;continue _function;
  5190. }
  5191. } else if ('value' in desc) {
  5192. return desc.value;
  5193. } else {
  5194. var getter = desc.get;if (getter === undefined) {
  5195. return undefined;
  5196. }return getter.call(receiver);
  5197. }
  5198. }
  5199. };
  5200. function _classCallCheck(instance, Constructor) {
  5201. if (!(instance instanceof Constructor)) {
  5202. throw new TypeError('Cannot call a class as a function');
  5203. }
  5204. }
  5205. function _inherits(subClass, superClass) {
  5206. if (typeof superClass !== 'function' && superClass !== null) {
  5207. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  5208. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  5209. }
  5210. var _Tether$Utils = Tether.Utils;
  5211. var extend = _Tether$Utils.extend;
  5212. var addClass = _Tether$Utils.addClass;
  5213. var removeClass = _Tether$Utils.removeClass;
  5214. var hasClass = _Tether$Utils.hasClass;
  5215. var Evented = _Tether$Utils.Evented;
  5216. function sortAttach(str) {
  5217. var _str$split = str.split(' ');
  5218. var _str$split2 = _slicedToArray(_str$split, 2);
  5219. var first = _str$split2[0];
  5220. var second = _str$split2[1];
  5221. if (['left', 'right'].indexOf(first) >= 0) {
  5222. var _ref = [second, first];
  5223. first = _ref[0];
  5224. second = _ref[1];
  5225. }
  5226. return [first, second].join(' ');
  5227. }
  5228. function removeFromArray(arr, item) {
  5229. var index = undefined;
  5230. var results = [];
  5231. while ((index = arr.indexOf(item)) !== -1) {
  5232. results.push(arr.splice(index, 1));
  5233. }
  5234. return results;
  5235. }
  5236. var clickEvents = ['click'];
  5237. var transitionEndEvents = {
  5238. 'WebkitTransition': 'webkitTransitionEnd',
  5239. 'MozTransition': 'transitionend',
  5240. 'OTransition': 'otransitionend',
  5241. 'transition': 'transitionend'
  5242. };
  5243. var transitionEndEvent = '';
  5244. for (var _name in transitionEndEvents) {
  5245. if ({}.hasOwnProperty.call(transitionEndEvents, _name)) {
  5246. var tempEl = document.createElement('p');
  5247. if (typeof tempEl.style[_name] !== 'undefined') {
  5248. transitionEndEvent = transitionEndEvents[_name];
  5249. }
  5250. }
  5251. }
  5252. var MIRROR_ATTACH = {
  5253. left: 'right',
  5254. right: 'left',
  5255. top: 'bottom',
  5256. bottom: 'top',
  5257. middle: 'middle',
  5258. center: 'center'
  5259. };
  5260. var allDrops = {};
  5261. // Drop can be included in external libraries. Calling createContext gives you a fresh
  5262. // copy of drop which won't interact with other copies on the page (beyond calling the document events).
  5263. function createContext() {
  5264. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  5265. var drop = function drop() {
  5266. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5267. args[_key] = arguments[_key];
  5268. }
  5269. return new (_bind.apply(DropInstance, [null].concat(args)))();
  5270. };
  5271. extend(drop, {
  5272. createContext: createContext,
  5273. drops: [],
  5274. defaults: {}
  5275. });
  5276. var defaultOptions = {
  5277. classPrefix: 'drop',
  5278. defaults: {
  5279. position: 'bottom left',
  5280. openOn: 'click',
  5281. beforeClose: null,
  5282. constrainToScrollParent: true,
  5283. constrainToWindow: true,
  5284. classes: '',
  5285. remove: false,
  5286. openDelay: 0,
  5287. closeDelay: 50,
  5288. // inherited from openDelay and closeDelay if not explicitly defined
  5289. focusDelay: null,
  5290. blurDelay: null,
  5291. hoverOpenDelay: null,
  5292. hoverCloseDelay: null,
  5293. tetherOptions: {}
  5294. }
  5295. };
  5296. extend(drop, defaultOptions, options);
  5297. extend(drop.defaults, defaultOptions.defaults, options.defaults);
  5298. if (typeof allDrops[drop.classPrefix] === 'undefined') {
  5299. allDrops[drop.classPrefix] = [];
  5300. }
  5301. drop.updateBodyClasses = function () {
  5302. // There is only one body, so despite the context concept, we still iterate through all
  5303. // drops which share our classPrefix.
  5304. var anyOpen = false;
  5305. var drops = allDrops[drop.classPrefix];
  5306. var len = drops.length;
  5307. for (var i = 0; i < len; ++i) {
  5308. if (drops[i].isOpened()) {
  5309. anyOpen = true;
  5310. break;
  5311. }
  5312. }
  5313. if (anyOpen) {
  5314. addClass(document.body, drop.classPrefix + '-open');
  5315. } else {
  5316. removeClass(document.body, drop.classPrefix + '-open');
  5317. }
  5318. };
  5319. var DropInstance = function (_Evented) {
  5320. _inherits(DropInstance, _Evented);
  5321. function DropInstance(opts) {
  5322. _classCallCheck(this, DropInstance);
  5323. _get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this);
  5324. this.options = extend({}, drop.defaults, opts);
  5325. this.target = this.options.target;
  5326. if (typeof this.target === 'undefined') {
  5327. throw new Error('Drop Error: You must provide a target.');
  5328. }
  5329. var dataPrefix = 'data-' + drop.classPrefix;
  5330. var contentAttr = this.target.getAttribute(dataPrefix);
  5331. if (contentAttr && this.options.content == null) {
  5332. this.options.content = contentAttr;
  5333. }
  5334. var attrsOverride = ['position', 'openOn'];
  5335. for (var i = 0; i < attrsOverride.length; ++i) {
  5336. var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]);
  5337. if (override && this.options[attrsOverride[i]] == null) {
  5338. this.options[attrsOverride[i]] = override;
  5339. }
  5340. }
  5341. if (this.options.classes && this.options.addTargetClasses !== false) {
  5342. addClass(this.target, this.options.classes);
  5343. }
  5344. drop.drops.push(this);
  5345. allDrops[drop.classPrefix].push(this);
  5346. this._boundEvents = [];
  5347. this.bindMethods();
  5348. this.setupElements();
  5349. this.setupEvents();
  5350. this.setupTether();
  5351. }
  5352. _createClass(DropInstance, [{
  5353. key: '_on',
  5354. value: function _on(element, event, handler) {
  5355. this._boundEvents.push({ element: element, event: event, handler: handler });
  5356. element.addEventListener(event, handler);
  5357. }
  5358. }, {
  5359. key: 'bindMethods',
  5360. value: function bindMethods() {
  5361. this.transitionEndHandler = this._transitionEndHandler.bind(this);
  5362. }
  5363. }, {
  5364. key: 'setupElements',
  5365. value: function setupElements() {
  5366. var _this = this;
  5367. this.drop = document.createElement('div');
  5368. addClass(this.drop, drop.classPrefix);
  5369. if (this.options.classes) {
  5370. addClass(this.drop, this.options.classes);
  5371. }
  5372. this.content = document.createElement('div');
  5373. addClass(this.content, drop.classPrefix + '-content');
  5374. if (typeof this.options.content === 'function') {
  5375. var generateAndSetContent = function generateAndSetContent() {
  5376. // content function might return a string or an element
  5377. var contentElementOrHTML = _this.options.content.call(_this, _this);
  5378. if (typeof contentElementOrHTML === 'string') {
  5379. _this.content.innerHTML = contentElementOrHTML;
  5380. } else if ((typeof contentElementOrHTML === 'undefined' ? 'undefined' : _typeof(contentElementOrHTML)) === 'object') {
  5381. _this.content.innerHTML = '';
  5382. _this.content.appendChild(contentElementOrHTML);
  5383. } else {
  5384. throw new Error('Drop Error: Content function should return a string or HTMLElement.');
  5385. }
  5386. };
  5387. generateAndSetContent();
  5388. this.on('open', generateAndSetContent.bind(this));
  5389. } else if (_typeof(this.options.content) === 'object') {
  5390. this.content.appendChild(this.options.content);
  5391. } else {
  5392. this.content.innerHTML = this.options.content;
  5393. }
  5394. this.drop.appendChild(this.content);
  5395. }
  5396. }, {
  5397. key: 'setupTether',
  5398. value: function setupTether() {
  5399. // Tether expects two attachment points, one in the target element, one in the
  5400. // drop. We use a single one, and use the order as well, to allow us to put
  5401. // the drop on either side of any of the four corners. This magic converts between
  5402. // the two:
  5403. var dropAttach = this.options.position.split(' ');
  5404. dropAttach[0] = MIRROR_ATTACH[dropAttach[0]];
  5405. dropAttach = dropAttach.join(' ');
  5406. var constraints = [];
  5407. if (this.options.constrainToScrollParent) {
  5408. constraints.push({
  5409. to: 'scrollParent',
  5410. pin: 'top, bottom',
  5411. attachment: 'together none'
  5412. });
  5413. } else {
  5414. // To get 'out of bounds' classes
  5415. constraints.push({
  5416. to: 'scrollParent'
  5417. });
  5418. }
  5419. if (this.options.constrainToWindow !== false) {
  5420. constraints.push({
  5421. to: 'window',
  5422. attachment: 'together'
  5423. });
  5424. } else {
  5425. // To get 'out of bounds' classes
  5426. constraints.push({
  5427. to: 'window'
  5428. });
  5429. }
  5430. var opts = {
  5431. element: this.drop,
  5432. target: this.target,
  5433. attachment: sortAttach(dropAttach),
  5434. targetAttachment: sortAttach(this.options.position),
  5435. classPrefix: drop.classPrefix,
  5436. offset: '0 0',
  5437. targetOffset: '0 0',
  5438. enabled: false,
  5439. constraints: constraints,
  5440. addTargetClasses: this.options.addTargetClasses
  5441. };
  5442. if (this.options.tetherOptions !== false) {
  5443. this.tether = new Tether(extend({}, opts, this.options.tetherOptions));
  5444. }
  5445. }
  5446. }, {
  5447. key: 'setupEvents',
  5448. value: function setupEvents() {
  5449. var _this2 = this;
  5450. if (!this.options.openOn) {
  5451. return;
  5452. }
  5453. if (this.options.openOn === 'always') {
  5454. setTimeout(this.open.bind(this));
  5455. return;
  5456. }
  5457. var events = this.options.openOn.split(' ');
  5458. if (events.indexOf('click') >= 0) {
  5459. var openHandler = function openHandler(event) {
  5460. _this2.toggle(event);
  5461. event.preventDefault();
  5462. };
  5463. var closeHandler = function closeHandler(event) {
  5464. if (!_this2.isOpened()) {
  5465. return;
  5466. }
  5467. // Clicking inside dropdown
  5468. if (event.target === _this2.drop || _this2.drop.contains(event.target)) {
  5469. return;
  5470. }
  5471. // Clicking target
  5472. if (event.target === _this2.target || _this2.target.contains(event.target)) {
  5473. return;
  5474. }
  5475. _this2.close(event);
  5476. };
  5477. for (var i = 0; i < clickEvents.length; ++i) {
  5478. var clickEvent = clickEvents[i];
  5479. this._on(this.target, clickEvent, openHandler);
  5480. this._on(document, clickEvent, closeHandler);
  5481. }
  5482. }
  5483. var inTimeout = null;
  5484. var outTimeout = null;
  5485. var inHandler = function inHandler(event) {
  5486. if (outTimeout !== null) {
  5487. clearTimeout(outTimeout);
  5488. } else {
  5489. inTimeout = setTimeout(function () {
  5490. _this2.open(event);
  5491. inTimeout = null;
  5492. }, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay);
  5493. }
  5494. };
  5495. var outHandler = function outHandler(event) {
  5496. if (inTimeout !== null) {
  5497. clearTimeout(inTimeout);
  5498. } else {
  5499. outTimeout = setTimeout(function () {
  5500. _this2.close(event);
  5501. outTimeout = null;
  5502. }, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay);
  5503. }
  5504. };
  5505. if (events.indexOf('hover') >= 0) {
  5506. this._on(this.target, 'mouseover', inHandler);
  5507. this._on(this.drop, 'mouseover', inHandler);
  5508. this._on(this.target, 'mouseout', outHandler);
  5509. this._on(this.drop, 'mouseout', outHandler);
  5510. }
  5511. if (events.indexOf('focus') >= 0) {
  5512. this._on(this.target, 'focus', inHandler);
  5513. this._on(this.drop, 'focus', inHandler);
  5514. this._on(this.target, 'blur', outHandler);
  5515. this._on(this.drop, 'blur', outHandler);
  5516. }
  5517. }
  5518. }, {
  5519. key: 'isOpened',
  5520. value: function isOpened() {
  5521. if (this.drop) {
  5522. return hasClass(this.drop, drop.classPrefix + '-open');
  5523. }
  5524. }
  5525. }, {
  5526. key: 'toggle',
  5527. value: function toggle(event) {
  5528. if (this.isOpened()) {
  5529. this.close(event);
  5530. } else {
  5531. this.open(event);
  5532. }
  5533. }
  5534. }, {
  5535. key: 'open',
  5536. value: function open(event) {
  5537. var _this3 = this;
  5538. /* eslint no-unused-vars: 0 */
  5539. if (this.isOpened()) {
  5540. return;
  5541. }
  5542. if (!this.drop.parentNode) {
  5543. document.body.appendChild(this.drop);
  5544. }
  5545. if (typeof this.tether !== 'undefined') {
  5546. this.tether.enable();
  5547. }
  5548. addClass(this.drop, drop.classPrefix + '-open');
  5549. addClass(this.drop, drop.classPrefix + '-open-transitionend');
  5550. setTimeout(function () {
  5551. if (_this3.drop) {
  5552. addClass(_this3.drop, drop.classPrefix + '-after-open');
  5553. }
  5554. });
  5555. if (typeof this.tether !== 'undefined') {
  5556. this.tether.position();
  5557. }
  5558. this.trigger('open');
  5559. drop.updateBodyClasses();
  5560. }
  5561. }, {
  5562. key: '_transitionEndHandler',
  5563. value: function _transitionEndHandler(e) {
  5564. if (e.target !== e.currentTarget) {
  5565. return;
  5566. }
  5567. if (!hasClass(this.drop, drop.classPrefix + '-open')) {
  5568. removeClass(this.drop, drop.classPrefix + '-open-transitionend');
  5569. }
  5570. this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler);
  5571. }
  5572. }, {
  5573. key: 'beforeCloseHandler',
  5574. value: function beforeCloseHandler(event) {
  5575. var shouldClose = true;
  5576. if (!this.isClosing && typeof this.options.beforeClose === 'function') {
  5577. this.isClosing = true;
  5578. shouldClose = this.options.beforeClose(event, this) !== false;
  5579. }
  5580. this.isClosing = false;
  5581. return shouldClose;
  5582. }
  5583. }, {
  5584. key: 'close',
  5585. value: function close(event) {
  5586. if (!this.isOpened()) {
  5587. return;
  5588. }
  5589. if (!this.beforeCloseHandler(event)) {
  5590. return;
  5591. }
  5592. removeClass(this.drop, drop.classPrefix + '-open');
  5593. removeClass(this.drop, drop.classPrefix + '-after-open');
  5594. this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler);
  5595. this.trigger('close');
  5596. if (typeof this.tether !== 'undefined') {
  5597. this.tether.disable();
  5598. }
  5599. drop.updateBodyClasses();
  5600. if (this.options.remove) {
  5601. this.remove(event);
  5602. }
  5603. }
  5604. }, {
  5605. key: 'remove',
  5606. value: function remove(event) {
  5607. this.close(event);
  5608. if (this.drop.parentNode) {
  5609. this.drop.parentNode.removeChild(this.drop);
  5610. }
  5611. }
  5612. }, {
  5613. key: 'position',
  5614. value: function position() {
  5615. if (this.isOpened() && typeof this.tether !== 'undefined') {
  5616. this.tether.position();
  5617. }
  5618. }
  5619. }, {
  5620. key: 'destroy',
  5621. value: function destroy() {
  5622. this.remove();
  5623. if (typeof this.tether !== 'undefined') {
  5624. this.tether.destroy();
  5625. }
  5626. for (var i = 0; i < this._boundEvents.length; ++i) {
  5627. var _boundEvents$i = this._boundEvents[i];
  5628. var element = _boundEvents$i.element;
  5629. var _event = _boundEvents$i.event;
  5630. var handler = _boundEvents$i.handler;
  5631. element.removeEventListener(_event, handler);
  5632. }
  5633. this._boundEvents = [];
  5634. this.tether = null;
  5635. this.drop = null;
  5636. this.content = null;
  5637. this.target = null;
  5638. removeFromArray(allDrops[drop.classPrefix], this);
  5639. removeFromArray(drop.drops, this);
  5640. }
  5641. }]);
  5642. return DropInstance;
  5643. }(Evented);
  5644. return drop;
  5645. }
  5646. var Drop = createContext();
  5647. document.addEventListener('DOMContentLoaded', function () {
  5648. Drop.updateBodyClasses();
  5649. });
  5650. return Drop;
  5651. });
  5652. /***/ }),
  5653. /* 6 */
  5654. /***/ (function(module, exports, __webpack_require__) {
  5655. "use strict";
  5656. Object.defineProperty(exports, "__esModule", {
  5657. value: true
  5658. });
  5659. 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; };
  5660. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5661. var _jquery = __webpack_require__(1);
  5662. var _jquery2 = _interopRequireDefault(_jquery);
  5663. var _util = __webpack_require__(0);
  5664. var _util2 = _interopRequireDefault(_util);
  5665. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5666. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5667. /**
  5668. * --------------------------------------------------------------------------
  5669. * Bootstrap (v4.0.0-beta): collapse.js
  5670. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5671. * --------------------------------------------------------------------------
  5672. */
  5673. var Collapse = function () {
  5674. /**
  5675. * ------------------------------------------------------------------------
  5676. * Constants
  5677. * ------------------------------------------------------------------------
  5678. */
  5679. var NAME = 'collapse';
  5680. var VERSION = '4.0.0-beta';
  5681. var DATA_KEY = 'bs.collapse';
  5682. var EVENT_KEY = '.' + DATA_KEY;
  5683. var DATA_API_KEY = '.data-api';
  5684. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  5685. var TRANSITION_DURATION = 600;
  5686. var Default = {
  5687. toggle: true,
  5688. parent: ''
  5689. };
  5690. var DefaultType = {
  5691. toggle: 'boolean',
  5692. parent: '(string|element)'
  5693. };
  5694. var Event = {
  5695. SHOW: 'show' + EVENT_KEY,
  5696. SHOWN: 'shown' + EVENT_KEY,
  5697. HIDE: 'hide' + EVENT_KEY,
  5698. HIDDEN: 'hidden' + EVENT_KEY,
  5699. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  5700. };
  5701. var ClassName = {
  5702. SHOW: 'show',
  5703. COLLAPSE: 'collapse',
  5704. COLLAPSING: 'collapsing',
  5705. COLLAPSED: 'collapsed'
  5706. };
  5707. var Dimension = {
  5708. WIDTH: 'width',
  5709. HEIGHT: 'height'
  5710. };
  5711. var Selector = {
  5712. ACTIVES: '.show, .collapsing',
  5713. DATA_TOGGLE: '[data-toggle="lu-collapse"]'
  5714. /**
  5715. * ------------------------------------------------------------------------
  5716. * Class Definition
  5717. * ------------------------------------------------------------------------
  5718. */
  5719. };
  5720. var Collapse = function () {
  5721. function Collapse(element, config) {
  5722. _classCallCheck(this, Collapse);
  5723. this._isTransitioning = false;
  5724. this._element = element;
  5725. this._config = this._getConfig(config);
  5726. this._triggerArray = _jquery2.default.makeArray((0, _jquery2.default)('[data-toggle="lu-collapse"][href="#' + element.id + '"],' + ('[data-toggle="lu-collapse"][data-target="#' + element.id + '"]')));
  5727. var tabToggles = (0, _jquery2.default)(Selector.DATA_TOGGLE);
  5728. for (var i = 0; i < tabToggles.length; i++) {
  5729. var elem = tabToggles[i];
  5730. var selector = _util2.default.getSelectorFromElement(elem);
  5731. if (selector !== null && (0, _jquery2.default)(selector).filter(element).length > 0) {
  5732. this._triggerArray.push(elem);
  5733. }
  5734. }
  5735. this._parent = this._config.parent ? this._getParent() : null;
  5736. if (!this._config.parent) {
  5737. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  5738. }
  5739. if (this._config.toggle) {
  5740. this.toggle();
  5741. }
  5742. }
  5743. // getters
  5744. _createClass(Collapse, [{
  5745. key: 'toggle',
  5746. // public
  5747. value: function toggle() {
  5748. if ((0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5749. this.hide();
  5750. } else {
  5751. this.show();
  5752. }
  5753. }
  5754. }, {
  5755. key: 'show',
  5756. value: function show() {
  5757. var _this = this;
  5758. if (this._isTransitioning || (0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5759. return;
  5760. }
  5761. var actives = void 0;
  5762. var activesData = void 0;
  5763. if (this._parent) {
  5764. actives = _jquery2.default.makeArray((0, _jquery2.default)(this._parent).children().children(Selector.ACTIVES));
  5765. if (!actives.length) {
  5766. actives = null;
  5767. }
  5768. }
  5769. if (actives) {
  5770. activesData = (0, _jquery2.default)(actives).data(DATA_KEY);
  5771. if (activesData && activesData._isTransitioning) {
  5772. return;
  5773. }
  5774. }
  5775. var startEvent = _jquery2.default.Event(Event.SHOW);
  5776. (0, _jquery2.default)(this._element).trigger(startEvent);
  5777. if (startEvent.isDefaultPrevented()) {
  5778. return;
  5779. }
  5780. if (actives) {
  5781. Collapse._jQueryInterface.call((0, _jquery2.default)(actives), 'hide');
  5782. if (!activesData) {
  5783. (0, _jquery2.default)(actives).data(DATA_KEY, null);
  5784. }
  5785. }
  5786. var dimension = this._getDimension();
  5787. (0, _jquery2.default)(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  5788. this._element.style[dimension] = 0;
  5789. if (this._triggerArray.length) {
  5790. (0, _jquery2.default)(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  5791. }
  5792. this.setTransitioning(true);
  5793. var complete = function complete() {
  5794. (0, _jquery2.default)(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
  5795. _this._element.style[dimension] = '';
  5796. _this.setTransitioning(false);
  5797. (0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
  5798. };
  5799. if (!_util2.default.supportsTransitionEnd()) {
  5800. complete();
  5801. return;
  5802. }
  5803. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  5804. var scrollSize = 'scroll' + capitalizedDimension;
  5805. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5806. this._element.style[dimension] = this._element[scrollSize] + 'px';
  5807. }
  5808. }, {
  5809. key: 'hide',
  5810. value: function hide() {
  5811. var _this2 = this;
  5812. if (this._isTransitioning || !(0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5813. return;
  5814. }
  5815. var startEvent = _jquery2.default.Event(Event.HIDE);
  5816. (0, _jquery2.default)(this._element).trigger(startEvent);
  5817. if (startEvent.isDefaultPrevented()) {
  5818. return;
  5819. }
  5820. var dimension = this._getDimension();
  5821. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
  5822. _util2.default.reflow(this._element);
  5823. (0, _jquery2.default)(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  5824. if (this._triggerArray.length) {
  5825. for (var i = 0; i < this._triggerArray.length; i++) {
  5826. var trigger = this._triggerArray[i];
  5827. var selector = _util2.default.getSelectorFromElement(trigger);
  5828. if (selector !== null) {
  5829. var $elem = (0, _jquery2.default)(selector);
  5830. if (!$elem.hasClass(ClassName.SHOW)) {
  5831. (0, _jquery2.default)(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  5832. }
  5833. }
  5834. }
  5835. }
  5836. this.setTransitioning(true);
  5837. var complete = function complete() {
  5838. _this2.setTransitioning(false);
  5839. (0, _jquery2.default)(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  5840. };
  5841. this._element.style[dimension] = '';
  5842. if (!_util2.default.supportsTransitionEnd()) {
  5843. complete();
  5844. return;
  5845. }
  5846. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5847. }
  5848. }, {
  5849. key: 'setTransitioning',
  5850. value: function setTransitioning(isTransitioning) {
  5851. this._isTransitioning = isTransitioning;
  5852. }
  5853. }, {
  5854. key: 'dispose',
  5855. value: function dispose() {
  5856. _jquery2.default.removeData(this._element, DATA_KEY);
  5857. this._config = null;
  5858. this._parent = null;
  5859. this._element = null;
  5860. this._triggerArray = null;
  5861. this._isTransitioning = null;
  5862. }
  5863. // private
  5864. }, {
  5865. key: '_getConfig',
  5866. value: function _getConfig(config) {
  5867. config = _jquery2.default.extend({}, Default, config);
  5868. config.toggle = Boolean(config.toggle); // coerce string values
  5869. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  5870. return config;
  5871. }
  5872. }, {
  5873. key: '_getDimension',
  5874. value: function _getDimension() {
  5875. var hasWidth = (0, _jquery2.default)(this._element).hasClass(Dimension.WIDTH);
  5876. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  5877. }
  5878. }, {
  5879. key: '_getParent',
  5880. value: function _getParent() {
  5881. var _this3 = this;
  5882. var parent = null;
  5883. if (_util2.default.isElement(this._config.parent)) {
  5884. parent = this._config.parent;
  5885. // it's a jQuery object
  5886. if (typeof this._config.parent.jquery !== 'undefined') {
  5887. parent = this._config.parent[0];
  5888. }
  5889. } else {
  5890. parent = (0, _jquery2.default)(this._config.parent)[0];
  5891. }
  5892. var selector = '[data-toggle="lu-collapse"][data-parent="' + this._config.parent + '"]';
  5893. (0, _jquery2.default)(parent).find(selector).each(function (i, element) {
  5894. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  5895. });
  5896. return parent;
  5897. }
  5898. }, {
  5899. key: '_addAriaAndCollapsedClass',
  5900. value: function _addAriaAndCollapsedClass(element, triggerArray) {
  5901. if (element) {
  5902. var isOpen = (0, _jquery2.default)(element).hasClass(ClassName.SHOW);
  5903. if (triggerArray.length) {
  5904. (0, _jquery2.default)(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  5905. }
  5906. }
  5907. }
  5908. // static
  5909. }], [{
  5910. key: '_getTargetFromElement',
  5911. value: function _getTargetFromElement(element) {
  5912. var selector = _util2.default.getSelectorFromElement(element);
  5913. return selector ? (0, _jquery2.default)(selector)[0] : null;
  5914. }
  5915. }, {
  5916. key: '_jQueryInterface',
  5917. value: function _jQueryInterface(config) {
  5918. return this.each(function () {
  5919. var $this = (0, _jquery2.default)(this);
  5920. var data = $this.data(DATA_KEY);
  5921. var _config = _jquery2.default.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  5922. if (!data && _config.toggle && /show|hide/.test(config)) {
  5923. _config.toggle = false;
  5924. }
  5925. if (!data) {
  5926. data = new Collapse(this, _config);
  5927. $this.data(DATA_KEY, data);
  5928. }
  5929. if (typeof config === 'string') {
  5930. if (typeof data[config] === 'undefined') {
  5931. throw new Error('No method named "' + config + '"');
  5932. }
  5933. data[config]();
  5934. }
  5935. });
  5936. }
  5937. }, {
  5938. key: 'VERSION',
  5939. get: function get() {
  5940. return VERSION;
  5941. }
  5942. }, {
  5943. key: 'Default',
  5944. get: function get() {
  5945. return Default;
  5946. }
  5947. }]);
  5948. return Collapse;
  5949. }();
  5950. /**
  5951. * ------------------------------------------------------------------------
  5952. * Data Api implementation
  5953. * ------------------------------------------------------------------------
  5954. */
  5955. (0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  5956. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  5957. if (event.currentTarget.tagName === 'A') {
  5958. event.preventDefault();
  5959. }
  5960. var $trigger = (0, _jquery2.default)(this);
  5961. var selector = _util2.default.getSelectorFromElement(this);
  5962. (0, _jquery2.default)(selector).each(function () {
  5963. var $target = (0, _jquery2.default)(this);
  5964. var data = $target.data(DATA_KEY);
  5965. var config = data ? 'toggle' : $trigger.data();
  5966. Collapse._jQueryInterface.call($target, config);
  5967. });
  5968. });
  5969. /**
  5970. * ------------------------------------------------------------------------
  5971. * jQuery
  5972. * ------------------------------------------------------------------------
  5973. */
  5974. _jquery2.default.fn[NAME] = Collapse._jQueryInterface;
  5975. _jquery2.default.fn[NAME].Constructor = Collapse;
  5976. _jquery2.default.fn[NAME].noConflict = function () {
  5977. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  5978. return Collapse._jQueryInterface;
  5979. };
  5980. return Collapse;
  5981. }(_jquery2.default);
  5982. exports.default = Collapse;
  5983. /***/ }),
  5984. /* 7 */
  5985. /***/ (function(module, exports, __webpack_require__) {
  5986. "use strict";
  5987. Object.defineProperty(exports, "__esModule", {
  5988. value: true
  5989. });
  5990. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5991. var _Swiper = __webpack_require__(4);
  5992. var _Swiper2 = _interopRequireDefault(_Swiper);
  5993. var _util = __webpack_require__(0);
  5994. var _util2 = _interopRequireDefault(_util);
  5995. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5997. var SELECTORS = {
  5998. container: '[data-content-slider]'
  5999. };
  6000. var Default = {
  6001. slideToClickedSlide: false,
  6002. navStorage: 'normal'
  6003. };
  6004. var contentSlider = function () {
  6005. function contentSlider(container, options) {
  6006. _classCallCheck(this, contentSlider);
  6007. this.container = container;
  6008. this.options = options;
  6009. this.isInit = false;
  6010. this.getConfig();
  6011. this.initPLugin();
  6012. this.bindEvents();
  6013. }
  6014. _createClass(contentSlider, [{
  6015. key: 'getConfig',
  6016. value: function getConfig() {
  6017. var dataConfig = this.container.data();
  6018. if (dataConfig.options) {
  6019. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6020. } else {
  6021. this.dataOptions = {};
  6022. }
  6023. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6024. }
  6025. }, {
  6026. key: 'bindEvents',
  6027. value: function bindEvents() {}
  6028. }, {
  6029. key: 'initPLugin',
  6030. value: function initPLugin() {
  6031. var that = this;
  6032. this.swiperInstance = new _Swiper2.default(this.container, {
  6033. scrollbarHide: true,
  6034. effect: false,
  6035. resistance: true,
  6036. resistanceRatio: 0,
  6037. slidesPerView: 'auto',
  6038. watchSlidesVisibility: true,
  6039. onInit: function onInit(swiper) {
  6040. that.onInit(swiper);
  6041. },
  6042. onTap: function onTap(swiper, event) {
  6043. that.changeActiveSlide(swiper);
  6044. if (that.config.slideToClickedSlide) {
  6045. that.slideToClickedSlide(swiper, event);
  6046. }
  6047. that.onClick();
  6048. }
  6049. });
  6050. }
  6051. }, {
  6052. key: 'changeActiveSlide',
  6053. value: function changeActiveSlide(swiper) {
  6054. if (!this.isInit) {
  6055. return;
  6056. }
  6057. var slides = swiper.slides;
  6058. switch (this.config.navStorage) {
  6059. case 'normal':
  6060. break;
  6061. case 'hash':
  6062. break;
  6063. case 'localStorage':
  6064. $(slides).removeClass('is-active');
  6065. window.localStorage.setItem('content-slider-' + this.config.localStorageId, swiper.clickedIndex);
  6066. break;
  6067. }
  6068. }
  6069. }, {
  6070. key: 'slideToClickedSlide',
  6071. value: function slideToClickedSlide(swiper, event) {
  6072. var clickedIndex = swiper.clickedIndex,
  6073. slides = swiper.slides;
  6074. swiper.updateActiveIndex();
  6075. if (!$(slides[clickedIndex - 1]).hasClass('swiper-slide-visible')) {
  6076. swiper.slideTo(swiper.activeIndex - 1);
  6077. }
  6078. if (!$(slides[clickedIndex + 1]).hasClass('swiper-slide-visible')) {
  6079. swiper.slideTo(swiper.activeIndex + 1);
  6080. }
  6081. }
  6082. }, {
  6083. key: 'onInit',
  6084. value: function onInit(swiper) {
  6085. switch (this.config.navStorage) {
  6086. case 'normal':
  6087. var activeSlideIndex = 0,
  6088. slides = swiper.slides;
  6089. $(slides).each(function (index) {
  6090. if ($(this).hasClass('is-active')) {
  6091. activeSlideIndex = index;
  6092. }
  6093. });
  6094. swiper.slideTo(activeSlideIndex, 0);
  6095. break;
  6096. case 'hash':
  6097. if (window.location.hash) {
  6098. var slide = $(swiper.container).find('[href="' + window.location.hash + '"]'),
  6099. slideIndex = slide.closest('.swiper-slide').index();
  6100. slide.trigger('click');
  6101. swiper.slideTo(slideIndex, 0);
  6102. }
  6103. break;
  6104. case 'localStorage':
  6105. var index = window.localStorage.getItem('content-slider-' + this.config.localStorageId);
  6106. if (index) {
  6107. swiper.slideTo(index, 0);
  6108. } else {
  6109. swiper.slideTo(0, 0);
  6110. }
  6111. $(swiper.slides[index]).find('a').trigger('click');
  6112. break;
  6113. }
  6114. this.showSlider(swiper);
  6115. this.isInit = true;
  6116. }
  6117. }, {
  6118. key: 'showSlider',
  6119. value: function showSlider(swiper) {
  6120. swiper.container.css({
  6121. visibility: 'visible'
  6122. });
  6123. }
  6124. }, {
  6125. key: 'onClick',
  6126. value: function onClick() {}
  6127. }, {
  6128. key: 'onSlideChangeStart',
  6129. value: function onSlideChangeStart() {}
  6130. }, {
  6131. key: 'onSlideChangeEnd',
  6132. value: function onSlideChangeEnd() {}
  6133. }]);
  6134. return contentSlider;
  6135. }();
  6136. function initDataSelectors() {
  6137. $(SELECTORS.container).each(function () {
  6138. new contentSlider($(this));
  6139. });
  6140. }
  6141. function initJqueryPlugin() {
  6142. $.fn.luContentSlider = function (options) {
  6143. return this.each(function () {
  6144. new contentSlider($(this), options);
  6145. });
  6146. };
  6147. }
  6148. var init = {
  6149. initDataSelectors: initDataSelectors,
  6150. initJqueryPlugin: initJqueryPlugin
  6151. };
  6152. exports.default = init;
  6153. /***/ }),
  6154. /* 8 */
  6155. /***/ (function(module, exports, __webpack_require__) {
  6156. "use strict";
  6157. Object.defineProperty(exports, "__esModule", {
  6158. value: true
  6159. });
  6160. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6161. var _drop = __webpack_require__(5);
  6162. var _drop2 = _interopRequireDefault(_drop);
  6163. var _selectInput = __webpack_require__(3);
  6164. var _selectInput2 = _interopRequireDefault(_selectInput);
  6165. var _util = __webpack_require__(0);
  6166. var _util2 = _interopRequireDefault(_util);
  6167. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6168. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6169. var SELECTORS = {
  6170. dropdownToggle: '[data-toggle="lu-dropdown"], [data-dropdown]',
  6171. dropdownParent: '.has-dropdown',
  6172. dropdownMenu: '[data-dropdown-menu]',
  6173. dropdownArrowTarget: '[data-arrow-target]',
  6174. dropdownPlacement: '[data-placement]',
  6175. dropdownOpen: '[data-open]',
  6176. dropdownClasses: '[data-class]',
  6177. width: '[data-width]'
  6178. };
  6179. var Default = {
  6180. open: 'click',
  6181. placement: 'bottom left',
  6182. width: null,
  6183. class: ''
  6184. };
  6185. var dropdown = function () {
  6186. function dropdown(_dropdown, options) {
  6187. _classCallCheck(this, dropdown);
  6188. this.dropdown = $(_dropdown);
  6189. this.options = options;
  6190. this.dropdownParent = this.dropdown.closest(SELECTORS.dropdownParent);
  6191. this.dropdownArrowTarget = $(this.dropdownParent).find(SELECTORS.dropdownArrowTarget);
  6192. this.dropdownToggle = $(this.dropdownParent).find(SELECTORS.dropdownToggle);
  6193. this.dropdownMenu = $(this.dropdownParent).find(SELECTORS.dropdownMenu);
  6194. this.getConfig();
  6195. this.initPlugin();
  6196. this.bindEvents();
  6197. if (this.dropdown.find('[data-input-content-target]').length) {
  6198. this.initSelect();
  6199. }
  6200. }
  6201. _createClass(dropdown, [{
  6202. key: 'bindEvents',
  6203. value: function bindEvents() {
  6204. this.dropdown.on('closeDropdown', this.close.bind(this));
  6205. this.dropdown.on('openDropdown', this.open.bind(this));
  6206. }
  6207. }, {
  6208. key: 'getConfig',
  6209. value: function getConfig() {
  6210. var dataConfig = this.dropdown.data();
  6211. if (dataConfig.options) {
  6212. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6213. } else {
  6214. this.dataOptions = {};
  6215. }
  6216. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6217. this.setDropdownWidth();
  6218. if (!this.dropdownArrowTarget.length) {
  6219. this.dropdownArrowTarget = this.dropdown;
  6220. }
  6221. }
  6222. }, {
  6223. key: 'initPlugin',
  6224. value: function initPlugin() {
  6225. this.drop = new _drop2.default({
  6226. target: this.dropdown[0],
  6227. content: this.dropdownMenu[0],
  6228. position: this.config.placement,
  6229. classes: this.config.class,
  6230. openOn: this.config.open
  6231. });
  6232. if (this.config.onInit) {
  6233. this.config.onInit(this.drop);
  6234. }
  6235. this.drop.on('open', this.onOpen.bind(this));
  6236. this.drop.on('close', this.onClose.bind(this));
  6237. }
  6238. }, {
  6239. key: 'getArrowTargetPoition',
  6240. value: function getArrowTargetPoition() {
  6241. var dropdownOffset = this.dropdown.offset();
  6242. var arrowTargetOffset = this.dropdownArrowTarget.offset();
  6243. var arrowTargetWidth = this.dropdownArrowTarget.outerWidth();
  6244. if (/left/i.test(this.config.placement)) {
  6245. this.arrowTargetPosition = arrowTargetOffset.left - dropdownOffset.left + arrowTargetWidth / 2;
  6246. } else if (/right/i.test(this.config.placement)) {
  6247. this.arrowTargetPosition = this.dropdown.outerWidth() - (arrowTargetOffset.left - dropdownOffset.left) - arrowTargetWidth / 2;
  6248. }
  6249. }
  6250. }, {
  6251. key: 'setArrowPostion',
  6252. value: function setArrowPostion() {
  6253. var arrow = $(this.drop.drop).find('[data-arrow]');
  6254. if (!arrow) {
  6255. return;
  6256. }
  6257. this.getArrowTargetPoition();
  6258. var arrowBorderWidth = arrow.outerWidth() / 2;
  6259. if (/center/i.test(this.config.placement)) {
  6260. arrow.css({
  6261. left: '0',
  6262. right: '0',
  6263. margin: 'auto'
  6264. });
  6265. } else if (/left/i.test(this.config.placement)) {
  6266. arrow.css({
  6267. left: this.arrowTargetPosition - arrowBorderWidth
  6268. });
  6269. } else if (/right/i.test(this.config.placement)) {
  6270. arrow.css({
  6271. left: 'auto',
  6272. right: this.arrowTargetPosition - arrowBorderWidth
  6273. });
  6274. }
  6275. }
  6276. }, {
  6277. key: 'setDropdownWidth',
  6278. value: function setDropdownWidth() {
  6279. if (!this.config.width) {
  6280. return;
  6281. }
  6282. $(this.dropdownMenu).css({ opacity: 0, position: 'absolute', left: -10000 });
  6283. var width = parseInt(this.config.width);
  6284. var parentWidth = this.dropdownParent.outerWidth();
  6285. $(this.dropdownMenu).css({
  6286. width: width * parentWidth / 100,
  6287. 'min-width': width * parentWidth / 100
  6288. });
  6289. $(this.dropdownMenu).css({ opacity: '', position: '', left: '' });
  6290. }
  6291. }, {
  6292. key: 'onOpen',
  6293. value: function onOpen() {
  6294. this.setArrowPostion();
  6295. this.setDropdownWidth();
  6296. if (typeof this.config.onOpen === 'function') {
  6297. this.config.onOpen(this.drop);
  6298. }
  6299. }
  6300. }, {
  6301. key: 'onClose',
  6302. value: function onClose() {
  6303. if (typeof this.config.onClose === 'function') {
  6304. this.config.onClose(this.drop);
  6305. }
  6306. }
  6307. }, {
  6308. key: 'open',
  6309. value: function open() {
  6310. this.drop.open();
  6311. }
  6312. }, {
  6313. key: 'close',
  6314. value: function close() {
  6315. this.drop.close();
  6316. }
  6317. }, {
  6318. key: 'initSelect',
  6319. value: function initSelect() {
  6320. _selectInput2.default.init($(this.drop.drop), this.drop);
  6321. }
  6322. }]);
  6323. return dropdown;
  6324. }();
  6325. function initDataSelectors() {
  6326. $(SELECTORS.dropdownToggle).each(function () {
  6327. new dropdown($(this));
  6328. });
  6329. }
  6330. function initJqueryPlugin() {
  6331. $.fn.luDropdown = function (options) {
  6332. return this.each(function () {
  6333. new dropdown($(this), options);
  6334. });
  6335. };
  6336. }
  6337. function closeAllDropdowns() {
  6338. for (var i = 0; i < _drop2.default.drops.length; i++) {
  6339. _drop2.default.drops[i].close();
  6340. }
  6341. }
  6342. var init = {
  6343. initDataSelectors: initDataSelectors,
  6344. initJqueryPlugin: initJqueryPlugin,
  6345. closeAllDropdowns: closeAllDropdowns
  6346. };
  6347. exports.default = init;
  6348. /***/ }),
  6349. /* 9 */
  6350. /***/ (function(module, exports, __webpack_require__) {
  6351. "use strict";
  6352. Object.defineProperty(exports, "__esModule", {
  6353. value: true
  6354. });
  6355. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6356. var _drop = __webpack_require__(5);
  6357. var _drop2 = _interopRequireDefault(_drop);
  6358. var _util = __webpack_require__(0);
  6359. var _util2 = _interopRequireDefault(_util);
  6360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6362. var SELECTORS = {
  6363. toggle: '[data-toggle="lu-tooltip"], [data-tooltip]'
  6364. };
  6365. var Default = {
  6366. open: 'hover',
  6367. placement: 'top center',
  6368. class: 'lu-tooltip'
  6369. };
  6370. var tooltip = function () {
  6371. function tooltip(_tooltip, options) {
  6372. _classCallCheck(this, tooltip);
  6373. this.tooltip = $(_tooltip);
  6374. this.options = options;
  6375. this.getConfig();
  6376. this.getContent();
  6377. this.initPlugin();
  6378. }
  6379. _createClass(tooltip, [{
  6380. key: 'getConfig',
  6381. value: function getConfig() {
  6382. var dataConfig = this.tooltip.data();
  6383. if (dataConfig.options) {
  6384. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6385. } else {
  6386. this.dataOptions = {};
  6387. }
  6388. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6389. }
  6390. }, {
  6391. key: 'getContent',
  6392. value: function getContent() {
  6393. if ($(this.tooltip).attr('data-title')) {
  6394. this.tooltipContent = $(this.tooltip).attr('data-title');
  6395. } else {
  6396. $(this.tooltip).attr('data-title', $(this.tooltip).attr('title'));
  6397. $(this.tooltip).removeAttr('title');
  6398. this.tooltipContent = $(this.tooltip).attr('data-title');
  6399. }
  6400. }
  6401. }, {
  6402. key: 'initPlugin',
  6403. value: function initPlugin() {
  6404. this.drop = new _drop2.default({
  6405. target: this.tooltip[0],
  6406. content: this.tooltipContent,
  6407. position: this.config.placement,
  6408. classes: this.config.class,
  6409. openOn: this.config.open
  6410. });
  6411. this.drop.on('open', this.onOpen.bind(this));
  6412. }
  6413. }, {
  6414. key: 'getArrowTargetPoition',
  6415. value: function getArrowTargetPoition() {
  6416. var tooltipwitdh = this.tooltip.outerWidth();
  6417. if (/left/i.test(this.config.placement)) {
  6418. this.arrowTargetPosition = tooltipwitdh / 2;
  6419. } else if (/right/i.test(this.config.placement)) {
  6420. this.arrowTargetPosition = tooltipwitdh / 2;
  6421. }
  6422. }
  6423. }, {
  6424. key: 'setArrowPostion',
  6425. value: function setArrowPostion() {
  6426. console.log(this.drop.drop);
  6427. $(this.drop.drop).find('.lu-tooltip__arrow').remove();
  6428. $(this.drop.drop).append('<div class="lu-tooltip__arrow" data-arrow></div>');
  6429. var arrow = $(this.drop.drop).find('[data-arrow]');
  6430. if (!arrow) {
  6431. return;
  6432. }
  6433. this.getArrowTargetPoition();
  6434. var arrowBorderWidth = arrow.outerWidth() / 2;
  6435. if (/center/i.test(this.config.placement)) {
  6436. arrow.css({
  6437. left: '0',
  6438. right: '0',
  6439. margin: 'auto'
  6440. });
  6441. } else if (/left/i.test(this.config.placement)) {
  6442. arrow.css({
  6443. left: this.arrowTargetPosition,
  6444. marginLeft: -arrowBorderWidth
  6445. });
  6446. } else if (/right/i.test(this.config.placement)) {
  6447. arrow.css({
  6448. left: 'auto',
  6449. right: this.arrowTargetPosition,
  6450. marginRight: -arrowBorderWidth
  6451. });
  6452. }
  6453. }
  6454. }, {
  6455. key: 'onOpen',
  6456. value: function onOpen() {
  6457. this.setArrowPostion();
  6458. }
  6459. }]);
  6460. return tooltip;
  6461. }();
  6462. function initDataSelectors() {
  6463. $(SELECTORS.toggle).each(function () {
  6464. new tooltip($(this));
  6465. });
  6466. }
  6467. function initJqueryPlugin() {
  6468. $.fn.luTooltip = function (options) {
  6469. return this.each(function () {
  6470. new tooltip($(this), options);
  6471. });
  6472. };
  6473. }
  6474. var init = {
  6475. initDataSelectors: initDataSelectors,
  6476. initJqueryPlugin: initJqueryPlugin
  6477. };
  6478. exports.default = init;
  6479. /***/ }),
  6480. /* 10 */
  6481. /***/ (function(module, exports, __webpack_require__) {
  6482. "use strict";
  6483. Object.defineProperty(exports, "__esModule", {
  6484. value: true
  6485. });
  6486. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6487. var _util = __webpack_require__(0);
  6488. var _util2 = _interopRequireDefault(_util);
  6489. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6490. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6491. var SELECTORS = {
  6492. container: '[data-check-container]',
  6493. checkAll: '[data-check-all]',
  6494. childs: 'input:checkbox.table-mass-action-check:enabled',
  6495. counterView: '[data-checkbox-counter]'
  6496. };
  6497. var Default = {};
  6498. var CheckAll = function () {
  6499. function CheckAll(container, options) {
  6500. _classCallCheck(this, CheckAll);
  6501. this.container = container;
  6502. this.checkAllBtn = this.container.find(SELECTORS.checkAll);
  6503. this.childs = this.container.find(SELECTORS.childs).not(SELECTORS.checkAll);
  6504. this.counterView = this.container.find(SELECTORS.counterView);
  6505. this.checkCounter = 0;
  6506. this.options = options;
  6507. this.getConfig();
  6508. this.initCounter();
  6509. this.bindEvents();
  6510. }
  6511. _createClass(CheckAll, [{
  6512. key: 'bindEvents',
  6513. value: function bindEvents() {
  6514. this.checkAllBtn.on('change', this.checkAll.bind(this));
  6515. this.childs.on('change', this.updateCounter.bind(this));
  6516. }
  6517. }, {
  6518. key: 'getConfig',
  6519. value: function getConfig() {
  6520. var dataConfig = this.container.data();
  6521. if (dataConfig.options) {
  6522. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6523. } else {
  6524. this.dataOptions = {};
  6525. }
  6526. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6527. }
  6528. }, {
  6529. key: 'checkAll',
  6530. value: function checkAll(event) {
  6531. this.childs.prop('checked', event.target.checked);
  6532. if (event.target.checked) {
  6533. this.checkCounter = this.childs.length;
  6534. } else {
  6535. this.checkCounter = 0;
  6536. }
  6537. this.updateCounterView();
  6538. }
  6539. }, {
  6540. key: 'toggleCheckAllBtn',
  6541. value: function toggleCheckAllBtn() {
  6542. if (this.childs.length == this.checkCounter) {
  6543. this.checkAllBtn.prop('checked', true);
  6544. } else {
  6545. this.checkAllBtn.prop('checked', false);
  6546. }
  6547. if (typeof this.config.onCheckAll === 'function') {
  6548. this.config.onCheckAll(this.container, this.checkCounter);
  6549. }
  6550. }
  6551. }, {
  6552. key: 'initCounter',
  6553. value: function initCounter() {
  6554. if (this.checkAllBtn.is(':checked')) {
  6555. this.checkCounter = this.childs.length;
  6556. this.childs.prop('checked', true);
  6557. } else {
  6558. this.checkCounter = this.childs.filter(':checked').length;
  6559. }
  6560. }
  6561. }, {
  6562. key: 'updateCounter',
  6563. value: function updateCounter(event) {
  6564. if (event.target.checked) {
  6565. this.checkCounter++;
  6566. this.toggleCheckAllBtn();
  6567. } else {
  6568. this.checkCounter--;
  6569. this.toggleCheckAllBtn();
  6570. }
  6571. this.updateCounterView();
  6572. }
  6573. }, {
  6574. key: 'updateCounterView',
  6575. value: function updateCounterView() {
  6576. if (typeof this.config.onCheck === 'function') {
  6577. this.config.onCheck(this.container, this.checkCounter);
  6578. }
  6579. this.counterView.text(this.checkCounter);
  6580. }
  6581. }]);
  6582. return CheckAll;
  6583. }();
  6584. function initDataSelectors() {
  6585. $(SELECTORS.container).each(function () {
  6586. new CheckAll($(this));
  6587. });
  6588. }
  6589. function initJqueryPlugin() {
  6590. $.fn.luCheckAll = function (options) {
  6591. return this.each(function () {
  6592. new CheckAll($(this), options);
  6593. });
  6594. };
  6595. }
  6596. var init = {
  6597. initDataSelectors: initDataSelectors,
  6598. initJqueryPlugin: initJqueryPlugin
  6599. };
  6600. exports.default = init;
  6601. /***/ }),
  6602. /* 11 */
  6603. /***/ (function(module, exports, __webpack_require__) {
  6604. "use strict";
  6605. var forms = [].slice.call(document.querySelectorAll('.lu-form-control'));
  6606. forms.forEach(function (item) {
  6607. var $item = $(item);
  6608. item.addEventListener('focus', function () {
  6609. $item.closest('.lu-input-group').addClass('is-focus');
  6610. });
  6611. item.addEventListener('blur', function () {
  6612. $item.closest('.lu-input-group').removeClass('is-focus');
  6613. });
  6614. });
  6615. /***/ }),
  6616. /* 12 */
  6617. /***/ (function(module, exports, __webpack_require__) {
  6618. "use strict";
  6619. Object.defineProperty(exports, "__esModule", {
  6620. value: true
  6621. });
  6622. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6623. __webpack_require__(32);
  6624. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6625. var SELECTORS = {
  6626. container: '[data-range-slider]',
  6627. input: 'input',
  6628. slider: '[data-slider]'
  6629. };
  6630. var rangeSlider = function () {
  6631. function rangeSlider(container) {
  6632. _classCallCheck(this, rangeSlider);
  6633. this.container = container;
  6634. this.input = this.container.find(SELECTORS.input);
  6635. this.slider = this.container.find(SELECTORS.slider);
  6636. this.config = this.container.data();
  6637. this.value = this.input.val();
  6638. this.bindEvents();
  6639. this.initSlider();
  6640. }
  6641. _createClass(rangeSlider, [{
  6642. key: 'bindEvents',
  6643. value: function bindEvents() {
  6644. this.input.on('change', this.updateSlider.bind(this));
  6645. }
  6646. }, {
  6647. key: 'initSlider',
  6648. value: function initSlider() {
  6649. var that = this;
  6650. this.sliderInstance = $(this.slider).slider({
  6651. range: "min",
  6652. value: this.value,
  6653. min: this.config.min,
  6654. max: this.config.max,
  6655. step: this.config.step,
  6656. slide: function slide(event, ui) {
  6657. that.updateInput(ui.value);
  6658. }
  6659. });
  6660. }
  6661. }, {
  6662. key: 'updateInput',
  6663. value: function updateInput(value) {
  6664. this.input.val(value);
  6665. }
  6666. }, {
  6667. key: 'updateSlider',
  6668. value: function updateSlider(evnet) {
  6669. this.sliderInstance.slider("value", event.target.value);
  6670. }
  6671. }], [{
  6672. key: 'init',
  6673. value: function init(container) {
  6674. if (container) {
  6675. new rangeSlider($(container).find(SELECTORS.container));
  6676. } else {
  6677. $(SELECTORS.container).each(function () {
  6678. new rangeSlider($(this));
  6679. });
  6680. }
  6681. }
  6682. }, {
  6683. key: 'reload',
  6684. value: function reload(container) {}
  6685. }]);
  6686. return rangeSlider;
  6687. }();
  6688. function initDataSelectors() {
  6689. $(SELECTORS.select).each(function () {
  6690. new Select($(this));
  6691. });
  6692. }
  6693. function initJqueryPlugin() {
  6694. $.fn.luSelect = function (options) {
  6695. return this.each(function () {
  6696. new Select($(this), options);
  6697. });
  6698. };
  6699. }
  6700. var init = {
  6701. initDataSelectors: initDataSelectors,
  6702. initJqueryPlugin: initJqueryPlugin
  6703. };
  6704. exports.default = rangeSlider;
  6705. /***/ }),
  6706. /* 13 */
  6707. /***/ (function(module, exports, __webpack_require__) {
  6708. "use strict";
  6709. Object.defineProperty(exports, "__esModule", {
  6710. value: true
  6711. });
  6712. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6713. var _Selectize = __webpack_require__(29);
  6714. var _Selectize2 = _interopRequireDefault(_Selectize);
  6715. var _util = __webpack_require__(0);
  6716. var _util2 = _interopRequireDefault(_util);
  6717. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6718. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6719. //init selects only inside of #layers in order not to break other templates
  6720. var SELECTORS = {
  6721. select: '#layers select',
  6722. rawSelect: '#layers .lu-form-control--basic'
  6723. };
  6724. var Default = {
  6725. maxItems: 1,
  6726. removeButton: false,
  6727. resotreOnBackspace: false,
  6728. dragAndDrop: false
  6729. };
  6730. var Select = function () {
  6731. function Select(element, options) {
  6732. _classCallCheck(this, Select);
  6733. this.element = element;
  6734. this.options = options;
  6735. this.getConfig();
  6736. this.directionDetector();
  6737. this.additionalPlugins();
  6738. this.initPlugin();
  6739. }
  6740. _createClass(Select, [{
  6741. key: 'initPlugin',
  6742. value: function initPlugin() {
  6743. var plugins = this.additionalPlugins();
  6744. this.element.selectize({
  6745. placeholder: '',
  6746. maxItems: this.config.maxItems,
  6747. createOnBlur: true,
  6748. plugins: plugins,
  6749. copyClassesToDropdown: false
  6750. });
  6751. }
  6752. }, {
  6753. key: 'getConfig',
  6754. value: function getConfig() {
  6755. var dataConfig = this.element.data();
  6756. if (dataConfig.options) {
  6757. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6758. } else {
  6759. this.dataOptions = {};
  6760. }
  6761. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6762. }
  6763. }, {
  6764. key: 'directionDetector',
  6765. value: function directionDetector() {
  6766. _Selectize2.default.define('directionDetector', function (options) {
  6767. var self = this;
  6768. this.positionDropdown = function () {
  6769. var original = self.positionDropdown;
  6770. return function () {
  6771. this.offset = this.settings.dropdownParent === 'body' ? this.$control.offset() : this.$control.position();
  6772. this.offset.top += this.$control.outerHeight(true);
  6773. var controlHeight = this.$control.innerHeight();
  6774. var controlPositon = $(this.$control).offset().top - $(window).scrollTop();
  6775. var dropdownOffset = controlHeight + controlPositon + this.$dropdown.outerHeight(true);
  6776. if ($(window).innerHeight() - dropdownOffset < 0) {
  6777. this.$dropdown.css({
  6778. 'top': 'auto',
  6779. 'bottom': 8 + controlHeight,
  6780. 'left': this.offset.left,
  6781. 'width': this.$control[0].getBoundingClientRect().width
  6782. });
  6783. } else {
  6784. this.$dropdown.css({
  6785. 'width': this.$control[0].getBoundingClientRect().width,
  6786. 'top': this.offset.top,
  6787. 'left': this.offset.left,
  6788. 'bottom': 'auto'
  6789. });
  6790. }
  6791. };
  6792. }();
  6793. });
  6794. }
  6795. }, {
  6796. key: 'additionalPlugins',
  6797. value: function additionalPlugins() {
  6798. var plugins = ['directionDetector'];
  6799. if (this.config.removeButton) {
  6800. plugins.push('remove_button');
  6801. }
  6802. if (this.config.resotreOnBackspace) {
  6803. plugins.push('restore_on_backspace');
  6804. }
  6805. if (this.config.drag_drop) {
  6806. plugins.push('drag_drop');
  6807. }
  6808. return plugins;
  6809. }
  6810. }]);
  6811. return Select;
  6812. }();
  6813. function initDataSelectors() {
  6814. // $(SELECTORS.select).not(SELECTORS.rawSelect).each(function () {
  6815. // new Select($(this));
  6816. // });
  6817. }
  6818. function initJqueryPlugin() {
  6819. $.fn.luSelect = function (options) {
  6820. return this.each(function () {
  6821. new Select($(this), options);
  6822. });
  6823. };
  6824. }
  6825. var init = {
  6826. initDataSelectors: initDataSelectors,
  6827. initJqueryPlugin: initJqueryPlugin
  6828. };
  6829. exports.default = init;
  6830. /***/ }),
  6831. /* 14 */
  6832. /***/ (function(module, exports, __webpack_require__) {
  6833. "use strict";
  6834. Object.defineProperty(exports, "__esModule", {
  6835. value: true
  6836. });
  6837. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6838. var _autosize = __webpack_require__(30);
  6839. var _autosize2 = _interopRequireDefault(_autosize);
  6840. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6841. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6842. var SELECTORS = {
  6843. container: '[data-editable-cell]',
  6844. input: '[data-editable-input]',
  6845. content: '[data-editable-contnet]',
  6846. init: '[data-init-edit]',
  6847. abort: '[data-abort-edit]',
  6848. accept: '[data-accept-edit]'
  6849. };
  6850. var Default = {};
  6851. var editableCell = function () {
  6852. function editableCell(container, options) {
  6853. _classCallCheck(this, editableCell);
  6854. this.container = container;
  6855. this.options = options;
  6856. this.input = this.container.find(SELECTORS.input);
  6857. this.content = this.container.find(SELECTORS.content);
  6858. this.init = this.container.find(SELECTORS.init);
  6859. this.abort = this.container.find(SELECTORS.abort);
  6860. this.accept = this.container.find(SELECTORS.accept);
  6861. this.oldInputValue = this.input.val().trim();
  6862. this.getConfig();
  6863. this.initEvents();
  6864. this.trimInputContent();
  6865. this.textareaAutosize();
  6866. this.blockNewLine();
  6867. }
  6868. _createClass(editableCell, [{
  6869. key: 'getConfig',
  6870. value: function getConfig() {
  6871. var dataConfig = this.container.data();
  6872. if (dataConfig.options) {
  6873. this.dataOptions = util.parseDataOptions(dataConfig.options);
  6874. } else {
  6875. this.dataOptions = {};
  6876. }
  6877. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6878. }
  6879. }, {
  6880. key: 'bindEvents',
  6881. value: function bindEvents() {
  6882. $(this.init).on('click', this.initEdit.bind(this));
  6883. $(this.abort).on('click', this.abortEdit.bind(this));
  6884. $(this.accept).on('click', this.acceptEdit.bind(this));
  6885. }
  6886. }, {
  6887. key: 'initEdit',
  6888. value: function initEdit(event) {
  6889. this.content.addClass('hidden');
  6890. this.init.addClass('hidden');
  6891. this.accept.removeClass('hidden');
  6892. this.abort.removeClass('hidden');
  6893. this.input.removeClass('hidden');
  6894. this.textareaAutosizeUpdate();
  6895. $(this.input).focus();
  6896. }
  6897. }, {
  6898. key: 'abortEdit',
  6899. value: function abortEdit(event) {
  6900. this.content.removeClass('hidden');
  6901. this.init.removeClass('hidden');
  6902. this.accept.addClass('hidden');
  6903. this.abort.addClass('hidden');
  6904. this.input.addClass('hidden');
  6905. this.input.val(this.oldInputValue);
  6906. }
  6907. }, {
  6908. key: 'textareaAutosize',
  6909. value: function textareaAutosize() {
  6910. (0, _autosize2.default)(this.input);
  6911. }
  6912. }, {
  6913. key: 'textareaAutosizeUpdate',
  6914. value: function textareaAutosizeUpdate() {
  6915. _autosize2.default.update(this.input);
  6916. }
  6917. }, {
  6918. key: 'trimInputContent',
  6919. value: function trimInputContent() {
  6920. $(this.input).val($(this.input).val().trim());
  6921. }
  6922. }, {
  6923. key: 'blockNewLine',
  6924. value: function blockNewLine() {
  6925. $(this.input).on('keypress', function (e) {
  6926. if ((e.keyCode || e.which) == 13) {
  6927. e.preventDefault();
  6928. }
  6929. });
  6930. }
  6931. }, {
  6932. key: 'acceptEdit',
  6933. value: function acceptEdit(event) {
  6934. this.content.text(this.input.val());
  6935. this.content.removeClass('hidden');
  6936. this.init.removeClass('hidden');
  6937. this.accept.addClass('hidden');
  6938. this.abort.addClass('hidden');
  6939. this.input.addClass('hidden');
  6940. }
  6941. }]);
  6942. return editableCell;
  6943. }();
  6944. function initDataSelectors() {
  6945. $(SELECTORS.container).each(function () {
  6946. new editableCell($(this));
  6947. });
  6948. }
  6949. function initJqueryPlugin() {
  6950. $.fn.luEditableCell = function (options) {
  6951. return this.each(function () {
  6952. new editableCell($(this), options);
  6953. });
  6954. };
  6955. }
  6956. var init = {
  6957. initDataSelectors: initDataSelectors,
  6958. initJqueryPlugin: initJqueryPlugin
  6959. };
  6960. exports.default = init;
  6961. /***/ }),
  6962. /* 15 */
  6963. /***/ (function(module, exports, __webpack_require__) {
  6964. "use strict";
  6965. Object.defineProperty(exports, "__esModule", {
  6966. value: true
  6967. });
  6968. var _toastr = __webpack_require__(35);
  6969. var _toastr2 = _interopRequireDefault(_toastr);
  6970. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6971. /**
  6972. * --------------------------------------------------------------------------
  6973. * Bootstrap (v4.0.0-beta): alert.js
  6974. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  6975. * --------------------------------------------------------------------------
  6976. */
  6977. var alert = {
  6978. init: function init() {
  6979. this.cacheDom();
  6980. this.bindEvents();
  6981. },
  6982. cacheDom: function cacheDom() {
  6983. this.$showAlert = $("[data-toggle='lu-alert']");
  6984. this.$alertFixedTop = $('.alert--fixed-top');
  6985. this.$alertFixedBottom = $('.alert--fixed-bottom');
  6986. },
  6987. bindEvents: function bindEvents() {
  6988. this.$showAlert.on('click', this.getData.bind(this));
  6989. },
  6990. //default settings
  6991. settings: function settings() {
  6992. // alert icon true by default
  6993. if (this.$alertIcon == false) {
  6994. this.$icon = '';
  6995. } else {
  6996. this.$icon = 'lu-alert--icon';
  6997. }
  6998. // default alert timeout if not defined in data attributes
  6999. if (!this.$alertTimeout) {
  7000. this.$alertTimeout = 100000;
  7001. }
  7002. if (this.$alertActions) {
  7003. this.$actions = this.$alertActions;
  7004. }
  7005. },
  7006. // create alert with data stored in array
  7007. create: function create(event) {
  7008. this.$alertPosition = event.$alertPosition;
  7009. this.$alertSize = event.$alertSize;
  7010. this.$alertStatus = event.$alertStatus;
  7011. this.$alertTitle = event.$alertTitle;
  7012. this.$alertBody = event.$alertBody;
  7013. this.$alertIcon = event.$alertIcon;
  7014. this.$alertActions = event.$alertActions;
  7015. this.$alertTimeout = event.$alertTimeout;
  7016. this.show(event);
  7017. },
  7018. // get data from data attributes
  7019. getData: function getData(event) {
  7020. var target = $(event.currentTarget);
  7021. this.$alertPosition = target.data('alert-position');
  7022. this.$alertSize = target.data('alert-size');
  7023. this.$alertStatus = target.data('alert-status');
  7024. this.$alertTitle = target.data('alert-title');
  7025. this.$alertBody = target.data('alert-body');
  7026. this.$alertIcon = target.data('alert-icon');
  7027. this.$alertActions = target.data('alert-actions');
  7028. this.$alertTimeout = target.data('alert-timeout');
  7029. this.show(event);
  7030. },
  7031. // main function that showing alerts
  7032. show: function show(event) {
  7033. this.settings();
  7034. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7035. // animation delay
  7036. this.delay = 400;
  7037. var that = this;
  7038. if (this.$alertPosition == 'top') {
  7039. var that = this;
  7040. $('body').prepend(this.getTemplate());
  7041. this.$alertFixedTop = $('.alert--fixed-top');
  7042. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7043. this.$alertFixedTop.css('margin-top', -this.$alertHeight).animate({ 'margin-top': 0 }, this.delay);
  7044. $(window).resize(function () {
  7045. if (that.$alertFixedTop.hasClass('is-active')) {
  7046. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7047. }
  7048. });
  7049. this.$hideAlert = this.$alertFixedTop.closest('.alert').find('.btn--close');
  7050. this.$hideAlert.on('click', this.hideT.bind(this));
  7051. } else {
  7052. $('body').append(this.getTemplate());
  7053. this.$alertFixedBottom = $('.alert--fixed-bottom');
  7054. this.$alertBottomHeight = this.$alertFixedBottom.outerHeight();
  7055. this.$alertFixedBottom.css('margin-bottom', -this.$alertBottomHeight).animate({ 'margin-bottom': '0' }, this.delay);
  7056. this.$hideAlert = this.$alertFixedBottom.closest('.alert').find('.btn--close');
  7057. this.$hideAlert.on('click', this.hideB.bind(this));
  7058. }
  7059. } else {
  7060. _toastr2.default.success(this.getTemplate());
  7061. }
  7062. },
  7063. hideT: function hideT(event) {
  7064. var that = this;
  7065. this.$alertHeight = this.$alertFixedTop.outerHeight();
  7066. this.$alertFixedTop.animate({ 'margin-top': -this.$alertHeight }, this.delay);
  7067. setTimeout(function () {
  7068. that.$alertFixedTop.removeClass('is-active').remove();
  7069. }, this.delay);
  7070. },
  7071. hideB: function hideB() {
  7072. var that = this;
  7073. this.$alertHeight = this.$alertFixedBottom.outerHeight();
  7074. this.$alertFixedBottom.animate({ 'margin-bottom': -this.$alertHeight }, this.delay);
  7075. setTimeout(function () {
  7076. that.$alertFixedBottom.removeClass('is-active').remove();
  7077. }, this.delay);
  7078. },
  7079. getTemplate: function getTemplate() {
  7080. _toastr2.default.options = {
  7081. "positionClass": "lu-toast--" + this.$alertPosition,
  7082. "timeOut": this.$alertTimeout
  7083. };
  7084. this.$actions = '';
  7085. if (this.$alertActions) {
  7086. this.$actions = '<div class="lu-alert__actions">' + this.$alertActions + '</div>';
  7087. }
  7088. var $titleTemplate = '';
  7089. if (this.$alertTitle) {
  7090. $titleTemplate = '<div class="lu-alert__title">' + this.$alertTitle + ' </div>';
  7091. }
  7092. // main alert template
  7093. var $primaryTemplate = '<div class="lu-alert lu-alert--' + this.$alertStatus + ' lu-alert--outline lu-alert--float lu-alert--border-left lu-has-icon">' + '<div class="lu-alert__body">' + $titleTemplate + '<p>' + this.$alertBody + '</p>' + '</div>' + this.$actions + '</div>';
  7094. // template of top and bottom alert
  7095. var $secondaryTemplate = '<div class="lu-alert lu-alert--' + this.$alertStatus + ' lu-alert--' + this.$alertSize + ' lu-alert--fixed lu-alert--fixed-' + this.$alertPosition + ' is-active">' + '<div class="lu-container">' + '<div class="lu-alert__body">' + '<b> ' + this.$alertTitle + ' </b> ' + this.$alertBody + '</div>' + this.$actions + '</div>' + '</div>';
  7096. var $tmpl = $primaryTemplate;
  7097. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7098. $tmpl = $secondaryTemplate;
  7099. }
  7100. return $tmpl;
  7101. }
  7102. };
  7103. exports.default = alert;
  7104. /***/ }),
  7105. /* 16 */
  7106. /***/ (function(module, exports, __webpack_require__) {
  7107. "use strict";
  7108. Object.defineProperty(exports, "__esModule", {
  7109. value: true
  7110. });
  7111. 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; };
  7112. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7113. var _util = __webpack_require__(0);
  7114. var _util2 = _interopRequireDefault(_util);
  7115. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7116. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7117. /**
  7118. * --------------------------------------------------------------------------
  7119. * Bootstrap (v4.0.0-beta.2): modal.js
  7120. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7121. * --------------------------------------------------------------------------
  7122. */
  7123. var Modal = function () {
  7124. /**
  7125. * ------------------------------------------------------------------------
  7126. * Constants
  7127. * ------------------------------------------------------------------------
  7128. */
  7129. var NAME = 'luModal';
  7130. var VERSION = '4.0.0-beta.2';
  7131. var DATA_KEY = 'bs.modal';
  7132. var EVENT_KEY = '.' + DATA_KEY;
  7133. var DATA_API_KEY = '.data-api';
  7134. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7135. var TRANSITION_DURATION = 300;
  7136. var BACKDROP_TRANSITION_DURATION = 150;
  7137. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  7138. var Default = {
  7139. backdrop: true,
  7140. keyboard: true,
  7141. focus: true,
  7142. show: true
  7143. };
  7144. var DefaultType = {
  7145. backdrop: '(boolean|string)',
  7146. keyboard: 'boolean',
  7147. focus: 'boolean',
  7148. show: 'boolean'
  7149. };
  7150. var Event = {
  7151. HIDE: 'hide' + EVENT_KEY,
  7152. HIDDEN: 'hidden' + EVENT_KEY,
  7153. SHOW: 'show' + EVENT_KEY,
  7154. SHOWN: 'shown' + EVENT_KEY,
  7155. FOCUSIN: 'focusin' + EVENT_KEY,
  7156. RESIZE: 'resize' + EVENT_KEY,
  7157. CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
  7158. KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
  7159. MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
  7160. MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
  7161. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7162. };
  7163. var ClassName = {
  7164. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  7165. BACKDROP: 'modal-backdrop',
  7166. OPEN: 'modal-open',
  7167. FADE: 'fade',
  7168. SHOW: 'show'
  7169. };
  7170. var Selector = {
  7171. DIALOG: '.modal-dialog, .lu-modal__dialog',
  7172. DATA_TOGGLE: '[data-toggle="lu-modal"], [data-lu-modal]',
  7173. DATA_DISMISS: '[data-dismiss="lu-modal"]',
  7174. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  7175. STICKY_CONTENT: '.sticky-top',
  7176. NAVBAR_TOGGLER: '.navbar-toggler'
  7177. /**
  7178. * ------------------------------------------------------------------------
  7179. * Class Definition
  7180. * ------------------------------------------------------------------------
  7181. */
  7182. };
  7183. var Modal = function () {
  7184. function Modal(element, config) {
  7185. _classCallCheck(this, Modal);
  7186. this._config = this._getConfig(config);
  7187. this._element = element;
  7188. this._dialog = $(element).find(Selector.DIALOG)[0];
  7189. this._backdrop = null;
  7190. this._isShown = false;
  7191. this._isBodyOverflowing = false;
  7192. this._ignoreBackdropClick = false;
  7193. this._originalBodyPadding = 0;
  7194. this._scrollbarWidth = 0;
  7195. }
  7196. // getters
  7197. _createClass(Modal, [{
  7198. key: 'toggle',
  7199. // public
  7200. value: function toggle(relatedTarget) {
  7201. return this._isShown ? this.hide() : this.show(relatedTarget);
  7202. }
  7203. }, {
  7204. key: 'show',
  7205. value: function show(relatedTarget) {
  7206. var _this = this;
  7207. if (this._isTransitioning || this._isShown) {
  7208. return;
  7209. }
  7210. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7211. this._isTransitioning = true;
  7212. }
  7213. var showEvent = $.Event(Event.SHOW, {
  7214. relatedTarget: relatedTarget
  7215. });
  7216. $(this._element).trigger(showEvent);
  7217. if (this._isShown || showEvent.isDefaultPrevented()) {
  7218. return;
  7219. }
  7220. this._isShown = true;
  7221. this._checkScrollbar();
  7222. this._setScrollbar();
  7223. this._adjustDialog();
  7224. $(document.body).addClass(ClassName.OPEN);
  7225. this._setEscapeEvent();
  7226. this._setResizeEvent();
  7227. $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
  7228. return _this.hide(event);
  7229. });
  7230. $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
  7231. $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
  7232. if ($(event.target).is(_this._element)) {
  7233. _this._ignoreBackdropClick = true;
  7234. }
  7235. });
  7236. });
  7237. this._showBackdrop(function () {
  7238. return _this._showElement(relatedTarget);
  7239. });
  7240. }
  7241. }, {
  7242. key: 'hide',
  7243. value: function hide(event) {
  7244. var _this2 = this;
  7245. if (event) {
  7246. event.preventDefault();
  7247. }
  7248. if (this._isTransitioning || !this._isShown) {
  7249. return;
  7250. }
  7251. var hideEvent = $.Event(Event.HIDE);
  7252. $(this._element).trigger(hideEvent);
  7253. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  7254. return;
  7255. }
  7256. this._isShown = false;
  7257. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7258. if (transition) {
  7259. this._isTransitioning = true;
  7260. }
  7261. this._setEscapeEvent();
  7262. this._setResizeEvent();
  7263. $(document).off(Event.FOCUSIN);
  7264. $(this._element).removeClass(ClassName.SHOW);
  7265. $(this._element).off(Event.CLICK_DISMISS);
  7266. $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  7267. if (transition) {
  7268. $(this._element).one(_util2.default.TRANSITION_END, function (event) {
  7269. return _this2._hideModal(event);
  7270. }).emulateTransitionEnd(TRANSITION_DURATION);
  7271. } else {
  7272. this._hideModal();
  7273. }
  7274. }
  7275. }, {
  7276. key: 'dispose',
  7277. value: function dispose() {
  7278. $.removeData(this._element, DATA_KEY);
  7279. $(window, document, this._element, this._backdrop).off(EVENT_KEY);
  7280. this._config = null;
  7281. this._element = null;
  7282. this._dialog = null;
  7283. this._backdrop = null;
  7284. this._isShown = null;
  7285. this._isBodyOverflowing = null;
  7286. this._ignoreBackdropClick = null;
  7287. this._scrollbarWidth = null;
  7288. }
  7289. }, {
  7290. key: 'handleUpdate',
  7291. value: function handleUpdate() {
  7292. this._adjustDialog();
  7293. }
  7294. // private
  7295. }, {
  7296. key: '_getConfig',
  7297. value: function _getConfig(config) {
  7298. config = $.extend({}, Default, config);
  7299. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  7300. return config;
  7301. }
  7302. }, {
  7303. key: '_showElement',
  7304. value: function _showElement(relatedTarget) {
  7305. var _this3 = this;
  7306. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7307. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  7308. // don't move modals dom position
  7309. document.body.appendChild(this._element);
  7310. }
  7311. this._element.style.display = 'block';
  7312. this._element.removeAttribute('aria-hidden');
  7313. this._element.scrollTop = 0;
  7314. if (transition) {
  7315. _util2.default.reflow(this._element);
  7316. }
  7317. $(this._element).addClass(ClassName.SHOW);
  7318. if (this._config.focus) {
  7319. this._enforceFocus();
  7320. }
  7321. var shownEvent = $.Event(Event.SHOWN, {
  7322. relatedTarget: relatedTarget
  7323. });
  7324. var transitionComplete = function transitionComplete() {
  7325. if (_this3._config.focus) {
  7326. _this3._element.focus();
  7327. }
  7328. _this3._isTransitioning = false;
  7329. $(_this3._element).trigger(shownEvent);
  7330. };
  7331. if (transition) {
  7332. $(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
  7333. } else {
  7334. transitionComplete();
  7335. }
  7336. }
  7337. }, {
  7338. key: '_enforceFocus',
  7339. value: function _enforceFocus() {
  7340. var _this4 = this;
  7341. $(document).off(Event.FOCUSIN) // guard against infinite focus loop
  7342. .on(Event.FOCUSIN, function (event) {
  7343. if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) {
  7344. _this4._element.focus();
  7345. }
  7346. });
  7347. }
  7348. }, {
  7349. key: '_setEscapeEvent',
  7350. value: function _setEscapeEvent() {
  7351. var _this5 = this;
  7352. if (this._isShown && this._config.keyboard) {
  7353. $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
  7354. if (event.which === ESCAPE_KEYCODE) {
  7355. event.preventDefault();
  7356. _this5.hide();
  7357. }
  7358. });
  7359. } else if (!this._isShown) {
  7360. $(this._element).off(Event.KEYDOWN_DISMISS);
  7361. }
  7362. }
  7363. }, {
  7364. key: '_setResizeEvent',
  7365. value: function _setResizeEvent() {
  7366. var _this6 = this;
  7367. if (this._isShown) {
  7368. $(window).on(Event.RESIZE, function (event) {
  7369. return _this6.handleUpdate(event);
  7370. });
  7371. } else {
  7372. $(window).off(Event.RESIZE);
  7373. }
  7374. }
  7375. }, {
  7376. key: '_hideModal',
  7377. value: function _hideModal() {
  7378. var _this7 = this;
  7379. this._element.style.display = 'none';
  7380. this._element.setAttribute('aria-hidden', true);
  7381. this._isTransitioning = false;
  7382. this._showBackdrop(function () {
  7383. $(document.body).removeClass(ClassName.OPEN);
  7384. _this7._resetAdjustments();
  7385. _this7._resetScrollbar();
  7386. $(_this7._element).trigger(Event.HIDDEN);
  7387. });
  7388. }
  7389. }, {
  7390. key: '_removeBackdrop',
  7391. value: function _removeBackdrop() {
  7392. if (this._backdrop) {
  7393. $(this._backdrop).remove();
  7394. this._backdrop = null;
  7395. }
  7396. }
  7397. }, {
  7398. key: '_showBackdrop',
  7399. value: function _showBackdrop(callback) {
  7400. var _this8 = this;
  7401. var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  7402. if (this._isShown && this._config.backdrop) {
  7403. var doAnimate = _util2.default.supportsTransitionEnd() && animate;
  7404. this._backdrop = document.createElement('div');
  7405. this._backdrop.className = ClassName.BACKDROP;
  7406. if (animate) {
  7407. $(this._backdrop).addClass(animate);
  7408. }
  7409. $(this._backdrop).appendTo(document.body);
  7410. $(this._element).on(Event.CLICK_DISMISS, function (event) {
  7411. if (_this8._ignoreBackdropClick) {
  7412. _this8._ignoreBackdropClick = false;
  7413. return;
  7414. }
  7415. if (event.target !== event.currentTarget) {
  7416. return;
  7417. }
  7418. if (_this8._config.backdrop === 'static') {
  7419. _this8._element.focus();
  7420. } else {
  7421. _this8.hide();
  7422. }
  7423. });
  7424. if (doAnimate) {
  7425. _util2.default.reflow(this._backdrop);
  7426. }
  7427. $(this._backdrop).addClass(ClassName.SHOW);
  7428. if (!callback) {
  7429. return;
  7430. }
  7431. if (!doAnimate) {
  7432. callback();
  7433. return;
  7434. }
  7435. $(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7436. } else if (!this._isShown && this._backdrop) {
  7437. $(this._backdrop).removeClass(ClassName.SHOW);
  7438. var callbackRemove = function callbackRemove() {
  7439. _this8._removeBackdrop();
  7440. if (callback) {
  7441. callback();
  7442. }
  7443. };
  7444. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7445. $(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7446. } else {
  7447. callbackRemove();
  7448. }
  7449. } else if (callback) {
  7450. callback();
  7451. }
  7452. }
  7453. // ----------------------------------------------------------------------
  7454. // the following methods are used to handle overflowing modals
  7455. // todo (fat): these should probably be refactored out of modal.js
  7456. // ----------------------------------------------------------------------
  7457. }, {
  7458. key: '_adjustDialog',
  7459. value: function _adjustDialog() {
  7460. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  7461. if (!this._isBodyOverflowing && isModalOverflowing) {
  7462. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  7463. }
  7464. if (this._isBodyOverflowing && !isModalOverflowing) {
  7465. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  7466. }
  7467. }
  7468. }, {
  7469. key: '_resetAdjustments',
  7470. value: function _resetAdjustments() {
  7471. this._element.style.paddingLeft = '';
  7472. this._element.style.paddingRight = '';
  7473. }
  7474. }, {
  7475. key: '_checkScrollbar',
  7476. value: function _checkScrollbar() {
  7477. var rect = document.body.getBoundingClientRect();
  7478. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  7479. this._scrollbarWidth = this._getScrollbarWidth();
  7480. }
  7481. }, {
  7482. key: '_setScrollbar',
  7483. value: function _setScrollbar() {
  7484. var _this9 = this;
  7485. if (this._isBodyOverflowing) {
  7486. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  7487. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  7488. // Adjust fixed content padding
  7489. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7490. var actualPadding = $(element)[0].style.paddingRight;
  7491. var calculatedPadding = $(element).css('padding-right');
  7492. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + 'px');
  7493. });
  7494. // Adjust sticky content margin
  7495. $(Selector.STICKY_CONTENT).each(function (index, element) {
  7496. var actualMargin = $(element)[0].style.marginRight;
  7497. var calculatedMargin = $(element).css('margin-right');
  7498. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + 'px');
  7499. });
  7500. // Adjust navbar-toggler margin
  7501. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7502. var actualMargin = $(element)[0].style.marginRight;
  7503. var calculatedMargin = $(element).css('margin-right');
  7504. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + 'px');
  7505. });
  7506. // Adjust body padding
  7507. var actualPadding = document.body.style.paddingRight;
  7508. var calculatedPadding = $('body').css('padding-right');
  7509. $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
  7510. }
  7511. }
  7512. }, {
  7513. key: '_resetScrollbar',
  7514. value: function _resetScrollbar() {
  7515. // Restore fixed content padding
  7516. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7517. var padding = $(element).data('padding-right');
  7518. if (typeof padding !== 'undefined') {
  7519. $(element).css('padding-right', padding).removeData('padding-right');
  7520. }
  7521. });
  7522. // Restore sticky content and navbar-toggler margin
  7523. $(Selector.STICKY_CONTENT + ', ' + Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7524. var margin = $(element).data('margin-right');
  7525. if (typeof margin !== 'undefined') {
  7526. $(element).css('margin-right', margin).removeData('margin-right');
  7527. }
  7528. });
  7529. // Restore body padding
  7530. var padding = $('body').data('padding-right');
  7531. if (typeof padding !== 'undefined') {
  7532. $('body').css('padding-right', padding).removeData('padding-right');
  7533. }
  7534. }
  7535. }, {
  7536. key: '_getScrollbarWidth',
  7537. value: function _getScrollbarWidth() {
  7538. // thx d.walsh
  7539. var scrollDiv = document.createElement('div');
  7540. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  7541. document.body.appendChild(scrollDiv);
  7542. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  7543. document.body.removeChild(scrollDiv);
  7544. return scrollbarWidth;
  7545. }
  7546. // static
  7547. }], [{
  7548. key: '_jQueryInterface',
  7549. value: function _jQueryInterface(config, relatedTarget) {
  7550. return this.each(function () {
  7551. var data = $(this).data(DATA_KEY);
  7552. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  7553. if (!data) {
  7554. data = new Modal(this, _config);
  7555. $(this).data(DATA_KEY, data);
  7556. }
  7557. if (typeof config === 'string') {
  7558. if (typeof data[config] === 'undefined') {
  7559. throw new Error('No method named "' + config + '"');
  7560. }
  7561. data[config](relatedTarget);
  7562. } else if (_config.show) {
  7563. data.show(relatedTarget);
  7564. }
  7565. });
  7566. }
  7567. }, {
  7568. key: 'VERSION',
  7569. get: function get() {
  7570. return VERSION;
  7571. }
  7572. }, {
  7573. key: 'Default',
  7574. get: function get() {
  7575. return Default;
  7576. }
  7577. }]);
  7578. return Modal;
  7579. }();
  7580. /**
  7581. * ------------------------------------------------------------------------
  7582. * Data Api implementation
  7583. * ------------------------------------------------------------------------
  7584. */
  7585. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  7586. var _this10 = this;
  7587. var target = void 0;
  7588. var selector = _util2.default.getSelectorFromElement(this);
  7589. if (selector) {
  7590. target = $(selector)[0];
  7591. }
  7592. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  7593. if (this.tagName === 'A' || this.tagName === 'AREA') {
  7594. event.preventDefault();
  7595. }
  7596. var $target = $(target).one(Event.SHOW, function (showEvent) {
  7597. if (showEvent.isDefaultPrevented()) {
  7598. // only register focus restorer if modal will actually get shown
  7599. return;
  7600. }
  7601. $target.one(Event.HIDDEN, function () {
  7602. if ($(_this10).is(':visible')) {
  7603. _this10.focus();
  7604. }
  7605. });
  7606. });
  7607. Modal._jQueryInterface.call($(target), config, this);
  7608. });
  7609. /**
  7610. * ------------------------------------------------------------------------
  7611. * jQuery
  7612. * ------------------------------------------------------------------------
  7613. */
  7614. $.fn[NAME] = Modal._jQueryInterface;
  7615. $.fn[NAME].Constructor = Modal;
  7616. $.fn[NAME].noConflict = function () {
  7617. $.fn[NAME] = JQUERY_NO_CONFLICT;
  7618. return Modal._jQueryInterface;
  7619. };
  7620. return Modal;
  7621. }(_util2.default.jQuery);
  7622. exports.default = Modal;
  7623. /***/ }),
  7624. /* 17 */
  7625. /***/ (function(module, exports, __webpack_require__) {
  7626. "use strict";
  7627. Object.defineProperty(exports, "__esModule", {
  7628. value: true
  7629. });
  7630. var _enquire = __webpack_require__(31);
  7631. var _enquire2 = _interopRequireDefault(_enquire);
  7632. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7633. var layersNav = {
  7634. init: function init() {
  7635. this.cacheDom();
  7636. this.bindEvents();
  7637. },
  7638. cacheDom: function cacheDom() {
  7639. this.$nav = $('.lu-nav');
  7640. this.$navigationDroDownLi = this.$nav.find('.lu-nav__item.has-dropdown');
  7641. },
  7642. bindEvents: function bindEvents() {
  7643. var that = this;
  7644. this.$navigationDroDownLi.on('click', this.checkDropDownStatus.bind(this));
  7645. var isMobile = false; //initiate as false
  7646. // device detection
  7647. if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4)) || window.ontouchstart !== undefined) {
  7648. isMobile = true;
  7649. };
  7650. _enquire2.default.register("screen and (min-width: 0) and (max-width: 751px)", {
  7651. match: function match() {
  7652. $('.has-dropdown > a').on('click', function (event) {
  7653. event.preventDefault();
  7654. });
  7655. },
  7656. unmatch: function unmatch() {
  7657. $('.has-dropdown > a').on('click', function (event) {
  7658. if (isMobile == true || $(this).parents('.navbar--thin').length == 0) {
  7659. event.preventDefault(); // I need to change that
  7660. }
  7661. });
  7662. }
  7663. });
  7664. _enquire2.default.register("screen and (min-width: 752px)", {
  7665. match: function match(event) {
  7666. $('.has-dropdown > a').on('click', function (event) {
  7667. if ($(this).parents('.navigation').length == 0 && (isMobile == true || $(this).parents('.navbar--thin').length == 0)) {
  7668. event.preventDefault(); // I need to change that
  7669. }
  7670. });
  7671. },
  7672. unmatch: function unmatch() {
  7673. $('.has-dropdown > a').on('click', function (event) {
  7674. event.preventDefault();
  7675. });
  7676. }
  7677. });
  7678. $(window).on('click', function (event) {
  7679. $('.nav .has-dropdown').removeClass('is-open');
  7680. }.bind(this));
  7681. },
  7682. checkDropDownStatus: function checkDropDownStatus(event) {
  7683. var toggleBack = this.$nav.find('[data-toggle="back"]');
  7684. var toggleBackI = this.$nav.find('[data-toggle="back"] i');
  7685. if (toggleBack.is(event.target) || toggleBackI.is(event.target)) {} else {
  7686. if ($(event.currentTarget).hasClass('is-open')) {
  7687. this.hideDropDown(event);
  7688. } else {
  7689. this.showDropDown(event);
  7690. }
  7691. }
  7692. },
  7693. showDropDown: function showDropDown(event) {
  7694. event.stopPropagation(); // I need to change that
  7695. var dropDownElement = $(event.currentTarget);
  7696. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7697. dropDownElement.closest('.lu-nav').find('.is-open').removeClass('is-open');
  7698. dropDownElement.addClass('is-open');
  7699. },
  7700. hideDropDown: function hideDropDown(event) {
  7701. var dropDownElement = $(event.currentTarget);
  7702. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7703. dropDownElement.removeClass('is-open');
  7704. }
  7705. }; // import enquire from 'enquire';
  7706. // import superfish from 'superfish';
  7707. // const SELECTORS = {
  7708. // container: '.nav',
  7709. // item: '.has-dropdown',
  7710. // };
  7711. // const Default = {
  7712. // active: '.is-open',
  7713. // open: 'hover'
  7714. // };
  7715. // class Nav{
  7716. // constructor(container, options){
  7717. // this.container = container;
  7718. // this.items = $(container).find(SELECTORS.item);
  7719. // this.options = options;
  7720. // this.getConfig();
  7721. // this.bindEvents();
  7722. // }
  7723. // bindEvents(){
  7724. // this.items.on('click', this.checkStatus.bind(this));
  7725. // $(document).on('click', this.clickOutside.bind(this));
  7726. // }
  7727. // getConfig(){
  7728. // var dataConfig = this.container.data();
  7729. // if(dataConfig.options){
  7730. // this.dataOptions = util.parseDataOptions(dataConfig.options);
  7731. // }else{
  7732. // this.dataOptions = {};
  7733. // }
  7734. // this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7735. // }
  7736. // checkStatus(event){
  7737. // if ($(event.currentTarget).hasClass('is-open')) {
  7738. // this.hide(event);
  7739. // } else {
  7740. // this.show(event);
  7741. // }
  7742. // }
  7743. // show(event) {
  7744. // let item = $(event.currentTarget);
  7745. // event.stopPropagation();
  7746. // if(this.config.open == 'click'){
  7747. // this.hideOld();
  7748. // item.addClass('is-open');
  7749. // }else if(this.config.open == 'hover'){
  7750. // this.initSuperFish();
  7751. // console.log('test');
  7752. // }
  7753. // }
  7754. // hide(event) {
  7755. // let item = $(event.currentTarget);
  7756. // item.removeClass('is-open');
  7757. // }
  7758. // hideOld(){
  7759. // this.container.find('.is-open').removeClass('is-open');
  7760. // }
  7761. // initSuperFish(){
  7762. // $(this.container).superfish({
  7763. // hoverClass: 'is-open',
  7764. // popUpSelector: '.has-dropdown',
  7765. // delay: 600,
  7766. // animation: {}
  7767. // });
  7768. // }
  7769. // clickOutside(){
  7770. // if(!$(event.target).closest(SELECTORS.container).length) {
  7771. // if($(SELECTORS.container).is(":visible")) {
  7772. // this.hideOld();
  7773. // }
  7774. // }
  7775. // }
  7776. // }
  7777. // function initDataSelectors(){
  7778. // $(SELECTORS.container).each(function(){
  7779. // new Nav($(this));
  7780. // });
  7781. // }
  7782. // function initJqueryPlugin(){
  7783. // $.fn.luNav = function( options ) {
  7784. // return this.each(function() {
  7785. // new Nav($(this), options);
  7786. // });
  7787. // };
  7788. // }
  7789. // const init = {
  7790. // initDataSelectors,
  7791. // initJqueryPlugin,
  7792. // };
  7793. // export default init;
  7794. exports.default = layersNav;
  7795. /***/ }),
  7796. /* 18 */
  7797. /***/ (function(module, exports, __webpack_require__) {
  7798. "use strict";
  7799. Object.defineProperty(exports, "__esModule", {
  7800. value: true
  7801. });
  7802. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7803. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7804. /**
  7805. * Switcher.js
  7806. * Copyright 2016, RSstudio
  7807. *
  7808. * http://rsstudio.net
  7809. *
  7810. * All rights reserved
  7811. *
  7812. */
  7813. var SELECTORS = {
  7814. container: '[data-switcher]',
  7815. item: '[data-switcher-item]',
  7816. itemHighlight: '[data-switcher-highlight]'
  7817. };
  7818. var Default = {
  7819. activeElement: 2,
  7820. transition: 'all 500ms cubic-bezier(.250, .250, .000, 1.015)'
  7821. };
  7822. var Switcher = function () {
  7823. function Switcher(element, options) {
  7824. _classCallCheck(this, Switcher);
  7825. this.element = $(element);
  7826. this.items = element.find(SELECTORS.item);
  7827. this.itemHighlight = this.element.find(SELECTORS.itemHighlight);
  7828. this.options = options;
  7829. this.activeItemData = {};
  7830. this.isInit = false;
  7831. this.getConfig();
  7832. this.setActiveItem(this.config.activeElement);
  7833. this.bindEvents();
  7834. }
  7835. _createClass(Switcher, [{
  7836. key: 'getConfig',
  7837. value: function getConfig() {
  7838. var dataConfig = this.element.data();
  7839. if (dataConfig.options) {
  7840. this.dataOptions = util.parseDataOptions(dataConfig.options);
  7841. } else {
  7842. this.dataOptions = {};
  7843. }
  7844. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7845. }
  7846. }, {
  7847. key: 'bindEvents',
  7848. value: function bindEvents() {
  7849. var _this = this;
  7850. this.items.on('click', function (event) {
  7851. return _this.slideToItem(event.currentTarget);
  7852. });
  7853. $(window).on('resize', function (event) {
  7854. return _this.onResize(event);
  7855. });
  7856. }
  7857. }, {
  7858. key: 'setActiveItem',
  7859. value: function setActiveItem(itemIndex) {
  7860. this.slideToItem(this.items[itemIndex]);
  7861. }
  7862. }, {
  7863. key: 'getItemPosition',
  7864. value: function getItemPosition(element) {
  7865. this.activeItemData.element = $(element);
  7866. this.activeItemData.width = $(this.activeItemData.element).outerWidth();
  7867. this.activeItemData.position = $(this.activeItemData.element).position().left;
  7868. }
  7869. }, {
  7870. key: 'slideToItem',
  7871. value: function slideToItem(element) {
  7872. if (this.activeItemData.element) {
  7873. this.activeItemData.element.removeClass('is-active');
  7874. }
  7875. this.getItemPosition(element);
  7876. this.itemHighlight.css({
  7877. 'transform': 'translateX(' + this.activeItemData.position + 'px)',
  7878. 'width': this.activeItemData.width
  7879. });
  7880. if (this.isInit) {
  7881. this.itemHighlight.css({
  7882. transition: this.config.transition
  7883. });
  7884. } else {
  7885. this.onInit();
  7886. this.isInit = true;
  7887. }
  7888. this.onSlide();
  7889. }
  7890. }, {
  7891. key: 'onInit',
  7892. value: function onInit() {
  7893. if (typeof this.config.onInit === 'function') {
  7894. this.config.onInit(this.element, this.activeItemData.element);
  7895. }
  7896. }
  7897. }, {
  7898. key: 'onSlide',
  7899. value: function onSlide() {
  7900. if (typeof this.config.onSlide === 'function') {
  7901. this.config.onSlide(this.element, this.activeItemData.element);
  7902. }
  7903. this.activeItemData.element.addClass('is-active');
  7904. }
  7905. }, {
  7906. key: 'onResize',
  7907. value: function onResize() {
  7908. if (typeof this.config.onSlide === 'function') {
  7909. this.config.onResize(this.element, this.activeItemData.element);
  7910. }
  7911. this.activeItemData.element.trigger('click');
  7912. }
  7913. }]);
  7914. return Switcher;
  7915. }();
  7916. function initDataSelectors() {
  7917. $(document).ready(function () {
  7918. $(SELECTORS.container).each(function () {
  7919. new Switcher($(this));
  7920. });
  7921. });
  7922. }
  7923. function initJqueryPlugin() {
  7924. $.fn.luSwitcher = function (options) {
  7925. return this.each(function () {
  7926. var switcher = new Switcher($(this), options);
  7927. });
  7928. };
  7929. }
  7930. var init = {
  7931. initDataSelectors: initDataSelectors,
  7932. initJqueryPlugin: initJqueryPlugin
  7933. };
  7934. exports.default = init;
  7935. /***/ }),
  7936. /* 19 */
  7937. /***/ (function(module, exports, __webpack_require__) {
  7938. "use strict";
  7939. Object.defineProperty(exports, "__esModule", {
  7940. value: true
  7941. });
  7942. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7943. var _util = __webpack_require__(0);
  7944. var _util2 = _interopRequireDefault(_util);
  7945. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7946. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7947. /**
  7948. * --------------------------------------------------------------------------
  7949. * Bootstrap (v4.0.0-beta.2): tab.js
  7950. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7951. * --------------------------------------------------------------------------
  7952. */
  7953. var Tab = function () {
  7954. /**
  7955. * ------------------------------------------------------------------------
  7956. * Constants
  7957. * ------------------------------------------------------------------------
  7958. */
  7959. var NAME = 'lu-tab';
  7960. var VERSION = '4.0.0-beta.2';
  7961. var DATA_KEY = 'bs.tab';
  7962. var EVENT_KEY = '.' + DATA_KEY;
  7963. var DATA_API_KEY = '.data-api';
  7964. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7965. var TRANSITION_DURATION = 150;
  7966. var Event = {
  7967. HIDE: 'hide' + EVENT_KEY,
  7968. HIDDEN: 'hidden' + EVENT_KEY,
  7969. SHOW: 'show' + EVENT_KEY,
  7970. SHOWN: 'shown' + EVENT_KEY,
  7971. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7972. };
  7973. var ClassName = {
  7974. DROPDOWN_MENU: 'dropdown-menu',
  7975. ACTIVE: 'is-active',
  7976. DISABLED: 'disabled',
  7977. FADE: 'fade',
  7978. SHOW: 'show'
  7979. };
  7980. var Selector = {
  7981. DROPDOWN: '.dropdown',
  7982. NAV_LIST_GROUP: '.lu-nav, .lu-list-group',
  7983. ACTIVE: '.is-active',
  7984. ACTIVE_UL: '> .is-active',
  7985. DATA_TOGGLE: '[data-toggle="lu-tab"], [data-toggle="pill"], [data-toggle="list"]',
  7986. DROPDOWN_TOGGLE: '.dropdown-toggle',
  7987. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .is-active'
  7988. /**
  7989. * ------------------------------------------------------------------------
  7990. * Class Definition
  7991. * ------------------------------------------------------------------------
  7992. */
  7993. };
  7994. var Tab = function () {
  7995. function Tab(element) {
  7996. _classCallCheck(this, Tab);
  7997. this._element = element;
  7998. }
  7999. // getters
  8000. _createClass(Tab, [{
  8001. key: 'show',
  8002. // public
  8003. value: function show() {
  8004. var _this = this;
  8005. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
  8006. return;
  8007. }
  8008. var target = void 0;
  8009. var previous = void 0;
  8010. var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
  8011. var selector = _util2.default.getSelectorFromElement(this._element);
  8012. if (listElement) {
  8013. var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
  8014. previous = $.makeArray($(listElement).find(itemSelector));
  8015. previous = previous[previous.length - 1];
  8016. }
  8017. var hideEvent = $.Event(Event.HIDE, {
  8018. relatedTarget: this._element
  8019. });
  8020. var showEvent = $.Event(Event.SHOW, {
  8021. relatedTarget: previous
  8022. });
  8023. if (previous) {
  8024. $(previous).trigger(hideEvent);
  8025. }
  8026. $(this._element).trigger(showEvent);
  8027. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  8028. return;
  8029. }
  8030. if (selector) {
  8031. target = $(selector)[0];
  8032. }
  8033. this._activate(this._element, listElement);
  8034. var complete = function complete() {
  8035. var hiddenEvent = $.Event(Event.HIDDEN, {
  8036. relatedTarget: _this._element
  8037. });
  8038. var shownEvent = $.Event(Event.SHOWN, {
  8039. relatedTarget: previous
  8040. });
  8041. $(previous).trigger(hiddenEvent);
  8042. $(_this._element).trigger(shownEvent);
  8043. };
  8044. if (target) {
  8045. this._activate(target, target.parentNode, complete);
  8046. } else {
  8047. complete();
  8048. }
  8049. }
  8050. }, {
  8051. key: 'dispose',
  8052. value: function dispose() {
  8053. $.removeData(this._element, DATA_KEY);
  8054. this._element = null;
  8055. }
  8056. // private
  8057. }, {
  8058. key: '_activate',
  8059. value: function _activate(element, container, callback) {
  8060. var _this2 = this;
  8061. var activeElements = void 0;
  8062. if (container.nodeName === 'UL') {
  8063. activeElements = $(container).find(Selector.ACTIVE_UL);
  8064. } else {
  8065. activeElements = $(container).children(Selector.ACTIVE);
  8066. }
  8067. var active = activeElements[0];
  8068. var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
  8069. var complete = function complete() {
  8070. return _this2._transitionComplete(element, active, isTransitioning, callback);
  8071. };
  8072. if (active && isTransitioning) {
  8073. $(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  8074. } else {
  8075. complete();
  8076. }
  8077. if (active) {
  8078. $(active).removeClass(ClassName.SHOW);
  8079. }
  8080. }
  8081. }, {
  8082. key: '_transitionComplete',
  8083. value: function _transitionComplete(element, active, isTransitioning, callback) {
  8084. if (active) {
  8085. $(active).removeClass(ClassName.ACTIVE);
  8086. var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  8087. if (dropdownChild) {
  8088. $(dropdownChild).removeClass(ClassName.ACTIVE);
  8089. }
  8090. if (active.getAttribute('role') === 'tab') {
  8091. active.setAttribute('aria-selected', false);
  8092. }
  8093. }
  8094. if ($(element).is("a")) {
  8095. $(element).parent().addClass(ClassName.ACTIVE);
  8096. } else {
  8097. $(element).addClass(ClassName.ACTIVE);
  8098. }
  8099. if (element.getAttribute('role') === 'tab') {
  8100. element.setAttribute('aria-selected', true);
  8101. }
  8102. if (isTransitioning) {
  8103. _util2.default.reflow(element);
  8104. $(element).addClass(ClassName.SHOW);
  8105. } else {
  8106. $(element).removeClass(ClassName.FADE);
  8107. }
  8108. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  8109. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  8110. if (dropdownElement) {
  8111. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8112. }
  8113. element.setAttribute('aria-expanded', true);
  8114. }
  8115. if (callback) {
  8116. callback();
  8117. }
  8118. }
  8119. // static
  8120. }], [{
  8121. key: '_jQueryInterface',
  8122. value: function _jQueryInterface(config) {
  8123. return this.each(function () {
  8124. var $this = $(this);
  8125. var data = $this.data(DATA_KEY);
  8126. if (!data) {
  8127. data = new Tab(this);
  8128. $this.data(DATA_KEY, data);
  8129. }
  8130. if (typeof config === 'string') {
  8131. if (typeof data[config] === 'undefined') {
  8132. throw new Error('No method named "' + config + '"');
  8133. }
  8134. data[config]();
  8135. }
  8136. });
  8137. }
  8138. }, {
  8139. key: 'VERSION',
  8140. get: function get() {
  8141. return VERSION;
  8142. }
  8143. }]);
  8144. return Tab;
  8145. }();
  8146. /**
  8147. * ------------------------------------------------------------------------
  8148. * Data Api implementation
  8149. * ------------------------------------------------------------------------
  8150. */
  8151. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  8152. event.preventDefault();
  8153. Tab._jQueryInterface.call($(this), 'show');
  8154. });
  8155. /**
  8156. * ------------------------------------------------------------------------
  8157. * jQuery
  8158. * ------------------------------------------------------------------------
  8159. */
  8160. $.fn[NAME] = Tab._jQueryInterface;
  8161. $.fn[NAME].Constructor = Tab;
  8162. $.fn[NAME].noConflict = function () {
  8163. $.fn[NAME] = JQUERY_NO_CONFLICT;
  8164. return Tab._jQueryInterface;
  8165. };
  8166. return Tab;
  8167. }(_util2.default.jQuery);
  8168. exports.default = Tab;
  8169. /***/ }),
  8170. /* 20 */
  8171. /***/ (function(module, exports, __webpack_require__) {
  8172. "use strict";
  8173. Object.defineProperty(exports, "__esModule", {
  8174. value: true
  8175. });
  8176. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8177. var _Swiper = __webpack_require__(4);
  8178. var _Swiper2 = _interopRequireDefault(_Swiper);
  8179. var _util = __webpack_require__(0);
  8180. var _util2 = _interopRequireDefault(_util);
  8181. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8182. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8183. var SELECTORS = {
  8184. button: '[data-toggle="offCanvas"]',
  8185. overlayers: '.overlayer',
  8186. dismiss: '[data-dismiss="offCanvas"]'
  8187. };
  8188. var Default = {
  8189. position: 'right',
  8190. activeClass: 'is-open',
  8191. mode: 'normal',
  8192. tranition: 400,
  8193. overlayer: false,
  8194. bodyClass: 'off-canvas-is-active'
  8195. };
  8196. var OffCanvas = function () {
  8197. function OffCanvas(element, options) {
  8198. _classCallCheck(this, OffCanvas);
  8199. this.element = element;
  8200. this.options = options;
  8201. this.getConfig();
  8202. this.bindEvents();
  8203. }
  8204. _createClass(OffCanvas, [{
  8205. key: 'getConfig',
  8206. value: function getConfig() {
  8207. var dataConfig = this.element.data();
  8208. if (dataConfig.options) {
  8209. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8210. } else {
  8211. this.dataOptions = {};
  8212. }
  8213. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8214. this.target = $(this.config.target);
  8215. this.dismiss = this.target.find(SELECTORS.dismiss);
  8216. }
  8217. }, {
  8218. key: 'bindEvents',
  8219. value: function bindEvents() {
  8220. var _this = this;
  8221. this.element.on('click', function (event) {
  8222. return _this.checkState(event);
  8223. });
  8224. this.dismiss.on('click', function () {
  8225. return _this.close();
  8226. });
  8227. $(document).on('click', function (event) {
  8228. return _this.addEventClickOutside(event);
  8229. });
  8230. }
  8231. }, {
  8232. key: 'checkState',
  8233. value: function checkState() {
  8234. if (this.target.hasClass(this.config.activeClass)) {
  8235. this.close();
  8236. } else {
  8237. this.open();
  8238. }
  8239. }
  8240. }, {
  8241. key: 'open',
  8242. value: function open(evnet) {
  8243. $(this.target).addClass(this.config.activeClass);
  8244. $('body').addClass(this.config.bodyClass);
  8245. }
  8246. }, {
  8247. key: 'close',
  8248. value: function close(event) {
  8249. $(this.target).removeClass(this.config.activeClass);
  8250. $('body').removeClass(this.config.bodyClass);
  8251. }
  8252. }, {
  8253. key: 'addEventClickOutside',
  8254. value: function addEventClickOutside(event) {
  8255. if (!$(event.target).closest(this.target).length && !$(event.target).closest(this.element).length) {
  8256. if ($(this.target).is(":visible")) {
  8257. this.close();
  8258. }
  8259. }
  8260. }
  8261. }]);
  8262. return OffCanvas;
  8263. }();
  8264. function initDataSelectors() {
  8265. $(SELECTORS.button).each(function () {
  8266. new OffCanvas($(this));
  8267. });
  8268. }
  8269. function initJqueryPlugin() {
  8270. $.fn.luOffCanvas = function (options) {
  8271. return this.each(function () {
  8272. new OffCanvas($(this), options);
  8273. });
  8274. };
  8275. }
  8276. var init = {
  8277. initDataSelectors: initDataSelectors,
  8278. initJqueryPlugin: initJqueryPlugin
  8279. };
  8280. exports.default = init;
  8281. /***/ }),
  8282. /* 21 */
  8283. /***/ (function(module, exports, __webpack_require__) {
  8284. "use strict";
  8285. Object.defineProperty(exports, "__esModule", {
  8286. value: true
  8287. });
  8288. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8289. var _util = __webpack_require__(0);
  8290. var _util2 = _interopRequireDefault(_util);
  8291. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8292. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8293. var SELECTORS = {
  8294. link: '[data-scroll-to]'
  8295. };
  8296. var Default = {
  8297. topOffset: 10,
  8298. animation: 'normal',
  8299. speed: 400,
  8300. constantSpeed: false
  8301. };
  8302. var ScrollTo = function () {
  8303. function ScrollTo(element, options) {
  8304. _classCallCheck(this, ScrollTo);
  8305. this.element = element;
  8306. this.options = options;
  8307. this.hash = $(element).attr('href');
  8308. this.target = $(this.hash);
  8309. if (!this.target.length) {
  8310. return;
  8311. }
  8312. this.getConfig();
  8313. this.bindEvents();
  8314. this.targetVisibility();
  8315. }
  8316. _createClass(ScrollTo, [{
  8317. key: 'bindEvents',
  8318. value: function bindEvents() {
  8319. var _this = this;
  8320. $(this.element).on('click', function (event) {
  8321. return _this.startScroll(event);
  8322. });
  8323. $(window).on('scroll', function (event) {
  8324. return _this.targetVisibility(event);
  8325. });
  8326. }
  8327. }, {
  8328. key: 'getConfig',
  8329. value: function getConfig() {
  8330. var dataConfig = this.element.data();
  8331. if (dataConfig.options) {
  8332. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8333. } else {
  8334. this.dataOptions = {};
  8335. }
  8336. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8337. }
  8338. }, {
  8339. key: 'startScroll',
  8340. value: function startScroll(event) {
  8341. this.targetPosition = this.target.offset().top + this.config.topOffset;
  8342. console.log(this.getAnimationSpeed());
  8343. $("body, html").stop().animate({
  8344. scrollTop: this.targetPosition
  8345. }, this.config.speed);
  8346. }
  8347. }, {
  8348. key: 'isOnScreen',
  8349. value: function isOnScreen() {
  8350. var win = $(window);
  8351. var viewport = {
  8352. top: win.scrollTop(),
  8353. left: win.scrollLeft()
  8354. };
  8355. viewport.right = viewport.left + win.width();
  8356. viewport.bottom = viewport.top + win.height();
  8357. var bounds = this.target.offset();
  8358. bounds.right = bounds.left + this.target.outerWidth();
  8359. bounds.bottom = bounds.top + this.target.outerHeight();
  8360. return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom);
  8361. }
  8362. }, {
  8363. key: 'targetVisibility',
  8364. value: function targetVisibility() {
  8365. if (this.isOnScreen()) {
  8366. this.onScreen();
  8367. } else {
  8368. this.outScreen();
  8369. }
  8370. }
  8371. }, {
  8372. key: 'onScreen',
  8373. value: function onScreen() {
  8374. if (typeof this.config.onScreen === 'function') {
  8375. this.config.onScreen(this.element, this.target);
  8376. }
  8377. }
  8378. }, {
  8379. key: 'outScreen',
  8380. value: function outScreen() {
  8381. if (typeof this.config.outScreen === 'function') {
  8382. this.config.outScreen(this.element, this.target);
  8383. }
  8384. }
  8385. }, {
  8386. key: 'getOffset',
  8387. value: function getOffset() {
  8388. return Math.abs(this.target.offset().top - $(window).scrollTop());
  8389. }
  8390. }, {
  8391. key: 'getAnimationSpeed',
  8392. value: function getAnimationSpeed() {
  8393. return this.getOffset() / this.config.speed * this.config.speed;
  8394. }
  8395. }]);
  8396. return ScrollTo;
  8397. }();
  8398. function initDataSelectors() {
  8399. $(SELECTORS.link).each(function () {
  8400. new ScrollTo($(this));
  8401. });
  8402. }
  8403. function initJqueryPlugin() {
  8404. $.fn.luScrollTo = function (options) {
  8405. return this.each(function () {
  8406. new ScrollTo($(this), options);
  8407. });
  8408. };
  8409. }
  8410. var init = {
  8411. initDataSelectors: initDataSelectors,
  8412. initJqueryPlugin: initJqueryPlugin
  8413. };
  8414. exports.default = init;
  8415. /***/ }),
  8416. /* 22 */
  8417. /***/ (function(module, exports, __webpack_require__) {
  8418. "use strict";
  8419. Object.defineProperty(exports, "__esModule", {
  8420. value: true
  8421. });
  8422. 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; };
  8423. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8424. var _jquery = __webpack_require__(1);
  8425. var _jquery2 = _interopRequireDefault(_jquery);
  8426. var _util = __webpack_require__(0);
  8427. var _util2 = _interopRequireDefault(_util);
  8428. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8429. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8430. /**
  8431. * --------------------------------------------------------------------------
  8432. * Bootstrap (v4.0.0-beta): scrollspy.js
  8433. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  8434. * --------------------------------------------------------------------------
  8435. */
  8436. var ScrollSpy = function () {
  8437. /**
  8438. * ------------------------------------------------------------------------
  8439. * Constants
  8440. * ------------------------------------------------------------------------
  8441. */
  8442. var NAME = 'scrollspy';
  8443. var VERSION = '4.0.0-beta';
  8444. var DATA_KEY = 'bs.scrollspy';
  8445. var EVENT_KEY = '.' + DATA_KEY;
  8446. var DATA_API_KEY = '.data-api';
  8447. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  8448. var Default = {
  8449. offset: 10,
  8450. method: 'auto',
  8451. target: ''
  8452. };
  8453. var DefaultType = {
  8454. offset: 'number',
  8455. method: 'string',
  8456. target: '(string|element)'
  8457. };
  8458. var Event = {
  8459. ACTIVATE: 'activate' + EVENT_KEY,
  8460. SCROLL: 'scroll' + EVENT_KEY,
  8461. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  8462. };
  8463. var ClassName = {
  8464. DROPDOWN_ITEM: 'dropdown-item',
  8465. DROPDOWN_MENU: 'dropdown-menu',
  8466. ACTIVE: 'is-active'
  8467. };
  8468. var Selector = {
  8469. DATA_SPY: '[data-spy="scroll"]',
  8470. ACTIVE: '.is-active',
  8471. NAV_LIST_GROUP: '.nav, .list-group',
  8472. NAV_LINKS: '.nav__link',
  8473. NAV_ITEMS: '.nav__item',
  8474. LIST_ITEMS: '.list-group-item',
  8475. DROPDOWN: '.dropdown',
  8476. DROPDOWN_ITEMS: '.dropdown-item',
  8477. DROPDOWN_TOGGLE: '.dropdown-toggle'
  8478. };
  8479. var OffsetMethod = {
  8480. OFFSET: 'offset',
  8481. POSITION: 'position'
  8482. /**
  8483. * ------------------------------------------------------------------------
  8484. * Class Definition
  8485. * ------------------------------------------------------------------------
  8486. */
  8487. };
  8488. var ScrollSpy = function () {
  8489. function ScrollSpy(element, config) {
  8490. var _this = this;
  8491. _classCallCheck(this, ScrollSpy);
  8492. this._element = element;
  8493. this._scrollElement = element.tagName === 'BODY' ? window : element;
  8494. this._config = this._getConfig(config);
  8495. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  8496. this._offsets = [];
  8497. this._targets = [];
  8498. this._activeTarget = null;
  8499. this._scrollHeight = 0;
  8500. (0, _jquery2.default)(this._scrollElement).on(Event.SCROLL, function (event) {
  8501. return _this._process(event);
  8502. });
  8503. this.refresh();
  8504. this._process();
  8505. }
  8506. // getters
  8507. _createClass(ScrollSpy, [{
  8508. key: 'refresh',
  8509. // public
  8510. value: function refresh() {
  8511. var _this2 = this;
  8512. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  8513. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  8514. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  8515. this._offsets = [];
  8516. this._targets = [];
  8517. this._scrollHeight = this._getScrollHeight();
  8518. var targets = _jquery2.default.makeArray((0, _jquery2.default)(this._selector));
  8519. targets.map(function (element) {
  8520. var target = void 0;
  8521. var targetSelector = _util2.default.getSelectorFromElement(element);
  8522. if (targetSelector) {
  8523. target = (0, _jquery2.default)(targetSelector)[0];
  8524. }
  8525. if (target) {
  8526. var targetBCR = target.getBoundingClientRect();
  8527. if (targetBCR.width || targetBCR.height) {
  8528. // todo (fat): remove sketch reliance on jQuery position/offset
  8529. return [(0, _jquery2.default)(target)[offsetMethod]().top + offsetBase, targetSelector];
  8530. }
  8531. }
  8532. return null;
  8533. }).filter(function (item) {
  8534. return item;
  8535. }).sort(function (a, b) {
  8536. return a[0] - b[0];
  8537. }).forEach(function (item) {
  8538. _this2._offsets.push(item[0]);
  8539. _this2._targets.push(item[1]);
  8540. });
  8541. }
  8542. }, {
  8543. key: 'dispose',
  8544. value: function dispose() {
  8545. _jquery2.default.removeData(this._element, DATA_KEY);
  8546. (0, _jquery2.default)(this._scrollElement).off(EVENT_KEY);
  8547. this._element = null;
  8548. this._scrollElement = null;
  8549. this._config = null;
  8550. this._selector = null;
  8551. this._offsets = null;
  8552. this._targets = null;
  8553. this._activeTarget = null;
  8554. this._scrollHeight = null;
  8555. }
  8556. // private
  8557. }, {
  8558. key: '_getConfig',
  8559. value: function _getConfig(config) {
  8560. config = _jquery2.default.extend({}, Default, config);
  8561. if (typeof config.target !== 'string') {
  8562. var id = (0, _jquery2.default)(config.target).attr('id');
  8563. if (!id) {
  8564. id = _util2.default.getUID(NAME);
  8565. (0, _jquery2.default)(config.target).attr('id', id);
  8566. }
  8567. config.target = '#' + id;
  8568. }
  8569. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  8570. return config;
  8571. }
  8572. }, {
  8573. key: '_getScrollTop',
  8574. value: function _getScrollTop() {
  8575. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  8576. }
  8577. }, {
  8578. key: '_getScrollHeight',
  8579. value: function _getScrollHeight() {
  8580. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  8581. }
  8582. }, {
  8583. key: '_getOffsetHeight',
  8584. value: function _getOffsetHeight() {
  8585. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  8586. }
  8587. }, {
  8588. key: '_process',
  8589. value: function _process() {
  8590. var scrollTop = this._getScrollTop() + this._config.offset;
  8591. var scrollHeight = this._getScrollHeight();
  8592. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  8593. if (this._scrollHeight !== scrollHeight) {
  8594. this.refresh();
  8595. }
  8596. if (scrollTop >= maxScroll) {
  8597. var target = this._targets[this._targets.length - 1];
  8598. if (this._activeTarget !== target) {
  8599. this._activate(target);
  8600. }
  8601. return;
  8602. }
  8603. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  8604. this._activeTarget = null;
  8605. this._clear();
  8606. return;
  8607. }
  8608. for (var i = this._offsets.length; i--;) {
  8609. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  8610. if (isActiveTarget) {
  8611. this._activate(this._targets[i]);
  8612. }
  8613. }
  8614. }
  8615. }, {
  8616. key: '_activate',
  8617. value: function _activate(target) {
  8618. this._activeTarget = target;
  8619. this._clear();
  8620. var queries = this._selector.split(',');
  8621. // eslint-disable-next-line arrow-body-style
  8622. queries = queries.map(function (selector) {
  8623. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  8624. });
  8625. var $link = (0, _jquery2.default)(queries.join(','));
  8626. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  8627. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8628. $link.addClass(ClassName.ACTIVE);
  8629. } else {
  8630. // Set triggered link as active
  8631. $link.addClass(ClassName.ACTIVE);
  8632. // Set triggered links parents as active
  8633. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  8634. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
  8635. // Handle special case when .nav-link is inside .nav-item
  8636. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).addClass(ClassName.ACTIVE);
  8637. }
  8638. (0, _jquery2.default)(this._scrollElement).trigger(Event.ACTIVATE, {
  8639. relatedTarget: target
  8640. });
  8641. }
  8642. }, {
  8643. key: '_clear',
  8644. value: function _clear() {
  8645. (0, _jquery2.default)(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  8646. }
  8647. // static
  8648. }], [{
  8649. key: '_jQueryInterface',
  8650. value: function _jQueryInterface(config) {
  8651. return this.each(function () {
  8652. var data = (0, _jquery2.default)(this).data(DATA_KEY);
  8653. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  8654. if (!data) {
  8655. data = new ScrollSpy(this, _config);
  8656. (0, _jquery2.default)(this).data(DATA_KEY, data);
  8657. }
  8658. if (typeof config === 'string') {
  8659. if (typeof data[config] === 'undefined') {
  8660. throw new Error('No method named "' + config + '"');
  8661. }
  8662. data[config]();
  8663. }
  8664. });
  8665. }
  8666. }, {
  8667. key: 'VERSION',
  8668. get: function get() {
  8669. return VERSION;
  8670. }
  8671. }, {
  8672. key: 'Default',
  8673. get: function get() {
  8674. return Default;
  8675. }
  8676. }]);
  8677. return ScrollSpy;
  8678. }();
  8679. /**
  8680. * ------------------------------------------------------------------------
  8681. * Data Api implementation
  8682. * ------------------------------------------------------------------------
  8683. */
  8684. (0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
  8685. var scrollSpys = _jquery2.default.makeArray((0, _jquery2.default)(Selector.DATA_SPY));
  8686. for (var i = scrollSpys.length; i--;) {
  8687. var $spy = (0, _jquery2.default)(scrollSpys[i]);
  8688. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  8689. }
  8690. });
  8691. /**
  8692. * ------------------------------------------------------------------------
  8693. * jQuery
  8694. * ------------------------------------------------------------------------
  8695. */
  8696. _jquery2.default.fn[NAME] = ScrollSpy._jQueryInterface;
  8697. _jquery2.default.fn[NAME].Constructor = ScrollSpy;
  8698. _jquery2.default.fn[NAME].noConflict = function () {
  8699. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  8700. return ScrollSpy._jQueryInterface;
  8701. };
  8702. return ScrollSpy;
  8703. }(_jquery2.default);
  8704. exports.default = ScrollSpy;
  8705. /***/ }),
  8706. /* 23 */
  8707. /***/ (function(module, exports, __webpack_require__) {
  8708. "use strict";
  8709. Object.defineProperty(exports, "__esModule", {
  8710. value: true
  8711. });
  8712. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8713. var _stickySidebar = __webpack_require__(33);
  8714. var _stickySidebar2 = _interopRequireDefault(_stickySidebar);
  8715. var _util = __webpack_require__(0);
  8716. var _util2 = _interopRequireDefault(_util);
  8717. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8718. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8719. var SELECTORS = {
  8720. stickyElement: '[data-sticky]'
  8721. };
  8722. var Default = {
  8723. topOffset: 0,
  8724. bottomOffset: 0
  8725. };
  8726. var Sticky = function () {
  8727. function Sticky(element, options) {
  8728. _classCallCheck(this, Sticky);
  8729. this.element = element;
  8730. this.options = options;
  8731. this.getConfig();
  8732. this.initPlugn();
  8733. this.bindEvents();
  8734. }
  8735. _createClass(Sticky, [{
  8736. key: 'getConfig',
  8737. value: function getConfig() {
  8738. var dataConfig = this.element.data();
  8739. if (dataConfig.options) {
  8740. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8741. } else {
  8742. this.dataOptions = {};
  8743. }
  8744. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8745. }
  8746. }, {
  8747. key: 'initPlugn',
  8748. value: function initPlugn() {
  8749. this.stickyInstance = new _stickySidebar2.default(this.element[0], {
  8750. topSpacing: this.config.topOffset,
  8751. bottomSpacing: this.config.bottomOffset,
  8752. containerSelector: this.config.container,
  8753. resizeSensor: true,
  8754. stickyClass: 'is-sticky'
  8755. });
  8756. if (typeof this.config.onOpen === 'function') {
  8757. this.config.onInit(this.stickyInstance);
  8758. }
  8759. }
  8760. }, {
  8761. key: 'bindEvents',
  8762. value: function bindEvents() {}
  8763. }]);
  8764. return Sticky;
  8765. }();
  8766. function initDataSelectors() {
  8767. $(SELECTORS.stickyElement).each(function () {
  8768. new Sticky($(this));
  8769. });
  8770. }
  8771. function initJqueryPlugin() {
  8772. $.fn.luSticky = function (options) {
  8773. return this.each(function () {
  8774. new Sticky($(this), options);
  8775. });
  8776. };
  8777. }
  8778. var init = {
  8779. initDataSelectors: initDataSelectors,
  8780. initJqueryPlugin: initJqueryPlugin
  8781. };
  8782. exports.default = init;
  8783. /***/ }),
  8784. /* 24 */
  8785. /***/ (function(module, exports, __webpack_require__) {
  8786. "use strict";
  8787. Object.defineProperty(exports, "__esModule", {
  8788. value: true
  8789. });
  8790. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8791. var _util = __webpack_require__(0);
  8792. var _util2 = _interopRequireDefault(_util);
  8793. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8794. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8795. var SELECTORS = {
  8796. toggler: '[data-toggler]',
  8797. togglerOptions: '[data-toggler-options]'
  8798. };
  8799. var Default = {
  8800. selectors: '',
  8801. container: 'body'
  8802. };
  8803. var Toggler = function () {
  8804. function Toggler(element, options) {
  8805. _classCallCheck(this, Toggler);
  8806. this.element = element;
  8807. this.targets = [];
  8808. this.getConfig();
  8809. this.targetsNames = this.config.selectors.split(',');
  8810. this.setTargetElements();
  8811. this.bindEvents();
  8812. }
  8813. _createClass(Toggler, [{
  8814. key: 'bindEvents',
  8815. value: function bindEvents() {
  8816. var _this = this;
  8817. this.config = this.element.on('click', function () {
  8818. return _this.toggle();
  8819. });
  8820. }
  8821. }, {
  8822. key: 'getConfig',
  8823. value: function getConfig() {
  8824. var dataToggler = this.getTogglerOptions(this.element.data('toggler'));
  8825. this.config = $.extend({}, Default, dataToggler);
  8826. }
  8827. }, {
  8828. key: 'getTogglerOptions',
  8829. value: function getTogglerOptions(options) {
  8830. if (options) {
  8831. return _util2.default.parseDataOptions(options);
  8832. } else {
  8833. return [];
  8834. }
  8835. }
  8836. }, {
  8837. key: 'setTargetElements',
  8838. value: function setTargetElements() {
  8839. this.container = this.element.closest(this.config.container);
  8840. if (this.targetsNames.length > 1) {
  8841. var _iteratorNormalCompletion = true;
  8842. var _didIteratorError = false;
  8843. var _iteratorError = undefined;
  8844. try {
  8845. for (var _iterator = this.targetsNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  8846. var target = _step.value;
  8847. var element = this.container.find(target);
  8848. this.targets.push({
  8849. element: element,
  8850. options: this.getTogglerOptions(element.data('toggler-options'))
  8851. });
  8852. }
  8853. } catch (err) {
  8854. _didIteratorError = true;
  8855. _iteratorError = err;
  8856. } finally {
  8857. try {
  8858. if (!_iteratorNormalCompletion && _iterator.return) {
  8859. _iterator.return();
  8860. }
  8861. } finally {
  8862. if (_didIteratorError) {
  8863. throw _iteratorError;
  8864. }
  8865. }
  8866. }
  8867. }
  8868. if (this.container) {
  8869. this.targets.push({
  8870. element: this.container,
  8871. options: this.getTogglerOptions(this.container.data('toggler-options'))
  8872. });
  8873. }
  8874. }
  8875. }, {
  8876. key: 'toggle',
  8877. value: function toggle() {
  8878. for (var targetName in this.targets) {
  8879. var _targets$targetName = this.targets[targetName],
  8880. element = _targets$targetName.element,
  8881. options = _targets$targetName.options;
  8882. if (options.addClass) element.addClass(options.addClass);
  8883. if (options.removeClass) element.removeClass(options.removeClass);
  8884. if (options.toggleClass) element.toggleClass(options.toggleClass);
  8885. }
  8886. }
  8887. }]);
  8888. return Toggler;
  8889. }();
  8890. function initDataSelectors() {
  8891. $(SELECTORS.toggler).each(function () {
  8892. new Toggler($(this));
  8893. });
  8894. }
  8895. function initJqueryPlugin() {
  8896. $.fn.luToggler = function (options) {
  8897. return this.each(function () {
  8898. new Toggler($(this), options);
  8899. });
  8900. };
  8901. }
  8902. var init = {
  8903. initDataSelectors: initDataSelectors,
  8904. initJqueryPlugin: initJqueryPlugin
  8905. };
  8906. exports.default = init;
  8907. /***/ }),
  8908. /* 25 */,
  8909. /* 26 */,
  8910. /* 27 */,
  8911. /* 28 */
  8912. /***/ (function(module, exports, __webpack_require__) {
  8913. "use strict";
  8914. var _navs = __webpack_require__(17);
  8915. var _navs2 = _interopRequireDefault(_navs);
  8916. var _switcher = __webpack_require__(18);
  8917. var _switcher2 = _interopRequireDefault(_switcher);
  8918. __webpack_require__(19);
  8919. __webpack_require__(11);
  8920. var _selects = __webpack_require__(13);
  8921. var _selects2 = _interopRequireDefault(_selects);
  8922. var _selectInput = __webpack_require__(3);
  8923. var _selectInput2 = _interopRequireDefault(_selectInput);
  8924. var _CheckAll = __webpack_require__(10);
  8925. var _CheckAll2 = _interopRequireDefault(_CheckAll);
  8926. var _rangeSlider = __webpack_require__(12);
  8927. var _rangeSlider2 = _interopRequireDefault(_rangeSlider);
  8928. var _dropdown = __webpack_require__(8);
  8929. var _dropdown2 = _interopRequireDefault(_dropdown);
  8930. var _tooltips = __webpack_require__(9);
  8931. var _tooltips2 = _interopRequireDefault(_tooltips);
  8932. __webpack_require__(16);
  8933. var _alert = __webpack_require__(15);
  8934. var _alert2 = _interopRequireDefault(_alert);
  8935. var _contentSlider = __webpack_require__(7);
  8936. var _contentSlider2 = _interopRequireDefault(_contentSlider);
  8937. var _scrollTo = __webpack_require__(21);
  8938. var _scrollTo2 = _interopRequireDefault(_scrollTo);
  8939. var _offCanvas = __webpack_require__(20);
  8940. var _offCanvas2 = _interopRequireDefault(_offCanvas);
  8941. var _inlineEditor = __webpack_require__(14);
  8942. var _inlineEditor2 = _interopRequireDefault(_inlineEditor);
  8943. __webpack_require__(6);
  8944. var _sticky = __webpack_require__(23);
  8945. var _sticky2 = _interopRequireDefault(_sticky);
  8946. var _toggler = __webpack_require__(24);
  8947. var _toggler2 = _interopRequireDefault(_toggler);
  8948. __webpack_require__(22);
  8949. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8950. $ = window.jQuery;
  8951. //navs
  8952. //forms
  8953. //dropdowns
  8954. //modals
  8955. //other
  8956. // *** Init plugin via data atributes ***
  8957. //init (old)
  8958. _selectInput2.default.init();
  8959. _rangeSlider2.default.init();
  8960. window.layers = {
  8961. alert: _alert2.default
  8962. };
  8963. $(document).ready(function () {
  8964. //navs
  8965. // navs.initDataSelectors();
  8966. // navs.initJqueryPlugin();
  8967. _navs2.default.init();
  8968. //Alerts
  8969. // alert.initDataSelectors();
  8970. // alert.initJqueryPlugin();
  8971. _alert2.default.init();
  8972. //Dropdown
  8973. _dropdown2.default.initDataSelectors();
  8974. //Tooltips
  8975. _tooltips2.default.initDataSelectors();
  8976. //Inline Editor
  8977. _inlineEditor2.default.initDataSelectors();
  8978. //Content Slider
  8979. _contentSlider2.default.initDataSelectors();
  8980. //Selects
  8981. _selects2.default.initDataSelectors();
  8982. //Check all
  8983. _CheckAll2.default.initDataSelectors();
  8984. //Sticky
  8985. _sticky2.default.initDataSelectors();
  8986. //Scroll To
  8987. _scrollTo2.default.initDataSelectors();
  8988. //off Canvas
  8989. _offCanvas2.default.initDataSelectors();
  8990. //toggler
  8991. _toggler2.default.initDataSelectors();
  8992. //Switcher
  8993. _switcher2.default.initDataSelectors();
  8994. });
  8995. //*** Add plugins to juqery interface ***
  8996. //Dropdown
  8997. _dropdown2.default.initJqueryPlugin();
  8998. //Tooltips
  8999. _tooltips2.default.initJqueryPlugin();
  9000. //Inline Editor
  9001. _inlineEditor2.default.initJqueryPlugin();
  9002. //Content Slider
  9003. _contentSlider2.default.initJqueryPlugin();
  9004. //Switcher
  9005. _switcher2.default.initJqueryPlugin();
  9006. //Selects
  9007. _selects2.default.initJqueryPlugin();
  9008. //Check all
  9009. _CheckAll2.default.initJqueryPlugin();
  9010. //Sticky
  9011. _sticky2.default.initJqueryPlugin();
  9012. //Scroll To
  9013. _scrollTo2.default.initJqueryPlugin();
  9014. //off Canvas
  9015. _offCanvas2.default.initJqueryPlugin();
  9016. //toggler
  9017. _toggler2.default.initJqueryPlugin();
  9018. /***/ }),
  9019. /* 29 */
  9020. /***/ (function(module, exports, __webpack_require__) {
  9021. "use strict";
  9022. var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;var __WEBPACK_LOCAL_MODULE_1__, __WEBPACK_LOCAL_MODULE_1__factory, __WEBPACK_LOCAL_MODULE_1__module;var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  9023. 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; };
  9024. /**
  9025. * sifter.js
  9026. * Copyright (c) 2013 Brian Reavis & contributors
  9027. *
  9028. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9029. * file except in compliance with the License. You may obtain a copy of the License at:
  9030. * http://www.apache.org/licenses/LICENSE-2.0
  9031. *
  9032. * Unless required by applicable law or agreed to in writing, software distributed under
  9033. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9034. * ANY KIND, either express or implied. See the License for the specific language
  9035. * governing permissions and limitations under the License.
  9036. *
  9037. * @author Brian Reavis <brian@thirdroute.com>
  9038. */
  9039. (function (root, factory) {
  9040. if (true) {
  9041. !(__WEBPACK_LOCAL_MODULE_0__factory = (factory), (__WEBPACK_LOCAL_MODULE_0__module = { id: "sifter", exports: {}, loaded: false }), __WEBPACK_LOCAL_MODULE_0__ = (typeof __WEBPACK_LOCAL_MODULE_0__factory === 'function' ? (__WEBPACK_LOCAL_MODULE_0__factory.call(__WEBPACK_LOCAL_MODULE_0__module.exports, __webpack_require__, __WEBPACK_LOCAL_MODULE_0__module.exports, __WEBPACK_LOCAL_MODULE_0__module)) : __WEBPACK_LOCAL_MODULE_0__factory), (__WEBPACK_LOCAL_MODULE_0__module.loaded = true), __WEBPACK_LOCAL_MODULE_0__ === undefined && (__WEBPACK_LOCAL_MODULE_0__ = __WEBPACK_LOCAL_MODULE_0__module.exports));
  9042. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9043. module.exports = factory();
  9044. } else {
  9045. root.Sifter = factory();
  9046. }
  9047. })(undefined, function () {
  9048. /**
  9049. * Textually searches arrays and hashes of objects
  9050. * by property (or multiple properties). Designed
  9051. * specifically for autocomplete.
  9052. *
  9053. * @constructor
  9054. * @param {array|object} items
  9055. * @param {object} items
  9056. */
  9057. var Sifter = function Sifter(items, settings) {
  9058. this.items = items;
  9059. this.settings = settings || { diacritics: true };
  9060. };
  9061. /**
  9062. * Splits a search string into an array of individual
  9063. * regexps to be used to match results.
  9064. *
  9065. * @param {string} query
  9066. * @returns {array}
  9067. */
  9068. Sifter.prototype.tokenize = function (query) {
  9069. query = trim(String(query || '').toLowerCase());
  9070. if (!query || !query.length) return [];
  9071. var i, n, regex, letter;
  9072. var tokens = [];
  9073. var words = query.split(/ +/);
  9074. for (i = 0, n = words.length; i < n; i++) {
  9075. regex = escape_regex(words[i]);
  9076. if (this.settings.diacritics) {
  9077. for (letter in DIACRITICS) {
  9078. if (DIACRITICS.hasOwnProperty(letter)) {
  9079. regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
  9080. }
  9081. }
  9082. }
  9083. tokens.push({
  9084. string: words[i],
  9085. regex: new RegExp(regex, 'i')
  9086. });
  9087. }
  9088. return tokens;
  9089. };
  9090. /**
  9091. * Iterates over arrays and hashes.
  9092. *
  9093. * ```
  9094. * this.iterator(this.items, function(item, id) {
  9095. * // invoked for each item
  9096. * });
  9097. * ```
  9098. *
  9099. * @param {array|object} object
  9100. */
  9101. Sifter.prototype.iterator = function (object, callback) {
  9102. var iterator;
  9103. if (is_array(object)) {
  9104. iterator = Array.prototype.forEach || function (callback) {
  9105. for (var i = 0, n = this.length; i < n; i++) {
  9106. callback(this[i], i, this);
  9107. }
  9108. };
  9109. } else {
  9110. iterator = function iterator(callback) {
  9111. for (var key in this) {
  9112. if (this.hasOwnProperty(key)) {
  9113. callback(this[key], key, this);
  9114. }
  9115. }
  9116. };
  9117. }
  9118. iterator.apply(object, [callback]);
  9119. };
  9120. /**
  9121. * Returns a function to be used to score individual results.
  9122. *
  9123. * Good matches will have a higher score than poor matches.
  9124. * If an item is not a match, 0 will be returned by the function.
  9125. *
  9126. * @param {object|string} search
  9127. * @param {object} options (optional)
  9128. * @returns {function}
  9129. */
  9130. Sifter.prototype.getScoreFunction = function (search, options) {
  9131. var self, fields, tokens, token_count, nesting;
  9132. self = this;
  9133. search = self.prepareSearch(search, options);
  9134. tokens = search.tokens;
  9135. fields = search.options.fields;
  9136. token_count = tokens.length;
  9137. nesting = search.options.nesting;
  9138. /**
  9139. * Calculates how close of a match the
  9140. * given value is against a search token.
  9141. *
  9142. * @param {mixed} value
  9143. * @param {object} token
  9144. * @return {number}
  9145. */
  9146. var scoreValue = function scoreValue(value, token) {
  9147. var score, pos;
  9148. if (!value) return 0;
  9149. value = String(value || '');
  9150. pos = value.search(token.regex);
  9151. if (pos === -1) return 0;
  9152. score = token.string.length / value.length;
  9153. if (pos === 0) score += 0.5;
  9154. return score;
  9155. };
  9156. /**
  9157. * Calculates the score of an object
  9158. * against the search query.
  9159. *
  9160. * @param {object} token
  9161. * @param {object} data
  9162. * @return {number}
  9163. */
  9164. var scoreObject = function () {
  9165. var field_count = fields.length;
  9166. if (!field_count) {
  9167. return function () {
  9168. return 0;
  9169. };
  9170. }
  9171. if (field_count === 1) {
  9172. return function (token, data) {
  9173. return scoreValue(getattr(data, fields[0], nesting), token);
  9174. };
  9175. }
  9176. return function (token, data) {
  9177. for (var i = 0, sum = 0; i < field_count; i++) {
  9178. sum += scoreValue(getattr(data, fields[i], nesting), token);
  9179. }
  9180. return sum / field_count;
  9181. };
  9182. }();
  9183. if (!token_count) {
  9184. return function () {
  9185. return 0;
  9186. };
  9187. }
  9188. if (token_count === 1) {
  9189. return function (data) {
  9190. return scoreObject(tokens[0], data);
  9191. };
  9192. }
  9193. if (search.options.conjunction === 'and') {
  9194. return function (data) {
  9195. var score;
  9196. for (var i = 0, sum = 0; i < token_count; i++) {
  9197. score = scoreObject(tokens[i], data);
  9198. if (score <= 0) return 0;
  9199. sum += score;
  9200. }
  9201. return sum / token_count;
  9202. };
  9203. } else {
  9204. return function (data) {
  9205. for (var i = 0, sum = 0; i < token_count; i++) {
  9206. sum += scoreObject(tokens[i], data);
  9207. }
  9208. return sum / token_count;
  9209. };
  9210. }
  9211. };
  9212. /**
  9213. * Returns a function that can be used to compare two
  9214. * results, for sorting purposes. If no sorting should
  9215. * be performed, `null` will be returned.
  9216. *
  9217. * @param {string|object} search
  9218. * @param {object} options
  9219. * @return function(a,b)
  9220. */
  9221. Sifter.prototype.getSortFunction = function (search, options) {
  9222. var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
  9223. self = this;
  9224. search = self.prepareSearch(search, options);
  9225. sort = !search.query && options.sort_empty || options.sort;
  9226. /**
  9227. * Fetches the specified sort field value
  9228. * from a search result item.
  9229. *
  9230. * @param {string} name
  9231. * @param {object} result
  9232. * @return {mixed}
  9233. */
  9234. get_field = function get_field(name, result) {
  9235. if (name === '$score') return result.score;
  9236. return getattr(self.items[result.id], name, options.nesting);
  9237. };
  9238. // parse options
  9239. fields = [];
  9240. if (sort) {
  9241. for (i = 0, n = sort.length; i < n; i++) {
  9242. if (search.query || sort[i].field !== '$score') {
  9243. fields.push(sort[i]);
  9244. }
  9245. }
  9246. }
  9247. // the "$score" field is implied to be the primary
  9248. // sort field, unless it's manually specified
  9249. if (search.query) {
  9250. implicit_score = true;
  9251. for (i = 0, n = fields.length; i < n; i++) {
  9252. if (fields[i].field === '$score') {
  9253. implicit_score = false;
  9254. break;
  9255. }
  9256. }
  9257. if (implicit_score) {
  9258. fields.unshift({ field: '$score', direction: 'desc' });
  9259. }
  9260. } else {
  9261. for (i = 0, n = fields.length; i < n; i++) {
  9262. if (fields[i].field === '$score') {
  9263. fields.splice(i, 1);
  9264. break;
  9265. }
  9266. }
  9267. }
  9268. multipliers = [];
  9269. for (i = 0, n = fields.length; i < n; i++) {
  9270. multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
  9271. }
  9272. // build function
  9273. fields_count = fields.length;
  9274. if (!fields_count) {
  9275. return null;
  9276. } else if (fields_count === 1) {
  9277. field = fields[0].field;
  9278. multiplier = multipliers[0];
  9279. return function (a, b) {
  9280. return multiplier * cmp(get_field(field, a), get_field(field, b));
  9281. };
  9282. } else {
  9283. return function (a, b) {
  9284. var i, result, a_value, b_value, field;
  9285. for (i = 0; i < fields_count; i++) {
  9286. field = fields[i].field;
  9287. result = multipliers[i] * cmp(get_field(field, a), get_field(field, b));
  9288. if (result) return result;
  9289. }
  9290. return 0;
  9291. };
  9292. }
  9293. };
  9294. /**
  9295. * Parses a search query and returns an object
  9296. * with tokens and fields ready to be populated
  9297. * with results.
  9298. *
  9299. * @param {string} query
  9300. * @param {object} options
  9301. * @returns {object}
  9302. */
  9303. Sifter.prototype.prepareSearch = function (query, options) {
  9304. if ((typeof query === 'undefined' ? 'undefined' : _typeof(query)) === 'object') return query;
  9305. options = extend({}, options);
  9306. var option_fields = options.fields;
  9307. var option_sort = options.sort;
  9308. var option_sort_empty = options.sort_empty;
  9309. if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
  9310. if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
  9311. if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
  9312. return {
  9313. options: options,
  9314. query: String(query || '').toLowerCase(),
  9315. tokens: this.tokenize(query),
  9316. total: 0,
  9317. items: []
  9318. };
  9319. };
  9320. /**
  9321. * Searches through all items and returns a sorted array of matches.
  9322. *
  9323. * The `options` parameter can contain:
  9324. *
  9325. * - fields {string|array}
  9326. * - sort {array}
  9327. * - score {function}
  9328. * - filter {bool}
  9329. * - limit {integer}
  9330. *
  9331. * Returns an object containing:
  9332. *
  9333. * - options {object}
  9334. * - query {string}
  9335. * - tokens {array}
  9336. * - total {int}
  9337. * - items {array}
  9338. *
  9339. * @param {string} query
  9340. * @param {object} options
  9341. * @returns {object}
  9342. */
  9343. Sifter.prototype.search = function (query, options) {
  9344. var self = this,
  9345. value,
  9346. score,
  9347. search,
  9348. calculateScore;
  9349. var fn_sort;
  9350. var fn_score;
  9351. search = this.prepareSearch(query, options);
  9352. options = search.options;
  9353. query = search.query;
  9354. // generate result scoring function
  9355. fn_score = options.score || self.getScoreFunction(search);
  9356. // perform search and sort
  9357. if (query.length) {
  9358. self.iterator(self.items, function (item, id) {
  9359. score = fn_score(item);
  9360. if (options.filter === false || score > 0) {
  9361. search.items.push({ 'score': score, 'id': id });
  9362. }
  9363. });
  9364. } else {
  9365. self.iterator(self.items, function (item, id) {
  9366. search.items.push({ 'score': 1, 'id': id });
  9367. });
  9368. }
  9369. fn_sort = self.getSortFunction(search, options);
  9370. if (fn_sort) search.items.sort(fn_sort);
  9371. // apply limits
  9372. search.total = search.items.length;
  9373. if (typeof options.limit === 'number') {
  9374. search.items = search.items.slice(0, options.limit);
  9375. }
  9376. return search;
  9377. };
  9378. // utilities
  9379. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9380. var cmp = function cmp(a, b) {
  9381. if (typeof a === 'number' && typeof b === 'number') {
  9382. return a > b ? 1 : a < b ? -1 : 0;
  9383. }
  9384. a = asciifold(String(a || ''));
  9385. b = asciifold(String(b || ''));
  9386. if (a > b) return 1;
  9387. if (b > a) return -1;
  9388. return 0;
  9389. };
  9390. var extend = function extend(a, b) {
  9391. var i, n, k, object;
  9392. for (i = 1, n = arguments.length; i < n; i++) {
  9393. object = arguments[i];
  9394. if (!object) continue;
  9395. for (k in object) {
  9396. if (object.hasOwnProperty(k)) {
  9397. a[k] = object[k];
  9398. }
  9399. }
  9400. }
  9401. return a;
  9402. };
  9403. /**
  9404. * A property getter resolving dot-notation
  9405. * @param {Object} obj The root object to fetch property on
  9406. * @param {String} name The optionally dotted property name to fetch
  9407. * @param {Boolean} nesting Handle nesting or not
  9408. * @return {Object} The resolved property value
  9409. */
  9410. var getattr = function getattr(obj, name, nesting) {
  9411. if (!obj || !name) return;
  9412. if (!nesting) return obj[name];
  9413. var names = name.split(".");
  9414. while (names.length && (obj = obj[names.shift()])) {}
  9415. return obj;
  9416. };
  9417. var trim = function trim(str) {
  9418. return (str + '').replace(/^\s+|\s+$|/g, '');
  9419. };
  9420. var escape_regex = function escape_regex(str) {
  9421. return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
  9422. };
  9423. var is_array = Array.isArray || typeof $ !== 'undefined' && $.isArray || function (object) {
  9424. return Object.prototype.toString.call(object) === '[object Array]';
  9425. };
  9426. var DIACRITICS = {
  9427. 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
  9428. 'b': '[b␢βΒB฿𐌁ᛒ]',
  9429. 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
  9430. 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
  9431. 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
  9432. 'f': '[fƑƒḞḟ]',
  9433. 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
  9434. 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
  9435. 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
  9436. 'j': '[jȷĴĵɈɉʝɟʲ]',
  9437. 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
  9438. 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
  9439. 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
  9440. 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
  9441. 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
  9442. 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
  9443. 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
  9444. 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
  9445. 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
  9446. 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
  9447. 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
  9448. 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
  9449. 'x': '[xẌẍẊẋχ]',
  9450. 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
  9451. 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
  9452. };
  9453. var asciifold = function () {
  9454. var i, n, k, chunk;
  9455. var foreignletters = '';
  9456. var lookup = {};
  9457. for (k in DIACRITICS) {
  9458. if (DIACRITICS.hasOwnProperty(k)) {
  9459. chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
  9460. foreignletters += chunk;
  9461. for (i = 0, n = chunk.length; i < n; i++) {
  9462. lookup[chunk.charAt(i)] = k;
  9463. }
  9464. }
  9465. }
  9466. var regexp = new RegExp('[' + foreignletters + ']', 'g');
  9467. return function (str) {
  9468. return str.replace(regexp, function (foreignletter) {
  9469. return lookup[foreignletter];
  9470. }).toLowerCase();
  9471. };
  9472. }();
  9473. // export
  9474. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9475. return Sifter;
  9476. });
  9477. /**
  9478. * microplugin.js
  9479. * Copyright (c) 2013 Brian Reavis & contributors
  9480. *
  9481. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9482. * file except in compliance with the License. You may obtain a copy of the License at:
  9483. * http://www.apache.org/licenses/LICENSE-2.0
  9484. *
  9485. * Unless required by applicable law or agreed to in writing, software distributed under
  9486. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9487. * ANY KIND, either express or implied. See the License for the specific language
  9488. * governing permissions and limitations under the License.
  9489. *
  9490. * @author Brian Reavis <brian@thirdroute.com>
  9491. */
  9492. (function (root, factory) {
  9493. if (true) {
  9494. !(__WEBPACK_LOCAL_MODULE_1__factory = (factory), (__WEBPACK_LOCAL_MODULE_1__module = { id: "microplugin", exports: {}, loaded: false }), __WEBPACK_LOCAL_MODULE_1__ = (typeof __WEBPACK_LOCAL_MODULE_1__factory === 'function' ? (__WEBPACK_LOCAL_MODULE_1__factory.call(__WEBPACK_LOCAL_MODULE_1__module.exports, __webpack_require__, __WEBPACK_LOCAL_MODULE_1__module.exports, __WEBPACK_LOCAL_MODULE_1__module)) : __WEBPACK_LOCAL_MODULE_1__factory), (__WEBPACK_LOCAL_MODULE_1__module.loaded = true), __WEBPACK_LOCAL_MODULE_1__ === undefined && (__WEBPACK_LOCAL_MODULE_1__ = __WEBPACK_LOCAL_MODULE_1__module.exports));
  9495. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9496. module.exports = factory();
  9497. } else {
  9498. root.MicroPlugin = factory();
  9499. }
  9500. })(undefined, function () {
  9501. var MicroPlugin = {};
  9502. MicroPlugin.mixin = function (Interface) {
  9503. Interface.plugins = {};
  9504. /**
  9505. * Initializes the listed plugins (with options).
  9506. * Acceptable formats:
  9507. *
  9508. * List (without options):
  9509. * ['a', 'b', 'c']
  9510. *
  9511. * List (with options):
  9512. * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
  9513. *
  9514. * Hash (with options):
  9515. * {'a': { ... }, 'b': { ... }, 'c': { ... }}
  9516. *
  9517. * @param {mixed} plugins
  9518. */
  9519. Interface.prototype.initializePlugins = function (plugins) {
  9520. var i, n, key;
  9521. var self = this;
  9522. var queue = [];
  9523. self.plugins = {
  9524. names: [],
  9525. settings: {},
  9526. requested: {},
  9527. loaded: {}
  9528. };
  9529. if (utils.isArray(plugins)) {
  9530. for (i = 0, n = plugins.length; i < n; i++) {
  9531. if (typeof plugins[i] === 'string') {
  9532. queue.push(plugins[i]);
  9533. } else {
  9534. self.plugins.settings[plugins[i].name] = plugins[i].options;
  9535. queue.push(plugins[i].name);
  9536. }
  9537. }
  9538. } else if (plugins) {
  9539. for (key in plugins) {
  9540. if (plugins.hasOwnProperty(key)) {
  9541. self.plugins.settings[key] = plugins[key];
  9542. queue.push(key);
  9543. }
  9544. }
  9545. }
  9546. while (queue.length) {
  9547. self.require(queue.shift());
  9548. }
  9549. };
  9550. Interface.prototype.loadPlugin = function (name) {
  9551. var self = this;
  9552. var plugins = self.plugins;
  9553. var plugin = Interface.plugins[name];
  9554. if (!Interface.plugins.hasOwnProperty(name)) {
  9555. //throw new Error('Unable to find "' + name + '" plugin');
  9556. }
  9557. else{
  9558. plugins.requested[name] = true;
  9559. plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
  9560. plugins.names.push(name);
  9561. }
  9562. };
  9563. /**
  9564. * Initializes a plugin.
  9565. *
  9566. * @param {string} name
  9567. */
  9568. Interface.prototype.require = function (name) {
  9569. var self = this;
  9570. var plugins = self.plugins;
  9571. if (!self.plugins.loaded.hasOwnProperty(name)) {
  9572. if (plugins.requested[name]) {
  9573. throw new Error('Plugin has circular dependency ("' + name + '")');
  9574. }
  9575. self.loadPlugin(name);
  9576. }
  9577. return plugins.loaded[name];
  9578. };
  9579. /**
  9580. * Registers a plugin.
  9581. *
  9582. * @param {string} name
  9583. * @param {function} fn
  9584. */
  9585. Interface.define = function (name, fn) {
  9586. Interface.plugins[name] = {
  9587. 'name': name,
  9588. 'fn': fn
  9589. };
  9590. };
  9591. };
  9592. var utils = {
  9593. isArray: Array.isArray || function (vArg) {
  9594. return Object.prototype.toString.call(vArg) === '[object Array]';
  9595. }
  9596. };
  9597. return MicroPlugin;
  9598. });
  9599. /**
  9600. * selectize.js (v0.12.4)
  9601. * Copyright (c) 2013–2015 Brian Reavis & contributors
  9602. *
  9603. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9604. * file except in compliance with the License. You may obtain a copy of the License at:
  9605. * http://www.apache.org/licenses/LICENSE-2.0
  9606. *
  9607. * Unless required by applicable law or agreed to in writing, software distributed under
  9608. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9609. * ANY KIND, either express or implied. See the License for the specific language
  9610. * governing permissions and limitations under the License.
  9611. *
  9612. * @author Brian Reavis <brian@thirdroute.com>
  9613. */
  9614. /*jshint curly:false */
  9615. /*jshint browser:true */
  9616. (function (root, factory) {
  9617. if (true) {
  9618. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  9619. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  9620. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  9621. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9622. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9623. module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
  9624. } else {
  9625. root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
  9626. }
  9627. })(undefined, function ($, Sifter, MicroPlugin) {
  9628. 'use strict';
  9629. var highlight = function highlight($element, pattern) {
  9630. if (typeof pattern === 'string' && !pattern.length) return;
  9631. var regex = typeof pattern === 'string' ? new RegExp(pattern, 'i') : pattern;
  9632. var highlight = function highlight(node) {
  9633. var skip = 0;
  9634. if (node.nodeType === 3) {
  9635. var pos = node.data.search(regex);
  9636. if (pos >= 0 && node.data.length > 0) {
  9637. var match = node.data.match(regex);
  9638. var spannode = document.createElement('span');
  9639. spannode.className = 'highlight';
  9640. var middlebit = node.splitText(pos);
  9641. var endbit = middlebit.splitText(match[0].length);
  9642. var middleclone = middlebit.cloneNode(true);
  9643. spannode.appendChild(middleclone);
  9644. middlebit.parentNode.replaceChild(spannode, middlebit);
  9645. skip = 1;
  9646. }
  9647. } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  9648. for (var i = 0; i < node.childNodes.length; ++i) {
  9649. i += highlight(node.childNodes[i]);
  9650. }
  9651. }
  9652. return skip;
  9653. };
  9654. return $element.each(function () {
  9655. highlight(this);
  9656. });
  9657. };
  9658. /**
  9659. * removeHighlight fn copied from highlight v5 and
  9660. * edited to remove with() and pass js strict mode
  9661. */
  9662. $.fn.removeHighlight = function () {
  9663. return this.find("span.highlight").each(function () {
  9664. this.parentNode.firstChild.nodeName;
  9665. var parent = this.parentNode;
  9666. parent.replaceChild(this.firstChild, this);
  9667. parent.normalize();
  9668. }).end();
  9669. };
  9670. var MicroEvent = function MicroEvent() {};
  9671. MicroEvent.prototype = {
  9672. on: function on(event, fct) {
  9673. this._events = this._events || {};
  9674. this._events[event] = this._events[event] || [];
  9675. this._events[event].push(fct);
  9676. },
  9677. off: function off(event, fct) {
  9678. var n = arguments.length;
  9679. if (n === 0) return delete this._events;
  9680. if (n === 1) return delete this._events[event];
  9681. this._events = this._events || {};
  9682. if (event in this._events === false) return;
  9683. this._events[event].splice(this._events[event].indexOf(fct), 1);
  9684. },
  9685. trigger: function trigger(event /* , args... */) {
  9686. this._events = this._events || {};
  9687. if (event in this._events === false) return;
  9688. for (var i = 0; i < this._events[event].length; i++) {
  9689. this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
  9690. }
  9691. }
  9692. };
  9693. /**
  9694. * Mixin will delegate all MicroEvent.js function in the destination object.
  9695. *
  9696. * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
  9697. *
  9698. * @param {object} the object which will support MicroEvent
  9699. */
  9700. MicroEvent.mixin = function (destObject) {
  9701. var props = ['on', 'off', 'trigger'];
  9702. for (var i = 0; i < props.length; i++) {
  9703. destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
  9704. }
  9705. };
  9706. var IS_MAC = /Mac/.test(navigator.userAgent);
  9707. var KEY_A = 65;
  9708. var KEY_COMMA = 188;
  9709. var KEY_RETURN = 13;
  9710. var KEY_ESC = 27;
  9711. var KEY_LEFT = 37;
  9712. var KEY_UP = 38;
  9713. var KEY_P = 80;
  9714. var KEY_RIGHT = 39;
  9715. var KEY_DOWN = 40;
  9716. var KEY_N = 78;
  9717. var KEY_BACKSPACE = 8;
  9718. var KEY_DELETE = 46;
  9719. var KEY_SHIFT = 16;
  9720. var KEY_CMD = IS_MAC ? 91 : 17;
  9721. var KEY_CTRL = IS_MAC ? 18 : 17;
  9722. var KEY_TAB = 9;
  9723. var TAG_SELECT = 1;
  9724. var TAG_INPUT = 2;
  9725. // for now, android support in general is too spotty to support validity
  9726. var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
  9727. var isset = function isset(object) {
  9728. return typeof object !== 'undefined';
  9729. };
  9730. /**
  9731. * Converts a scalar to its best string representation
  9732. * for hash keys and HTML attribute values.
  9733. *
  9734. * Transformations:
  9735. * 'str' -> 'str'
  9736. * null -> ''
  9737. * undefined -> ''
  9738. * true -> '1'
  9739. * false -> '0'
  9740. * 0 -> '0'
  9741. * 1 -> '1'
  9742. *
  9743. * @param {string} value
  9744. * @returns {string|null}
  9745. */
  9746. var hash_key = function hash_key(value) {
  9747. if (typeof value === 'undefined' || value === null) return null;
  9748. if (typeof value === 'boolean') return value ? '1' : '0';
  9749. return value + '';
  9750. };
  9751. /**
  9752. * Escapes a string for use within HTML.
  9753. *
  9754. * @param {string} str
  9755. * @returns {string}
  9756. */
  9757. var escape_html = function escape_html(str) {
  9758. return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  9759. };
  9760. /**
  9761. * Escapes "$" characters in replacement strings.
  9762. *
  9763. * @param {string} str
  9764. * @returns {string}
  9765. */
  9766. var escape_replace = function escape_replace(str) {
  9767. return (str + '').replace(/\$/g, '$$$$');
  9768. };
  9769. var hook = {};
  9770. /**
  9771. * Wraps `method` on `self` so that `fn`
  9772. * is invoked before the original method.
  9773. *
  9774. * @param {object} self
  9775. * @param {string} method
  9776. * @param {function} fn
  9777. */
  9778. hook.before = function (self, method, fn) {
  9779. var original = self[method];
  9780. self[method] = function () {
  9781. fn.apply(self, arguments);
  9782. return original.apply(self, arguments);
  9783. };
  9784. };
  9785. /**
  9786. * Wraps `method` on `self` so that `fn`
  9787. * is invoked after the original method.
  9788. *
  9789. * @param {object} self
  9790. * @param {string} method
  9791. * @param {function} fn
  9792. */
  9793. hook.after = function (self, method, fn) {
  9794. var original = self[method];
  9795. self[method] = function () {
  9796. var result = original.apply(self, arguments);
  9797. fn.apply(self, arguments);
  9798. return result;
  9799. };
  9800. };
  9801. /**
  9802. * Wraps `fn` so that it can only be invoked once.
  9803. *
  9804. * @param {function} fn
  9805. * @returns {function}
  9806. */
  9807. var once = function once(fn) {
  9808. var called = false;
  9809. return function () {
  9810. if (called) return;
  9811. called = true;
  9812. fn.apply(this, arguments);
  9813. };
  9814. };
  9815. /**
  9816. * Wraps `fn` so that it can only be called once
  9817. * every `delay` milliseconds (invoked on the falling edge).
  9818. *
  9819. * @param {function} fn
  9820. * @param {int} delay
  9821. * @returns {function}
  9822. */
  9823. var debounce = function debounce(fn, delay) {
  9824. var timeout;
  9825. return function () {
  9826. var self = this;
  9827. var args = arguments;
  9828. window.clearTimeout(timeout);
  9829. timeout = window.setTimeout(function () {
  9830. fn.apply(self, args);
  9831. }, delay);
  9832. };
  9833. };
  9834. /**
  9835. * Debounce all fired events types listed in `types`
  9836. * while executing the provided `fn`.
  9837. *
  9838. * @param {object} self
  9839. * @param {array} types
  9840. * @param {function} fn
  9841. */
  9842. var debounce_events = function debounce_events(self, types, fn) {
  9843. var type;
  9844. var trigger = self.trigger;
  9845. var event_args = {};
  9846. // override trigger method
  9847. self.trigger = function () {
  9848. var type = arguments[0];
  9849. if (types.indexOf(type) !== -1) {
  9850. event_args[type] = arguments;
  9851. } else {
  9852. return trigger.apply(self, arguments);
  9853. }
  9854. };
  9855. // invoke provided function
  9856. fn.apply(self, []);
  9857. self.trigger = trigger;
  9858. // trigger queued events
  9859. for (type in event_args) {
  9860. if (event_args.hasOwnProperty(type)) {
  9861. trigger.apply(self, event_args[type]);
  9862. }
  9863. }
  9864. };
  9865. /**
  9866. * A workaround for http://bugs.jquery.com/ticket/6696
  9867. *
  9868. * @param {object} $parent - Parent element to listen on.
  9869. * @param {string} event - Event name.
  9870. * @param {string} selector - Descendant selector to filter by.
  9871. * @param {function} fn - Event handler.
  9872. */
  9873. var watchChildEvent = function watchChildEvent($parent, event, selector, fn) {
  9874. $parent.on(event, selector, function (e) {
  9875. var child = e.target;
  9876. while (child && child.parentNode !== $parent[0]) {
  9877. child = child.parentNode;
  9878. }
  9879. e.currentTarget = child;
  9880. return fn.apply(this, [e]);
  9881. });
  9882. };
  9883. /**
  9884. * Determines the current selection within a text input control.
  9885. * Returns an object containing:
  9886. * - start
  9887. * - length
  9888. *
  9889. * @param {object} input
  9890. * @returns {object}
  9891. */
  9892. var getSelection = function getSelection(input) {
  9893. var result = {};
  9894. if ('selectionStart' in input) {
  9895. result.start = input.selectionStart;
  9896. result.length = input.selectionEnd - result.start;
  9897. } else if (document.selection) {
  9898. input.focus();
  9899. var sel = document.selection.createRange();
  9900. var selLen = document.selection.createRange().text.length;
  9901. sel.moveStart('character', -input.value.length);
  9902. result.start = sel.text.length - selLen;
  9903. result.length = selLen;
  9904. }
  9905. return result;
  9906. };
  9907. /**
  9908. * Copies CSS properties from one element to another.
  9909. *
  9910. * @param {object} $from
  9911. * @param {object} $to
  9912. * @param {array} properties
  9913. */
  9914. var transferStyles = function transferStyles($from, $to, properties) {
  9915. var i,
  9916. n,
  9917. styles = {};
  9918. if (properties) {
  9919. for (i = 0, n = properties.length; i < n; i++) {
  9920. styles[properties[i]] = $from.css(properties[i]);
  9921. }
  9922. } else {
  9923. styles = $from.css();
  9924. }
  9925. $to.css(styles);
  9926. };
  9927. /**
  9928. * Measures the width of a string within a
  9929. * parent element (in pixels).
  9930. *
  9931. * @param {string} str
  9932. * @param {object} $parent
  9933. * @returns {int}
  9934. */
  9935. var measureString = function measureString(str, $parent) {
  9936. if (!str) {
  9937. return 0;
  9938. }
  9939. var $test = $('<test>').css({
  9940. position: 'absolute',
  9941. top: -99999,
  9942. left: -99999,
  9943. width: 'auto',
  9944. padding: 0,
  9945. whiteSpace: 'pre'
  9946. }).text(str).appendTo('body');
  9947. transferStyles($parent, $test, ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']);
  9948. var width = $test.width();
  9949. $test.remove();
  9950. return width;
  9951. };
  9952. /**
  9953. * Sets up an input to grow horizontally as the user
  9954. * types. If the value is changed manually, you can
  9955. * trigger the "update" handler to resize:
  9956. *
  9957. * $input.trigger('update');
  9958. *
  9959. * @param {object} $input
  9960. */
  9961. var autoGrow = function autoGrow($input) {
  9962. var currentWidth = null;
  9963. var update = function update(e, options) {
  9964. var value, keyCode, printable, placeholder, width;
  9965. var shift, character, selection;
  9966. e = e || window.event || {};
  9967. options = options || {};
  9968. if (e.metaKey || e.altKey) return;
  9969. if (!options.force && $input.data('grow') === false) return;
  9970. value = $input.val();
  9971. if (e.type && e.type.toLowerCase() === 'keydown') {
  9972. keyCode = e.keyCode;
  9973. printable = keyCode >= 97 && keyCode <= 122 || // a-z
  9974. keyCode >= 65 && keyCode <= 90 || // A-Z
  9975. keyCode >= 48 && keyCode <= 57 || // 0-9
  9976. keyCode === 32 // space
  9977. ;
  9978. if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
  9979. selection = getSelection($input[0]);
  9980. if (selection.length) {
  9981. value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
  9982. } else if (keyCode === KEY_BACKSPACE && selection.start) {
  9983. value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
  9984. } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
  9985. value = value.substring(0, selection.start) + value.substring(selection.start + 1);
  9986. }
  9987. } else if (printable) {
  9988. shift = e.shiftKey;
  9989. character = String.fromCharCode(e.keyCode);
  9990. if (shift) character = character.toUpperCase();else character = character.toLowerCase();
  9991. value += character;
  9992. }
  9993. }
  9994. placeholder = $input.attr('placeholder');
  9995. if (!value && placeholder) {
  9996. value = placeholder;
  9997. }
  9998. width = measureString(value, $input) + 4;
  9999. if (width !== currentWidth) {
  10000. currentWidth = width;
  10001. $input.width(width);
  10002. $input.triggerHandler('resize');
  10003. }
  10004. };
  10005. $input.on('keydown keyup update blur', update);
  10006. update();
  10007. };
  10008. var domToString = function domToString(d) {
  10009. var tmp = document.createElement('div');
  10010. tmp.appendChild(d.cloneNode(true));
  10011. return tmp.innerHTML;
  10012. };
  10013. var logError = function logError(message, options) {
  10014. if (!options) options = {};
  10015. var component = "Selectize";
  10016. console.error(component + ": " + message);
  10017. if (options.explanation) {
  10018. // console.group is undefined in <IE11
  10019. if (console.group) console.group();
  10020. console.error(options.explanation);
  10021. if (console.group) console.groupEnd();
  10022. }
  10023. };
  10024. var Selectize = function Selectize($input, settings) {
  10025. var key,
  10026. i,
  10027. n,
  10028. dir,
  10029. input,
  10030. self = this;
  10031. input = $input[0];
  10032. input.selectize = self;
  10033. // detect rtl environment
  10034. var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
  10035. dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
  10036. dir = dir || $input.parents('[dir]:first').attr('dir') || '';
  10037. // setup default state
  10038. $.extend(self, {
  10039. order: 0,
  10040. settings: settings,
  10041. $input: $input,
  10042. tabIndex: $input.attr('tabindex') || '',
  10043. tagType: input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
  10044. rtl: /rtl/i.test(dir),
  10045. eventNS: '.selectize' + ++Selectize.count,
  10046. highlightedValue: null,
  10047. isOpen: false,
  10048. isDisabled: false,
  10049. isRequired: $input.is('[required]'),
  10050. isInvalid: false,
  10051. isLocked: false,
  10052. isFocused: false,
  10053. isInputHidden: false,
  10054. isSetup: false,
  10055. isShiftDown: false,
  10056. isCmdDown: false,
  10057. isCtrlDown: false,
  10058. ignoreFocus: false,
  10059. ignoreBlur: false,
  10060. ignoreHover: false,
  10061. hasOptions: false,
  10062. currentResults: null,
  10063. lastValue: '',
  10064. caretPos: 0,
  10065. loading: 0,
  10066. loadedSearches: {},
  10067. $activeOption: null,
  10068. $activeItems: [],
  10069. optgroups: {},
  10070. options: {},
  10071. userOptions: {},
  10072. items: [],
  10073. renderCache: {},
  10074. onSearchChange: settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
  10075. });
  10076. // search system
  10077. self.sifter = new Sifter(this.options, { diacritics: settings.diacritics });
  10078. // build options table
  10079. if (self.settings.options) {
  10080. for (i = 0, n = self.settings.options.length; i < n; i++) {
  10081. self.registerOption(self.settings.options[i]);
  10082. }
  10083. delete self.settings.options;
  10084. }
  10085. // build optgroup table
  10086. if (self.settings.optgroups) {
  10087. for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
  10088. self.registerOptionGroup(self.settings.optgroups[i]);
  10089. }
  10090. delete self.settings.optgroups;
  10091. }
  10092. // option-dependent defaults
  10093. self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
  10094. if (typeof self.settings.hideSelected !== 'boolean') {
  10095. self.settings.hideSelected = self.settings.mode === 'multi';
  10096. }
  10097. self.initializePlugins(self.settings.plugins);
  10098. self.setupCallbacks();
  10099. self.setupTemplates();
  10100. self.setup();
  10101. };
  10102. // mixins
  10103. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10104. MicroEvent.mixin(Selectize);
  10105. if (typeof MicroPlugin !== "undefined") {
  10106. MicroPlugin.mixin(Selectize);
  10107. } else {
  10108. logError("Dependency MicroPlugin is missing", { explanation: "Make sure you either: (1) are using the \"standalone\" " + "version of Selectize, or (2) require MicroPlugin before you " + "load Selectize." });
  10109. }
  10110. // methods
  10111. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10112. $.extend(Selectize.prototype, {
  10113. /**
  10114. * Creates all elements and sets up event bindings.
  10115. */
  10116. setup: function setup() {
  10117. var self = this;
  10118. var settings = self.settings;
  10119. var eventNS = self.eventNS;
  10120. var $window = $(window);
  10121. var $document = $(document);
  10122. var $input = self.$input;
  10123. var $wrapper;
  10124. var $control;
  10125. var $control_input;
  10126. var $dropdown;
  10127. var $dropdown_content;
  10128. var $dropdown_parent;
  10129. var inputMode;
  10130. var timeout_blur;
  10131. var timeout_focus;
  10132. var classes;
  10133. var classes_plugins;
  10134. var inputId;
  10135. inputMode = self.settings.mode;
  10136. classes = $input.attr('class') || '';
  10137. $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(inputMode);
  10138. $control = $('<div>').addClass(settings.inputClass + ' ' + classes).addClass('items').appendTo($wrapper);
  10139. $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
  10140. $dropdown_parent = $(settings.dropdownParent || $wrapper);
  10141. $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
  10142. $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
  10143. if (inputId = $input.attr('id')) {
  10144. $control_input.attr('id', inputId + '-selectized');
  10145. $("label[for='" + inputId + "']").attr('for', inputId + '-selectized');
  10146. }
  10147. if (self.settings.copyClassesToDropdown) {
  10148. $dropdown.addClass(classes);
  10149. }
  10150. $wrapper.css({
  10151. width: $input[0].style.width
  10152. });
  10153. if (self.plugins.names.length) {
  10154. classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
  10155. $wrapper.addClass(classes_plugins);
  10156. $dropdown.addClass(classes_plugins);
  10157. }
  10158. if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
  10159. $input.attr('multiple', 'multiple');
  10160. }
  10161. if (self.settings.placeholder) {
  10162. $control_input.attr('placeholder', settings.placeholder);
  10163. }
  10164. // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
  10165. if (!self.settings.splitOn && self.settings.delimiter) {
  10166. var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  10167. self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
  10168. }
  10169. if ($input.attr('autocorrect')) {
  10170. $control_input.attr('autocorrect', $input.attr('autocorrect'));
  10171. }
  10172. if ($input.attr('autocapitalize')) {
  10173. $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
  10174. }
  10175. self.$wrapper = $wrapper;
  10176. self.$control = $control;
  10177. self.$control_input = $control_input;
  10178. self.$dropdown = $dropdown;
  10179. self.$dropdown_content = $dropdown_content;
  10180. $dropdown.on('mouseenter', '[data-selectable]', function () {
  10181. return self.onOptionHover.apply(self, arguments);
  10182. });
  10183. $dropdown.on('mousedown click', '[data-selectable]', function () {
  10184. return self.onOptionSelect.apply(self, arguments);
  10185. });
  10186. watchChildEvent($control, 'mousedown', '*:not(input)', function () {
  10187. return self.onItemSelect.apply(self, arguments);
  10188. });
  10189. autoGrow($control_input);
  10190. $control.on({
  10191. mousedown: function mousedown() {
  10192. return self.onMouseDown.apply(self, arguments);
  10193. },
  10194. click: function click() {
  10195. return self.onClick.apply(self, arguments);
  10196. }
  10197. });
  10198. $control_input.on({
  10199. mousedown: function mousedown(e) {
  10200. e.stopPropagation();
  10201. },
  10202. keydown: function keydown() {
  10203. return self.onKeyDown.apply(self, arguments);
  10204. },
  10205. keyup: function keyup() {
  10206. return self.onKeyUp.apply(self, arguments);
  10207. },
  10208. keypress: function keypress() {
  10209. return self.onKeyPress.apply(self, arguments);
  10210. },
  10211. resize: function resize() {
  10212. self.positionDropdown.apply(self, []);
  10213. },
  10214. blur: function blur() {
  10215. return self.onBlur.apply(self, arguments);
  10216. },
  10217. focus: function focus() {
  10218. self.ignoreBlur = false;return self.onFocus.apply(self, arguments);
  10219. },
  10220. paste: function paste() {
  10221. return self.onPaste.apply(self, arguments);
  10222. }
  10223. });
  10224. $document.on('keydown' + eventNS, function (e) {
  10225. self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
  10226. self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
  10227. self.isShiftDown = e.shiftKey;
  10228. });
  10229. $document.on('keyup' + eventNS, function (e) {
  10230. if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
  10231. if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
  10232. if (e.keyCode === KEY_CMD) self.isCmdDown = false;
  10233. });
  10234. $document.on('mousedown' + eventNS, function (e) {
  10235. if (self.isFocused) {
  10236. // prevent events on the dropdown scrollbar from causing the control to blur
  10237. if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
  10238. return false;
  10239. }
  10240. // blur on click outside
  10241. if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
  10242. self.blur(e.target);
  10243. }
  10244. }
  10245. });
  10246. $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function () {
  10247. if (self.isOpen) {
  10248. self.positionDropdown.apply(self, arguments);
  10249. }
  10250. });
  10251. $window.on('mousemove' + eventNS, function () {
  10252. self.ignoreHover = false;
  10253. });
  10254. // store original children and tab index so that they can be
  10255. // restored when the destroy() method is called.
  10256. this.revertSettings = {
  10257. $children: $input.children().detach(),
  10258. tabindex: $input.attr('tabindex')
  10259. };
  10260. $input.attr('tabindex', -1).hide().after(self.$wrapper);
  10261. if ($.isArray(settings.items)) {
  10262. self.setValue(settings.items);
  10263. delete settings.items;
  10264. }
  10265. // feature detect for the validation API
  10266. if (SUPPORTS_VALIDITY_API) {
  10267. $input.on('invalid' + eventNS, function (e) {
  10268. e.preventDefault();
  10269. self.isInvalid = true;
  10270. self.refreshState();
  10271. });
  10272. }
  10273. self.updateOriginalInput();
  10274. self.refreshItems();
  10275. self.refreshState();
  10276. self.updatePlaceholder();
  10277. self.isSetup = true;
  10278. if ($input.is(':disabled')) {
  10279. self.disable();
  10280. }
  10281. self.on('change', this.onChange);
  10282. $input.data('selectize', self);
  10283. $input.addClass('selectized');
  10284. self.trigger('initialize');
  10285. // preload options
  10286. if (settings.preload === true) {
  10287. self.onSearchChange('');
  10288. }
  10289. },
  10290. /**
  10291. * Sets up default rendering functions.
  10292. */
  10293. setupTemplates: function setupTemplates() {
  10294. var self = this;
  10295. var field_label = self.settings.labelField;
  10296. var field_optgroup = self.settings.optgroupLabelField;
  10297. var templates = {
  10298. 'optgroup': function optgroup(data) {
  10299. return '<div class="optgroup">' + data.html + '</div>';
  10300. },
  10301. 'optgroup_header': function optgroup_header(data, escape) {
  10302. return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
  10303. },
  10304. 'option': function option(data, escape) {
  10305. if(data.description)
  10306. {
  10307. return '<div class="option">'
  10308. + '<div class="title">'+escape(data[field_label])+'</div>'
  10309. + '<div class="desc">'
  10310. + escape(data['description'])
  10311. + '</div>'
  10312. + '</div>';
  10313. }
  10314. return '<div class="option">' + escape(data[field_label]) + '</div>';
  10315. },
  10316. 'item': function item(data, escape) {
  10317. if(data.description)
  10318. {
  10319. return '<div class="item">'
  10320. + '<div class="title">'+escape(data[field_label])+'</div>'
  10321. + '<div class="desc">'
  10322. + escape(data['description'])
  10323. + '</div>'
  10324. + '</div>';
  10325. }
  10326. return '<div class="item">' + escape(data[field_label]) + '</div>';
  10327. },
  10328. 'option_create': function option_create(data, escape) {
  10329. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  10330. }
  10331. };
  10332. self.settings.render = $.extend({}, templates, self.settings.render);
  10333. },
  10334. /**
  10335. * Maps fired events to callbacks provided
  10336. * in the settings used when creating the control.
  10337. */
  10338. setupCallbacks: function setupCallbacks() {
  10339. var key,
  10340. fn,
  10341. callbacks = {
  10342. 'initialize': 'onInitialize',
  10343. 'change': 'onChange',
  10344. 'item_add': 'onItemAdd',
  10345. 'item_remove': 'onItemRemove',
  10346. 'clear': 'onClear',
  10347. 'option_add': 'onOptionAdd',
  10348. 'option_remove': 'onOptionRemove',
  10349. 'option_clear': 'onOptionClear',
  10350. 'optgroup_add': 'onOptionGroupAdd',
  10351. 'optgroup_remove': 'onOptionGroupRemove',
  10352. 'optgroup_clear': 'onOptionGroupClear',
  10353. 'dropdown_open': 'onDropdownOpen',
  10354. 'dropdown_close': 'onDropdownClose',
  10355. 'type': 'onType',
  10356. 'load': 'onLoad',
  10357. 'focus': 'onFocus',
  10358. 'blur': 'onBlur'
  10359. };
  10360. for (key in callbacks) {
  10361. if (callbacks.hasOwnProperty(key)) {
  10362. fn = this.settings[callbacks[key]];
  10363. if (fn) this.on(key, fn);
  10364. }
  10365. }
  10366. },
  10367. /**
  10368. * Triggered when the main control element
  10369. * has a click event.
  10370. *
  10371. * @param {object} e
  10372. * @return {boolean}
  10373. */
  10374. onClick: function onClick(e) {
  10375. var self = this;
  10376. // necessary for mobile webkit devices (manual focus triggering
  10377. // is ignored unless invoked within a click event)
  10378. if (!self.isFocused) {
  10379. self.focus();
  10380. e.preventDefault();
  10381. }
  10382. },
  10383. /**
  10384. * Triggered when the main control element
  10385. * has a mouse down event.
  10386. *
  10387. * @param {object} e
  10388. * @return {boolean}
  10389. */
  10390. onMouseDown: function onMouseDown(e) {
  10391. var self = this;
  10392. var defaultPrevented = e.isDefaultPrevented();
  10393. var $target = $(e.target);
  10394. if (self.isFocused) {
  10395. // retain focus by preventing native handling. if the
  10396. // event target is the input it should not be modified.
  10397. // otherwise, text selection within the input won't work.
  10398. if (e.target !== self.$control_input[0]) {
  10399. if (self.settings.mode === 'single') {
  10400. // toggle dropdown
  10401. self.isOpen ? self.close() : self.open();
  10402. } else if (!defaultPrevented) {
  10403. self.setActiveItem(null);
  10404. }
  10405. return false;
  10406. }
  10407. } else {
  10408. // give control focus
  10409. if (!defaultPrevented) {
  10410. window.setTimeout(function () {
  10411. self.focus();
  10412. }, 0);
  10413. }
  10414. }
  10415. },
  10416. /**
  10417. * Triggered when the value of the control has been changed.
  10418. * This should propagate the event to the original DOM
  10419. * input / select element.
  10420. */
  10421. onChange: function onChange() {
  10422. this.$input.trigger('change');
  10423. },
  10424. /**
  10425. * Triggered on <input> paste.
  10426. *
  10427. * @param {object} e
  10428. * @returns {boolean}
  10429. */
  10430. onPaste: function onPaste(e) {
  10431. var self = this;
  10432. if (self.isFull() || self.isInputHidden || self.isLocked) {
  10433. e.preventDefault();
  10434. return;
  10435. }
  10436. // If a regex or string is included, this will split the pasted
  10437. // input and create Items for each separate value
  10438. if (self.settings.splitOn) {
  10439. // Wait for pasted text to be recognized in value
  10440. setTimeout(function () {
  10441. var pastedText = self.$control_input.val();
  10442. if (!pastedText.match(self.settings.splitOn)) {
  10443. return;
  10444. }
  10445. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  10446. for (var i = 0, n = splitInput.length; i < n; i++) {
  10447. self.createItem(splitInput[i]);
  10448. }
  10449. }, 0);
  10450. }
  10451. },
  10452. /**
  10453. * Triggered on <input> keypress.
  10454. *
  10455. * @param {object} e
  10456. * @returns {boolean}
  10457. */
  10458. onKeyPress: function onKeyPress(e) {
  10459. if (this.isLocked) return e && e.preventDefault();
  10460. var character = String.fromCharCode(e.keyCode || e.which);
  10461. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  10462. this.createItem();
  10463. e.preventDefault();
  10464. return false;
  10465. }
  10466. },
  10467. /**
  10468. * Triggered on <input> keydown.
  10469. *
  10470. * @param {object} e
  10471. * @returns {boolean}
  10472. */
  10473. onKeyDown: function onKeyDown(e) {
  10474. var isInput = e.target === this.$control_input[0];
  10475. var self = this;
  10476. if (self.isLocked) {
  10477. if (e.keyCode !== KEY_TAB) {
  10478. e.preventDefault();
  10479. }
  10480. return;
  10481. }
  10482. switch (e.keyCode) {
  10483. case KEY_A:
  10484. if (self.isCmdDown) {
  10485. self.selectAll();
  10486. return;
  10487. }
  10488. break;
  10489. case KEY_ESC:
  10490. if (self.isOpen) {
  10491. e.preventDefault();
  10492. e.stopPropagation();
  10493. self.close();
  10494. }
  10495. return;
  10496. case KEY_N:
  10497. if (!e.ctrlKey || e.altKey) break;
  10498. case KEY_DOWN:
  10499. if (!self.isOpen && self.hasOptions) {
  10500. self.open();
  10501. } else if (self.$activeOption) {
  10502. self.ignoreHover = true;
  10503. var $next = self.getAdjacentOption(self.$activeOption, 1);
  10504. if ($next.length) self.setActiveOption($next, true, true);
  10505. }
  10506. e.preventDefault();
  10507. return;
  10508. case KEY_P:
  10509. if (!e.ctrlKey || e.altKey) break;
  10510. case KEY_UP:
  10511. if (self.$activeOption) {
  10512. self.ignoreHover = true;
  10513. var $prev = self.getAdjacentOption(self.$activeOption, -1);
  10514. if ($prev.length) self.setActiveOption($prev, true, true);
  10515. }
  10516. e.preventDefault();
  10517. return;
  10518. case KEY_RETURN:
  10519. if (self.isOpen && self.$activeOption) {
  10520. self.onOptionSelect({ currentTarget: self.$activeOption });
  10521. e.preventDefault();
  10522. }
  10523. return;
  10524. case KEY_LEFT:
  10525. self.advanceSelection(-1, e);
  10526. return;
  10527. case KEY_RIGHT:
  10528. self.advanceSelection(1, e);
  10529. return;
  10530. case KEY_TAB:
  10531. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  10532. self.onOptionSelect({ currentTarget: self.$activeOption });
  10533. // Default behaviour is to jump to the next field, we only want this
  10534. // if the current field doesn't accept any more entries
  10535. if (!self.isFull()) {
  10536. e.preventDefault();
  10537. }
  10538. }
  10539. if (self.settings.create && self.createItem()) {
  10540. e.preventDefault();
  10541. }
  10542. return;
  10543. case KEY_BACKSPACE:
  10544. case KEY_DELETE:
  10545. self.deleteSelection(e);
  10546. return;
  10547. }
  10548. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  10549. e.preventDefault();
  10550. return;
  10551. }
  10552. },
  10553. /**
  10554. * Triggered on <input> keyup.
  10555. *
  10556. * @param {object} e
  10557. * @returns {boolean}
  10558. */
  10559. onKeyUp: function onKeyUp(e) {
  10560. var self = this;
  10561. if (self.isLocked) return e && e.preventDefault();
  10562. var value = self.$control_input.val() || '';
  10563. if (self.lastValue !== value) {
  10564. self.lastValue = value;
  10565. self.onSearchChange(value);
  10566. self.refreshOptions();
  10567. self.trigger('type', value);
  10568. }
  10569. },
  10570. /**
  10571. * Invokes the user-provide option provider / loader.
  10572. *
  10573. * Note: this function is debounced in the Selectize
  10574. * constructor (by `settings.loadThrottle` milliseconds)
  10575. *
  10576. * @param {string} value
  10577. */
  10578. onSearchChange: function onSearchChange(value) {
  10579. var self = this;
  10580. var fn = self.settings.load;
  10581. if (!fn) return;
  10582. if (self.loadedSearches.hasOwnProperty(value)) return;
  10583. self.loadedSearches[value] = true;
  10584. self.load(function (callback) {
  10585. fn.apply(self, [value, callback]);
  10586. });
  10587. },
  10588. /**
  10589. * Triggered on <input> focus.
  10590. *
  10591. * @param {object} e (optional)
  10592. * @returns {boolean}
  10593. */
  10594. onFocus: function onFocus(e) {
  10595. var self = this;
  10596. var wasFocused = self.isFocused;
  10597. if (self.isDisabled) {
  10598. self.blur();
  10599. e && e.preventDefault();
  10600. return false;
  10601. }
  10602. if (self.ignoreFocus) return;
  10603. self.isFocused = true;
  10604. if (self.settings.preload === 'focus') self.onSearchChange('');
  10605. if (!wasFocused) self.trigger('focus');
  10606. if (!self.$activeItems.length) {
  10607. self.showInput();
  10608. self.setActiveItem(null);
  10609. self.refreshOptions(!!self.settings.openOnFocus);
  10610. }
  10611. self.refreshState();
  10612. },
  10613. /**
  10614. * Triggered on <input> blur.
  10615. *
  10616. * @param {object} e
  10617. * @param {Element} dest
  10618. */
  10619. onBlur: function onBlur(e, dest) {
  10620. var self = this;
  10621. if (!self.isFocused) return;
  10622. self.isFocused = false;
  10623. if (self.ignoreFocus) {
  10624. return;
  10625. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  10626. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  10627. self.ignoreBlur = true;
  10628. self.onFocus(e);
  10629. return;
  10630. }
  10631. var deactivate = function deactivate() {
  10632. self.close();
  10633. self.setTextboxValue('');
  10634. self.setActiveItem(null);
  10635. self.setActiveOption(null);
  10636. self.setCaret(self.items.length);
  10637. self.refreshState();
  10638. // IE11 bug: element still marked as active
  10639. dest && dest.focus && dest.focus();
  10640. self.ignoreFocus = false;
  10641. self.trigger('blur');
  10642. };
  10643. self.ignoreFocus = true;
  10644. if (self.settings.create && self.settings.createOnBlur) {
  10645. self.createItem(null, false, deactivate);
  10646. } else {
  10647. deactivate();
  10648. }
  10649. },
  10650. /**
  10651. * Triggered when the user rolls over
  10652. * an option in the autocomplete dropdown menu.
  10653. *
  10654. * @param {object} e
  10655. * @returns {boolean}
  10656. */
  10657. onOptionHover: function onOptionHover(e) {
  10658. if (this.ignoreHover) return;
  10659. this.setActiveOption(e.currentTarget, false);
  10660. },
  10661. /**
  10662. * Triggered when the user clicks on an option
  10663. * in the autocomplete dropdown menu.
  10664. *
  10665. * @param {object} e
  10666. * @returns {boolean}
  10667. */
  10668. onOptionSelect: function onOptionSelect(e) {
  10669. var value,
  10670. $target,
  10671. $option,
  10672. self = this;
  10673. if (e.preventDefault) {
  10674. e.preventDefault();
  10675. e.stopPropagation();
  10676. }
  10677. $target = $(e.currentTarget);
  10678. if ($target.hasClass('create')) {
  10679. self.createItem(null, function () {
  10680. if (self.settings.closeAfterSelect) {
  10681. self.close();
  10682. }
  10683. });
  10684. } else {
  10685. value = $target.attr('data-value');
  10686. if (typeof value !== 'undefined') {
  10687. self.lastQuery = null;
  10688. self.setTextboxValue('');
  10689. self.addItem(value);
  10690. if (self.settings.closeAfterSelect) {
  10691. self.close();
  10692. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  10693. self.setActiveOption(self.getOption(value));
  10694. }
  10695. }
  10696. }
  10697. },
  10698. /**
  10699. * Triggered when the user clicks on an item
  10700. * that has been selected.
  10701. *
  10702. * @param {object} e
  10703. * @returns {boolean}
  10704. */
  10705. onItemSelect: function onItemSelect(e) {
  10706. var self = this;
  10707. if (self.isLocked) return;
  10708. if (self.settings.mode === 'multi') {
  10709. e.preventDefault();
  10710. self.setActiveItem(e.currentTarget, e);
  10711. }
  10712. },
  10713. /**
  10714. * Invokes the provided method that provides
  10715. * results to a callback---which are then added
  10716. * as options to the control.
  10717. *
  10718. * @param {function} fn
  10719. */
  10720. load: function load(fn) {
  10721. var self = this;
  10722. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  10723. self.loading++;
  10724. fn.apply(self, [function (results) {
  10725. self.loading = Math.max(self.loading - 1, 0);
  10726. if (results && results.length) {
  10727. self.addOption(results);
  10728. self.refreshOptions(self.isFocused && !self.isInputHidden);
  10729. }
  10730. if (!self.loading) {
  10731. $wrapper.removeClass(self.settings.loadingClass);
  10732. }
  10733. self.trigger('load', results);
  10734. }]);
  10735. },
  10736. /**
  10737. * Sets the input field of the control to the specified value.
  10738. *
  10739. * @param {string} value
  10740. */
  10741. setTextboxValue: function setTextboxValue(value) {
  10742. var $input = this.$control_input;
  10743. var changed = $input.val() !== value;
  10744. if (changed) {
  10745. $input.val(value).triggerHandler('update');
  10746. this.lastValue = value;
  10747. }
  10748. },
  10749. /**
  10750. * Returns the value of the control. If multiple items
  10751. * can be selected (e.g. <select multiple>), this returns
  10752. * an array. If only one item can be selected, this
  10753. * returns a string.
  10754. *
  10755. * @returns {mixed}
  10756. */
  10757. getValue: function getValue() {
  10758. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  10759. return this.items;
  10760. } else {
  10761. return this.items.join(this.settings.delimiter);
  10762. }
  10763. },
  10764. /**
  10765. * Resets the selected items to the given value.
  10766. *
  10767. * @param {mixed} value
  10768. */
  10769. setValue: function setValue(value, silent) {
  10770. var events = silent ? [] : ['change'];
  10771. debounce_events(this, events, function () {
  10772. this.clear(silent);
  10773. this.addItems(value, silent);
  10774. });
  10775. },
  10776. /**
  10777. * Sets the selected item.
  10778. *
  10779. * @param {object} $item
  10780. * @param {object} e (optional)
  10781. */
  10782. setActiveItem: function setActiveItem($item, e) {
  10783. var self = this;
  10784. var eventName;
  10785. var i, idx, begin, end, item, swap;
  10786. var $last;
  10787. if (self.settings.mode === 'single') return;
  10788. $item = $($item);
  10789. // clear the active selection
  10790. if (!$item.length) {
  10791. $(self.$activeItems).removeClass('active');
  10792. self.$activeItems = [];
  10793. if (self.isFocused) {
  10794. self.showInput();
  10795. }
  10796. return;
  10797. }
  10798. // modify selection
  10799. eventName = e && e.type.toLowerCase();
  10800. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  10801. $last = self.$control.children('.active:last');
  10802. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  10803. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  10804. if (begin > end) {
  10805. swap = begin;
  10806. begin = end;
  10807. end = swap;
  10808. }
  10809. for (i = begin; i <= end; i++) {
  10810. item = self.$control[0].childNodes[i];
  10811. if (self.$activeItems.indexOf(item) === -1) {
  10812. $(item).addClass('active');
  10813. self.$activeItems.push(item);
  10814. }
  10815. }
  10816. e.preventDefault();
  10817. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  10818. if ($item.hasClass('active')) {
  10819. idx = self.$activeItems.indexOf($item[0]);
  10820. self.$activeItems.splice(idx, 1);
  10821. $item.removeClass('active');
  10822. } else {
  10823. self.$activeItems.push($item.addClass('active')[0]);
  10824. }
  10825. } else {
  10826. $(self.$activeItems).removeClass('active');
  10827. self.$activeItems = [$item.addClass('active')[0]];
  10828. }
  10829. // ensure control has focus
  10830. self.hideInput();
  10831. if (!this.isFocused) {
  10832. self.focus();
  10833. }
  10834. },
  10835. /**
  10836. * Sets the selected item in the dropdown menu
  10837. * of available options.
  10838. *
  10839. * @param {object} $object
  10840. * @param {boolean} scroll
  10841. * @param {boolean} animate
  10842. */
  10843. setActiveOption: function setActiveOption($option, scroll, animate) {
  10844. var height_menu, height_item, y;
  10845. var scroll_top, scroll_bottom;
  10846. var self = this;
  10847. if (self.$activeOption) self.$activeOption.removeClass('active');
  10848. self.$activeOption = null;
  10849. $option = $($option);
  10850. if (!$option.length) return;
  10851. self.$activeOption = $option.addClass('active');
  10852. if (scroll || !isset(scroll)) {
  10853. height_menu = self.$dropdown_content.height();
  10854. height_item = self.$activeOption.outerHeight(true);
  10855. scroll = self.$dropdown_content.scrollTop() || 0;
  10856. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  10857. scroll_top = y;
  10858. scroll_bottom = y - height_menu + height_item;
  10859. if (y + height_item > height_menu + scroll) {
  10860. self.$dropdown_content.stop().animate({ scrollTop: scroll_bottom }, animate ? self.settings.scrollDuration : 0);
  10861. } else if (y < scroll) {
  10862. self.$dropdown_content.stop().animate({ scrollTop: scroll_top }, animate ? self.settings.scrollDuration : 0);
  10863. }
  10864. }
  10865. },
  10866. /**
  10867. * Selects all items (CTRL + A).
  10868. */
  10869. selectAll: function selectAll() {
  10870. var self = this;
  10871. if (self.settings.mode === 'single') return;
  10872. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  10873. if (self.$activeItems.length) {
  10874. self.hideInput();
  10875. self.close();
  10876. }
  10877. self.focus();
  10878. },
  10879. /**
  10880. * Hides the input element out of view, while
  10881. * retaining its focus.
  10882. */
  10883. hideInput: function hideInput() {
  10884. var self = this;
  10885. self.setTextboxValue('');
  10886. self.$control_input.css({ opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000 });
  10887. self.isInputHidden = true;
  10888. },
  10889. /**
  10890. * Restores input visibility.
  10891. */
  10892. showInput: function showInput() {
  10893. this.$control_input.css({ opacity: 1, position: 'relative', left: 0 });
  10894. this.isInputHidden = false;
  10895. },
  10896. /**
  10897. * Gives the control focus.
  10898. */
  10899. focus: function focus() {
  10900. var self = this;
  10901. if (self.isDisabled) return;
  10902. self.ignoreFocus = true;
  10903. self.$control_input[0].focus();
  10904. window.setTimeout(function () {
  10905. self.ignoreFocus = false;
  10906. self.onFocus();
  10907. }, 0);
  10908. },
  10909. /**
  10910. * Forces the control out of focus.
  10911. *
  10912. * @param {Element} dest
  10913. */
  10914. blur: function blur(dest) {
  10915. this.$control_input[0].blur();
  10916. this.onBlur(null, dest);
  10917. },
  10918. /**
  10919. * Returns a function that scores an object
  10920. * to show how good of a match it is to the
  10921. * provided query.
  10922. *
  10923. * @param {string} query
  10924. * @param {object} options
  10925. * @return {function}
  10926. */
  10927. getScoreFunction: function getScoreFunction(query) {
  10928. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  10929. },
  10930. /**
  10931. * Returns search options for sifter (the system
  10932. * for scoring and sorting results).
  10933. *
  10934. * @see https://github.com/brianreavis/sifter.js
  10935. * @return {object}
  10936. */
  10937. getSearchOptions: function getSearchOptions() {
  10938. var settings = this.settings;
  10939. var sort = settings.sortField;
  10940. if (typeof sort === 'string') {
  10941. sort = [{ field: sort }];
  10942. }
  10943. return {
  10944. fields: settings.searchField,
  10945. conjunction: settings.searchConjunction,
  10946. sort: sort
  10947. };
  10948. },
  10949. /**
  10950. * Searches through available options and returns
  10951. * a sorted array of matches.
  10952. *
  10953. * Returns an object containing:
  10954. *
  10955. * - query {string}
  10956. * - tokens {array}
  10957. * - total {int}
  10958. * - items {array}
  10959. *
  10960. * @param {string} query
  10961. * @returns {object}
  10962. */
  10963. search: function search(query) {
  10964. var i, value, score, result, calculateScore;
  10965. var self = this;
  10966. var settings = self.settings;
  10967. var options = this.getSearchOptions();
  10968. // validate user-provided result scoring function
  10969. if (settings.score) {
  10970. calculateScore = self.settings.score.apply(this, [query]);
  10971. if (typeof calculateScore !== 'function') {
  10972. throw new Error('Selectize "score" setting must be a function that returns a function');
  10973. }
  10974. }
  10975. // perform search
  10976. if (query !== self.lastQuery) {
  10977. self.lastQuery = query;
  10978. result = self.sifter.search(query, $.extend(options, { score: calculateScore }));
  10979. self.currentResults = result;
  10980. } else {
  10981. result = $.extend(true, {}, self.currentResults);
  10982. }
  10983. // filter out selected items
  10984. if (settings.hideSelected) {
  10985. for (i = result.items.length - 1; i >= 0; i--) {
  10986. if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
  10987. result.items.splice(i, 1);
  10988. }
  10989. }
  10990. }
  10991. return result;
  10992. },
  10993. /**
  10994. * Refreshes the list of available options shown
  10995. * in the autocomplete dropdown menu.
  10996. *
  10997. * @param {boolean} triggerDropdown
  10998. */
  10999. refreshOptions: function refreshOptions(triggerDropdown) {
  11000. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  11001. var $active, $active_before, $create;
  11002. if (typeof triggerDropdown === 'undefined') {
  11003. triggerDropdown = true;
  11004. }
  11005. var self = this;
  11006. var query = $.trim(self.$control_input.val());
  11007. var results = self.search(query);
  11008. var $dropdown_content = self.$dropdown_content;
  11009. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  11010. // build markup
  11011. n = results.items.length;
  11012. if (typeof self.settings.maxOptions === 'number') {
  11013. n = Math.min(n, self.settings.maxOptions);
  11014. }
  11015. // render and group available options individually
  11016. groups = {};
  11017. groups_order = [];
  11018. for (i = 0; i < n; i++) {
  11019. option = self.options[results.items[i].id];
  11020. option_html = self.render('option', option);
  11021. optgroup = option[self.settings.optgroupField] || '';
  11022. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11023. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11024. optgroup = optgroups[j];
  11025. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11026. optgroup = '';
  11027. }
  11028. if (!groups.hasOwnProperty(optgroup)) {
  11029. groups[optgroup] = document.createDocumentFragment();
  11030. groups_order.push(optgroup);
  11031. }
  11032. groups[optgroup].appendChild(option_html);
  11033. }
  11034. }
  11035. // sort optgroups
  11036. if (this.settings.lockOptgroupOrder) {
  11037. groups_order.sort(function (a, b) {
  11038. var a_order = self.optgroups[a].$order || 0;
  11039. var b_order = self.optgroups[b].$order || 0;
  11040. return a_order - b_order;
  11041. });
  11042. }
  11043. // render optgroup headers & join groups
  11044. html = document.createDocumentFragment();
  11045. for (i = 0, n = groups_order.length; i < n; i++) {
  11046. optgroup = groups_order[i];
  11047. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11048. // render the optgroup header and options within it,
  11049. // then pass it to the wrapper template
  11050. html_children = document.createDocumentFragment();
  11051. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11052. html_children.appendChild(groups[optgroup]);
  11053. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11054. html: domToString(html_children),
  11055. dom: html_children
  11056. })));
  11057. } else {
  11058. html.appendChild(groups[optgroup]);
  11059. }
  11060. }
  11061. $dropdown_content.html(html);
  11062. // highlight matching terms inline
  11063. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11064. $dropdown_content.removeHighlight();
  11065. for (i = 0, n = results.tokens.length; i < n; i++) {
  11066. highlight($dropdown_content, results.tokens[i].regex);
  11067. }
  11068. }
  11069. // add "selected" class to selected options
  11070. if (!self.settings.hideSelected) {
  11071. for (i = 0, n = self.items.length; i < n; i++) {
  11072. self.getOption(self.items[i]).addClass('selected');
  11073. }
  11074. }
  11075. // add create option
  11076. has_create_option = self.canCreate(query);
  11077. if (has_create_option) {
  11078. $dropdown_content.prepend(self.render('option_create', { input: query }));
  11079. $create = $($dropdown_content[0].childNodes[0]);
  11080. }
  11081. // activate
  11082. self.hasOptions = results.items.length > 0 || has_create_option;
  11083. if (self.hasOptions) {
  11084. if (results.items.length > 0) {
  11085. $active_before = active_before && self.getOption(active_before);
  11086. if ($active_before && $active_before.length) {
  11087. $active = $active_before;
  11088. } else if (self.settings.mode === 'single' && self.items.length) {
  11089. $active = self.getOption(self.items[0]);
  11090. }
  11091. if (!$active || !$active.length) {
  11092. if ($create && !self.settings.addPrecedence) {
  11093. $active = self.getAdjacentOption($create, 1);
  11094. } else {
  11095. $active = $dropdown_content.find('[data-selectable]:first');
  11096. }
  11097. }
  11098. } else {
  11099. $active = $create;
  11100. }
  11101. self.setActiveOption($active);
  11102. if (triggerDropdown && !self.isOpen) {
  11103. self.open();
  11104. }
  11105. } else {
  11106. self.setActiveOption(null);
  11107. if (triggerDropdown && self.isOpen) {
  11108. self.close();
  11109. }
  11110. }
  11111. },
  11112. /**
  11113. * Adds an available option. If it already exists,
  11114. * nothing will happen. Note: this does not refresh
  11115. * the options list dropdown (use `refreshOptions`
  11116. * for that).
  11117. *
  11118. * Usage:
  11119. *
  11120. * this.addOption(data)
  11121. *
  11122. * @param {object|array} data
  11123. */
  11124. addOption: function addOption(data) {
  11125. var i,
  11126. n,
  11127. value,
  11128. self = this;
  11129. if ($.isArray(data)) {
  11130. for (i = 0, n = data.length; i < n; i++) {
  11131. self.addOption(data[i]);
  11132. }
  11133. return;
  11134. }
  11135. if (value = self.registerOption(data)) {
  11136. self.userOptions[value] = true;
  11137. self.lastQuery = null;
  11138. self.trigger('option_add', value, data);
  11139. }
  11140. },
  11141. /**
  11142. * Registers an option to the pool of options.
  11143. *
  11144. * @param {object} data
  11145. * @return {boolean|string}
  11146. */
  11147. registerOption: function registerOption(data) {
  11148. var key = hash_key(data[this.settings.valueField]);
  11149. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
  11150. data.$order = data.$order || ++this.order;
  11151. this.options[key] = data;
  11152. return key;
  11153. },
  11154. /**
  11155. * Registers an option group to the pool of option groups.
  11156. *
  11157. * @param {object} data
  11158. * @return {boolean|string}
  11159. */
  11160. registerOptionGroup: function registerOptionGroup(data) {
  11161. var key = hash_key(data[this.settings.optgroupValueField]);
  11162. if (!key) return false;
  11163. data.$order = data.$order || ++this.order;
  11164. this.optgroups[key] = data;
  11165. return key;
  11166. },
  11167. /**
  11168. * Registers a new optgroup for options
  11169. * to be bucketed into.
  11170. *
  11171. * @param {string} id
  11172. * @param {object} data
  11173. */
  11174. addOptionGroup: function addOptionGroup(id, data) {
  11175. data[this.settings.optgroupValueField] = id;
  11176. if (id = this.registerOptionGroup(data)) {
  11177. this.trigger('optgroup_add', id, data);
  11178. }
  11179. },
  11180. /**
  11181. * Removes an existing option group.
  11182. *
  11183. * @param {string} id
  11184. */
  11185. removeOptionGroup: function removeOptionGroup(id) {
  11186. if (this.optgroups.hasOwnProperty(id)) {
  11187. delete this.optgroups[id];
  11188. this.renderCache = {};
  11189. this.trigger('optgroup_remove', id);
  11190. }
  11191. },
  11192. /**
  11193. * Clears all existing option groups.
  11194. */
  11195. clearOptionGroups: function clearOptionGroups() {
  11196. this.optgroups = {};
  11197. this.renderCache = {};
  11198. this.trigger('optgroup_clear');
  11199. },
  11200. /**
  11201. * Updates an option available for selection. If
  11202. * it is visible in the selected items or options
  11203. * dropdown, it will be re-rendered automatically.
  11204. *
  11205. * @param {string} value
  11206. * @param {object} data
  11207. */
  11208. updateOption: function updateOption(value, data) {
  11209. var self = this;
  11210. var $item, $item_new;
  11211. var value_new, index_item, cache_items, cache_options, order_old;
  11212. value = hash_key(value);
  11213. value_new = hash_key(data[self.settings.valueField]);
  11214. // sanity checks
  11215. if (value === null) return;
  11216. if (!self.options.hasOwnProperty(value)) return;
  11217. if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
  11218. order_old = self.options[value].$order;
  11219. // update references
  11220. if (value_new !== value) {
  11221. delete self.options[value];
  11222. index_item = self.items.indexOf(value);
  11223. if (index_item !== -1) {
  11224. self.items.splice(index_item, 1, value_new);
  11225. }
  11226. }
  11227. data.$order = data.$order || order_old;
  11228. self.options[value_new] = data;
  11229. // invalidate render cache
  11230. cache_items = self.renderCache['item'];
  11231. cache_options = self.renderCache['option'];
  11232. if (cache_items) {
  11233. delete cache_items[value];
  11234. delete cache_items[value_new];
  11235. }
  11236. if (cache_options) {
  11237. delete cache_options[value];
  11238. delete cache_options[value_new];
  11239. }
  11240. // update the item if it's selected
  11241. if (self.items.indexOf(value_new) !== -1) {
  11242. $item = self.getItem(value);
  11243. $item_new = $(self.render('item', data));
  11244. if ($item.hasClass('active')) $item_new.addClass('active');
  11245. $item.replaceWith($item_new);
  11246. }
  11247. // invalidate last query because we might have updated the sortField
  11248. self.lastQuery = null;
  11249. // update dropdown contents
  11250. if (self.isOpen) {
  11251. self.refreshOptions(false);
  11252. }
  11253. },
  11254. /**
  11255. * Removes a single option.
  11256. *
  11257. * @param {string} value
  11258. * @param {boolean} silent
  11259. */
  11260. removeOption: function removeOption(value, silent) {
  11261. var self = this;
  11262. value = hash_key(value);
  11263. var cache_items = self.renderCache['item'];
  11264. var cache_options = self.renderCache['option'];
  11265. if (cache_items) delete cache_items[value];
  11266. if (cache_options) delete cache_options[value];
  11267. delete self.userOptions[value];
  11268. delete self.options[value];
  11269. self.lastQuery = null;
  11270. self.trigger('option_remove', value);
  11271. self.removeItem(value, silent);
  11272. },
  11273. /**
  11274. * Clears all options.
  11275. */
  11276. clearOptions: function clearOptions() {
  11277. var self = this;
  11278. self.loadedSearches = {};
  11279. self.userOptions = {};
  11280. self.renderCache = {};
  11281. self.options = self.sifter.items = {};
  11282. self.lastQuery = null;
  11283. self.trigger('option_clear');
  11284. self.clear();
  11285. },
  11286. /**
  11287. * Returns the jQuery element of the option
  11288. * matching the given value.
  11289. *
  11290. * @param {string} value
  11291. * @returns {object}
  11292. */
  11293. getOption: function getOption(value) {
  11294. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  11295. },
  11296. /**
  11297. * Returns the jQuery element of the next or
  11298. * previous selectable option.
  11299. *
  11300. * @param {object} $option
  11301. * @param {int} direction can be 1 for next or -1 for previous
  11302. * @return {object}
  11303. */
  11304. getAdjacentOption: function getAdjacentOption($option, direction) {
  11305. var $options = this.$dropdown.find('[data-selectable]');
  11306. var index = $options.index($option) + direction;
  11307. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  11308. },
  11309. /**
  11310. * Finds the first element with a "data-value" attribute
  11311. * that matches the given value.
  11312. *
  11313. * @param {mixed} value
  11314. * @param {object} $els
  11315. * @return {object}
  11316. */
  11317. getElementWithValue: function getElementWithValue(value, $els) {
  11318. value = hash_key(value);
  11319. if (typeof value !== 'undefined' && value !== null) {
  11320. for (var i = 0, n = $els.length; i < n; i++) {
  11321. if ($els[i].getAttribute('data-value') === value) {
  11322. return $($els[i]);
  11323. }
  11324. }
  11325. }
  11326. return $();
  11327. },
  11328. /**
  11329. * Returns the jQuery element of the item
  11330. * matching the given value.
  11331. *
  11332. * @param {string} value
  11333. * @returns {object}
  11334. */
  11335. getItem: function getItem(value) {
  11336. return this.getElementWithValue(value, this.$control.children());
  11337. },
  11338. /**
  11339. * "Selects" multiple items at once. Adds them to the list
  11340. * at the current caret position.
  11341. *
  11342. * @param {string} value
  11343. * @param {boolean} silent
  11344. */
  11345. addItems: function addItems(values, silent) {
  11346. var items = $.isArray(values) ? values : [values];
  11347. for (var i = 0, n = items.length; i < n; i++) {
  11348. this.isPending = i < n - 1;
  11349. this.addItem(items[i], silent);
  11350. }
  11351. },
  11352. /**
  11353. * "Selects" an item. Adds it to the list
  11354. * at the current caret position.
  11355. *
  11356. * @param {string} value
  11357. * @param {boolean} silent
  11358. */
  11359. addItem: function addItem(value, silent) {
  11360. var events = silent ? [] : ['change'];
  11361. debounce_events(this, events, function () {
  11362. var $item, $option, $options;
  11363. var self = this;
  11364. var inputMode = self.settings.mode;
  11365. var i, active, value_next, wasFull;
  11366. value = hash_key(value);
  11367. if (self.items.indexOf(value) !== -1) {
  11368. if (inputMode === 'single') self.close();
  11369. return;
  11370. }
  11371. if (!self.options.hasOwnProperty(value)) return;
  11372. if (inputMode === 'single') self.clear(silent);
  11373. if (inputMode === 'multi' && self.isFull()) return;
  11374. $item = $(self.render('item', self.options[value]));
  11375. wasFull = self.isFull();
  11376. self.items.splice(self.caretPos, 0, value);
  11377. self.insertAtCaret($item);
  11378. if (!self.isPending || !wasFull && self.isFull()) {
  11379. self.refreshState();
  11380. }
  11381. if (self.isSetup) {
  11382. $options = self.$dropdown_content.find('[data-selectable]');
  11383. // update menu / remove the option (if this is not one item being added as part of series)
  11384. if (!self.isPending) {
  11385. $option = self.getOption(value);
  11386. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  11387. self.refreshOptions(self.isFocused && inputMode !== 'single');
  11388. if (value_next) {
  11389. self.setActiveOption(self.getOption(value_next));
  11390. }
  11391. }
  11392. // hide the menu if the maximum number of items have been selected or no options are left
  11393. if (!$options.length || self.isFull()) {
  11394. self.close();
  11395. } else {
  11396. self.positionDropdown();
  11397. }
  11398. self.updatePlaceholder();
  11399. self.trigger('item_add', value, $item);
  11400. self.updateOriginalInput({ silent: silent });
  11401. }
  11402. });
  11403. },
  11404. /**
  11405. * Removes the selected item matching
  11406. * the provided value.
  11407. *
  11408. * @param {string} value
  11409. */
  11410. removeItem: function removeItem(value, silent) {
  11411. var self = this;
  11412. var $item, i, idx;
  11413. $item = value instanceof $ ? value : self.getItem(value);
  11414. value = hash_key($item.attr('data-value'));
  11415. i = self.items.indexOf(value);
  11416. if (i !== -1) {
  11417. $item.remove();
  11418. if ($item.hasClass('active')) {
  11419. idx = self.$activeItems.indexOf($item[0]);
  11420. self.$activeItems.splice(idx, 1);
  11421. }
  11422. self.items.splice(i, 1);
  11423. self.lastQuery = null;
  11424. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  11425. self.removeOption(value, silent);
  11426. }
  11427. if (i < self.caretPos) {
  11428. self.setCaret(self.caretPos - 1);
  11429. }
  11430. self.refreshState();
  11431. self.updatePlaceholder();
  11432. self.updateOriginalInput({ silent: silent });
  11433. self.positionDropdown();
  11434. self.trigger('item_remove', value, $item);
  11435. }
  11436. },
  11437. /**
  11438. * Invokes the `create` method provided in the
  11439. * selectize options that should provide the data
  11440. * for the new item, given the user input.
  11441. *
  11442. * Once this completes, it will be added
  11443. * to the item list.
  11444. *
  11445. * @param {string} value
  11446. * @param {boolean} [triggerDropdown]
  11447. * @param {function} [callback]
  11448. * @return {boolean}
  11449. */
  11450. createItem: function createItem(input, triggerDropdown) {
  11451. var self = this;
  11452. var caret = self.caretPos;
  11453. input = input || $.trim(self.$control_input.val() || '');
  11454. var callback = arguments[arguments.length - 1];
  11455. if (typeof callback !== 'function') callback = function callback() {};
  11456. if (typeof triggerDropdown !== 'boolean') {
  11457. triggerDropdown = true;
  11458. }
  11459. if (!self.canCreate(input)) {
  11460. callback();
  11461. return false;
  11462. }
  11463. self.lock();
  11464. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  11465. var data = {};
  11466. data[self.settings.labelField] = input;
  11467. data[self.settings.valueField] = input;
  11468. return data;
  11469. };
  11470. var create = once(function (data) {
  11471. self.unlock();
  11472. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return callback();
  11473. var value = hash_key(data[self.settings.valueField]);
  11474. if (typeof value !== 'string') return callback();
  11475. self.setTextboxValue('');
  11476. self.addOption(data);
  11477. self.setCaret(caret);
  11478. self.addItem(value);
  11479. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  11480. callback(data);
  11481. });
  11482. var output = setup.apply(this, [input, create]);
  11483. if (typeof output !== 'undefined') {
  11484. create(output);
  11485. }
  11486. return true;
  11487. },
  11488. /**
  11489. * Re-renders the selected item lists.
  11490. */
  11491. refreshItems: function refreshItems() {
  11492. this.lastQuery = null;
  11493. if (this.isSetup) {
  11494. this.addItem(this.items);
  11495. }
  11496. this.refreshState();
  11497. this.updateOriginalInput();
  11498. },
  11499. /**
  11500. * Updates all state-dependent attributes
  11501. * and CSS classes.
  11502. */
  11503. refreshState: function refreshState() {
  11504. this.refreshValidityState();
  11505. this.refreshClasses();
  11506. },
  11507. /**
  11508. * Update the `required` attribute of both input and control input.
  11509. *
  11510. * The `required` property needs to be activated on the control input
  11511. * for the error to be displayed at the right place. `required` also
  11512. * needs to be temporarily deactivated on the input since the input is
  11513. * hidden and can't show errors.
  11514. */
  11515. refreshValidityState: function refreshValidityState() {
  11516. if (!this.isRequired) return false;
  11517. var invalid = !this.items.length;
  11518. this.isInvalid = invalid;
  11519. this.$control_input.prop('required', invalid);
  11520. this.$input.prop('required', !invalid);
  11521. },
  11522. /**
  11523. * Updates all state-dependent CSS classes.
  11524. */
  11525. refreshClasses: function refreshClasses() {
  11526. var self = this;
  11527. var isFull = self.isFull();
  11528. var isLocked = self.isLocked;
  11529. self.$wrapper.toggleClass('rtl', self.rtl);
  11530. self.$control.toggleClass('focus', self.isFocused).toggleClass('disabled', self.isDisabled).toggleClass('required', self.isRequired).toggleClass('invalid', self.isInvalid).toggleClass('locked', isLocked).toggleClass('full', isFull).toggleClass('not-full', !isFull).toggleClass('input-active', self.isFocused && !self.isInputHidden).toggleClass('dropdown-active', self.isOpen).toggleClass('has-options', !$.isEmptyObject(self.options)).toggleClass('has-items', self.items.length > 0);
  11531. self.$control_input.data('grow', !isFull && !isLocked);
  11532. },
  11533. /**
  11534. * Determines whether or not more items can be added
  11535. * to the control without exceeding the user-defined maximum.
  11536. *
  11537. * @returns {boolean}
  11538. */
  11539. isFull: function isFull() {
  11540. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  11541. },
  11542. /**
  11543. * Refreshes the original <select> or <input>
  11544. * element to reflect the current state.
  11545. */
  11546. updateOriginalInput: function updateOriginalInput(opts) {
  11547. var i,
  11548. n,
  11549. options,
  11550. label,
  11551. self = this;
  11552. opts = opts || {};
  11553. if (self.tagType === TAG_SELECT) {
  11554. options = [];
  11555. for (i = 0, n = self.items.length; i < n; i++) {
  11556. label = self.options[self.items[i]][self.settings.labelField] || '';
  11557. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  11558. }
  11559. if (!options.length && !this.$input.attr('multiple')) {
  11560. options.push('<option value="" selected="selected"></option>');
  11561. }
  11562. self.$input.html(options.join(''));
  11563. } else {
  11564. self.$input.val(self.getValue());
  11565. self.$input.attr('value', self.$input.val());
  11566. }
  11567. if (self.isSetup) {
  11568. if (!opts.silent) {
  11569. self.trigger('change', self.$input.val());
  11570. }
  11571. }
  11572. },
  11573. /**
  11574. * Shows/hide the input placeholder depending
  11575. * on if there items in the list already.
  11576. */
  11577. updatePlaceholder: function updatePlaceholder() {
  11578. if (!this.settings.placeholder) return;
  11579. var $input = this.$control_input;
  11580. if (this.items.length) {
  11581. $input.removeAttr('placeholder');
  11582. } else {
  11583. $input.attr('placeholder', this.settings.placeholder);
  11584. }
  11585. $input.triggerHandler('update', { force: true });
  11586. },
  11587. /**
  11588. * Shows the autocomplete dropdown containing
  11589. * the available options.
  11590. */
  11591. open: function open() {
  11592. var self = this;
  11593. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull()) return;
  11594. self.focus();
  11595. self.isOpen = true;
  11596. self.refreshState();
  11597. self.$dropdown.css({ visibility: 'hidden', display: 'block' });
  11598. self.positionDropdown();
  11599. self.$dropdown.css({ visibility: 'visible' });
  11600. self.trigger('dropdown_open', self.$dropdown);
  11601. },
  11602. /**
  11603. * Closes the autocomplete dropdown menu.
  11604. */
  11605. close: function close() {
  11606. var self = this;
  11607. var trigger = self.isOpen;
  11608. if (self.settings.mode === 'single' && self.items.length) {
  11609. self.hideInput();
  11610. self.$control_input.blur(); // close keyboard on iOS
  11611. }
  11612. self.isOpen = false;
  11613. self.$dropdown.hide();
  11614. self.setActiveOption(null);
  11615. self.refreshState();
  11616. if (trigger) self.trigger('dropdown_close', self.$dropdown);
  11617. },
  11618. /**
  11619. * Calculates and applies the appropriate
  11620. * position of the dropdown.
  11621. */
  11622. positionDropdown: function positionDropdown() {
  11623. var $control = this.$control;
  11624. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  11625. offset.top += $control.outerHeight(true);
  11626. this.$dropdown.css({
  11627. width: $control.outerWidth(),
  11628. top: offset.top,
  11629. left: offset.left
  11630. });
  11631. },
  11632. /**
  11633. * Resets / clears all selected items
  11634. * from the control.
  11635. *
  11636. * @param {boolean} silent
  11637. */
  11638. clear: function clear(silent) {
  11639. var self = this;
  11640. if (!self.items.length) return;
  11641. self.$control.children(':not(input)').remove();
  11642. self.items = [];
  11643. self.lastQuery = null;
  11644. self.setCaret(0);
  11645. self.setActiveItem(null);
  11646. self.updatePlaceholder();
  11647. self.updateOriginalInput({ silent: silent });
  11648. self.refreshState();
  11649. self.showInput();
  11650. self.trigger('clear');
  11651. },
  11652. /**
  11653. * A helper method for inserting an element
  11654. * at the current caret position.
  11655. *
  11656. * @param {object} $el
  11657. */
  11658. insertAtCaret: function insertAtCaret($el) {
  11659. var caret = Math.min(this.caretPos, this.items.length);
  11660. if (caret === 0) {
  11661. this.$control.prepend($el);
  11662. } else {
  11663. $(this.$control[0].childNodes[caret]).before($el);
  11664. }
  11665. this.setCaret(caret + 1);
  11666. },
  11667. /**
  11668. * Removes the current selected item(s).
  11669. *
  11670. * @param {object} e (optional)
  11671. * @returns {boolean}
  11672. */
  11673. deleteSelection: function deleteSelection(e) {
  11674. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  11675. var self = this;
  11676. direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;
  11677. selection = getSelection(self.$control_input[0]);
  11678. if (self.$activeOption && !self.settings.hideSelected) {
  11679. option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
  11680. }
  11681. // determine items that will be removed
  11682. values = [];
  11683. if (self.$activeItems.length) {
  11684. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  11685. caret = self.$control.children(':not(input)').index($tail);
  11686. if (direction > 0) {
  11687. caret++;
  11688. }
  11689. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  11690. values.push($(self.$activeItems[i]).attr('data-value'));
  11691. }
  11692. if (e) {
  11693. e.preventDefault();
  11694. e.stopPropagation();
  11695. }
  11696. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  11697. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  11698. values.push(self.items[self.caretPos - 1]);
  11699. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  11700. values.push(self.items[self.caretPos]);
  11701. }
  11702. }
  11703. // allow the callback to abort
  11704. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  11705. return false;
  11706. }
  11707. // perform removal
  11708. if (typeof caret !== 'undefined') {
  11709. self.setCaret(caret);
  11710. }
  11711. while (values.length) {
  11712. self.removeItem(values.pop());
  11713. }
  11714. self.showInput();
  11715. self.positionDropdown();
  11716. self.refreshOptions(true);
  11717. // select previous option
  11718. if (option_select) {
  11719. $option_select = self.getOption(option_select);
  11720. if ($option_select.length) {
  11721. self.setActiveOption($option_select);
  11722. }
  11723. }
  11724. return true;
  11725. },
  11726. /**
  11727. * Selects the previous / next item (depending
  11728. * on the `direction` argument).
  11729. *
  11730. * > 0 - right
  11731. * < 0 - left
  11732. *
  11733. * @param {int} direction
  11734. * @param {object} e (optional)
  11735. */
  11736. advanceSelection: function advanceSelection(direction, e) {
  11737. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  11738. var self = this;
  11739. if (direction === 0) return;
  11740. if (self.rtl) direction *= -1;
  11741. tail = direction > 0 ? 'last' : 'first';
  11742. selection = getSelection(self.$control_input[0]);
  11743. if (self.isFocused && !self.isInputHidden) {
  11744. valueLength = self.$control_input.val().length;
  11745. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  11746. if (cursorAtEdge && !valueLength) {
  11747. self.advanceCaret(direction, e);
  11748. }
  11749. } else {
  11750. $tail = self.$control.children('.active:' + tail);
  11751. if ($tail.length) {
  11752. idx = self.$control.children(':not(input)').index($tail);
  11753. self.setActiveItem(null);
  11754. self.setCaret(direction > 0 ? idx + 1 : idx);
  11755. }
  11756. }
  11757. },
  11758. /**
  11759. * Moves the caret left / right.
  11760. *
  11761. * @param {int} direction
  11762. * @param {object} e (optional)
  11763. */
  11764. advanceCaret: function advanceCaret(direction, e) {
  11765. var self = this,
  11766. fn,
  11767. $adj;
  11768. if (direction === 0) return;
  11769. fn = direction > 0 ? 'next' : 'prev';
  11770. if (self.isShiftDown) {
  11771. $adj = self.$control_input[fn]();
  11772. if ($adj.length) {
  11773. self.hideInput();
  11774. self.setActiveItem($adj);
  11775. e && e.preventDefault();
  11776. }
  11777. } else {
  11778. self.setCaret(self.caretPos + direction);
  11779. }
  11780. },
  11781. /**
  11782. * Moves the caret to the specified index.
  11783. *
  11784. * @param {int} i
  11785. */
  11786. setCaret: function setCaret(i) {
  11787. var self = this;
  11788. if (self.settings.mode === 'single') {
  11789. i = self.items.length;
  11790. } else {
  11791. i = Math.max(0, Math.min(self.items.length, i));
  11792. }
  11793. if (!self.isPending) {
  11794. // the input must be moved by leaving it in place and moving the
  11795. // siblings, due to the fact that focus cannot be restored once lost
  11796. // on mobile webkit devices
  11797. var j, n, fn, $children, $child;
  11798. $children = self.$control.children(':not(input)');
  11799. for (j = 0, n = $children.length; j < n; j++) {
  11800. $child = $($children[j]).detach();
  11801. if (j < i) {
  11802. self.$control_input.before($child);
  11803. } else {
  11804. self.$control.append($child);
  11805. }
  11806. }
  11807. }
  11808. self.caretPos = i;
  11809. },
  11810. /**
  11811. * Disables user input on the control. Used while
  11812. * items are being asynchronously created.
  11813. */
  11814. lock: function lock() {
  11815. this.close();
  11816. this.isLocked = true;
  11817. this.refreshState();
  11818. },
  11819. /**
  11820. * Re-enables user input on the control.
  11821. */
  11822. unlock: function unlock() {
  11823. this.isLocked = false;
  11824. this.refreshState();
  11825. },
  11826. /**
  11827. * Disables user input on the control completely.
  11828. * While disabled, it cannot receive focus.
  11829. */
  11830. disable: function disable() {
  11831. var self = this;
  11832. self.$input.prop('disabled', true);
  11833. self.$control_input.prop('disabled', true).prop('tabindex', -1);
  11834. self.isDisabled = true;
  11835. self.lock();
  11836. },
  11837. /**
  11838. * Enables the control so that it can respond
  11839. * to focus and user input.
  11840. */
  11841. enable: function enable() {
  11842. var self = this;
  11843. self.$input.prop('disabled', false);
  11844. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  11845. self.isDisabled = false;
  11846. self.unlock();
  11847. },
  11848. /**
  11849. * Completely destroys the control and
  11850. * unbinds all event listeners so that it can
  11851. * be garbage collected.
  11852. */
  11853. destroy: function destroy() {
  11854. var self = this;
  11855. var eventNS = self.eventNS;
  11856. var revertSettings = self.revertSettings;
  11857. self.trigger('destroy');
  11858. self.off();
  11859. self.$wrapper.remove();
  11860. self.$dropdown.remove();
  11861. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({ tabindex: revertSettings.tabindex }).show();
  11862. self.$control_input.removeData('grow');
  11863. self.$input.removeData('selectize');
  11864. $(window).off(eventNS);
  11865. $(document).off(eventNS);
  11866. $(document.body).off(eventNS);
  11867. delete self.$input[0].selectize;
  11868. },
  11869. /**
  11870. * A helper method for rendering "item" and
  11871. * "option" templates, given the data.
  11872. *
  11873. * @param {string} templateName
  11874. * @param {object} data
  11875. * @returns {string}
  11876. */
  11877. render: function render(templateName, data) {
  11878. var value, id, label;
  11879. var html = '';
  11880. var cache = false;
  11881. var self = this;
  11882. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  11883. if (templateName === 'option' || templateName === 'item') {
  11884. value = hash_key(data[self.settings.valueField]);
  11885. cache = !!value;
  11886. }
  11887. // pull markup from cache if it exists
  11888. if (cache) {
  11889. if (!isset(self.renderCache[templateName])) {
  11890. self.renderCache[templateName] = {};
  11891. }
  11892. if (self.renderCache[templateName].hasOwnProperty(value)) {
  11893. return self.renderCache[templateName][value];
  11894. }
  11895. }
  11896. // render markup
  11897. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  11898. // add mandatory attributes
  11899. if (templateName === 'option' || templateName === 'option_create') {
  11900. html.attr('data-selectable', '');
  11901. } else if (templateName === 'optgroup') {
  11902. id = data[self.settings.optgroupValueField] || '';
  11903. html.attr('data-group', id);
  11904. }
  11905. if (templateName === 'option' || templateName === 'item') {
  11906. html.attr('data-value', value || '');
  11907. }
  11908. // update cache
  11909. if (cache) {
  11910. self.renderCache[templateName][value] = html[0];
  11911. }
  11912. return html[0];
  11913. },
  11914. /**
  11915. * Clears the render cache for a template. If
  11916. * no template is given, clears all render
  11917. * caches.
  11918. *
  11919. * @param {string} templateName
  11920. */
  11921. clearCache: function clearCache(templateName) {
  11922. var self = this;
  11923. if (typeof templateName === 'undefined') {
  11924. self.renderCache = {};
  11925. } else {
  11926. delete self.renderCache[templateName];
  11927. }
  11928. },
  11929. /**
  11930. * Determines whether or not to display the
  11931. * create item prompt, given a user input.
  11932. *
  11933. * @param {string} input
  11934. * @return {boolean}
  11935. */
  11936. canCreate: function canCreate(input) {
  11937. var self = this;
  11938. if (!self.settings.create) return false;
  11939. var filter = self.settings.createFilter;
  11940. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  11941. }
  11942. });
  11943. Selectize.count = 0;
  11944. Selectize.defaults = {
  11945. options: [],
  11946. optgroups: [],
  11947. plugins: [],
  11948. delimiter: ',',
  11949. splitOn: null, // regexp or string for splitting up values from a paste command
  11950. persist: true,
  11951. diacritics: true,
  11952. create: false,
  11953. createOnBlur: false,
  11954. createFilter: null,
  11955. highlight: true,
  11956. openOnFocus: true,
  11957. maxOptions: 1000,
  11958. maxItems: null,
  11959. hideSelected: null,
  11960. addPrecedence: false,
  11961. selectOnTab: false,
  11962. preload: false,
  11963. allowEmptyOption: false,
  11964. closeAfterSelect: false,
  11965. scrollDuration: 60,
  11966. loadThrottle: 300,
  11967. loadingClass: 'loading',
  11968. dataAttr: 'data-data',
  11969. optgroupField: 'optgroup',
  11970. valueField: 'value',
  11971. labelField: 'text',
  11972. optgroupLabelField: 'label',
  11973. optgroupValueField: 'value',
  11974. lockOptgroupOrder: false,
  11975. sortField: '$order',
  11976. searchField: ['text'],
  11977. searchConjunction: 'and',
  11978. mode: null,
  11979. wrapperClass: 'selectize-control',
  11980. inputClass: 'selectize-input',
  11981. dropdownClass: 'selectize-dropdown',
  11982. dropdownContentClass: 'selectize-dropdown-content',
  11983. dropdownParent: null,
  11984. copyClassesToDropdown: true,
  11985. /*
  11986. load : null, // function(query, callback) { ... }
  11987. score : null, // function(search) { ... }
  11988. onInitialize : null, // function() { ... }
  11989. onChange : null, // function(value) { ... }
  11990. onItemAdd : null, // function(value, $item) { ... }
  11991. onItemRemove : null, // function(value) { ... }
  11992. onClear : null, // function() { ... }
  11993. onOptionAdd : null, // function(value, data) { ... }
  11994. onOptionRemove : null, // function(value) { ... }
  11995. onOptionClear : null, // function() { ... }
  11996. onOptionGroupAdd : null, // function(id, data) { ... }
  11997. onOptionGroupRemove : null, // function(id) { ... }
  11998. onOptionGroupClear : null, // function() { ... }
  11999. onDropdownOpen : null, // function($dropdown) { ... }
  12000. onDropdownClose : null, // function($dropdown) { ... }
  12001. onType : null, // function(str) { ... }
  12002. onDelete : null, // function(values) { ... }
  12003. */
  12004. render: {
  12005. /*
  12006. item: null,
  12007. optgroup: null,
  12008. optgroup_header: null,
  12009. option: null,
  12010. option_create: null
  12011. */
  12012. }
  12013. };
  12014. $.fn.selectize = function (settings_user) {
  12015. var defaults = $.fn.selectize.defaults;
  12016. var settings = $.extend({}, defaults, settings_user);
  12017. var attr_data = settings.dataAttr;
  12018. var field_label = settings.labelField;
  12019. var field_value = settings.valueField;
  12020. var field_optgroup = settings.optgroupField;
  12021. var field_optgroup_label = settings.optgroupLabelField;
  12022. var field_optgroup_value = settings.optgroupValueField;
  12023. /**
  12024. * Initializes selectize from a <input type="text"> element.
  12025. *
  12026. * @param {object} $input
  12027. * @param {object} settings_element
  12028. */
  12029. var init_textbox = function init_textbox($input, settings_element) {
  12030. var i, n, values, option;
  12031. var data_raw = $input.attr(attr_data);
  12032. if (!data_raw) {
  12033. var value = $.trim($input.val() || '');
  12034. if (!settings.allowEmptyOption && !value.length) return;
  12035. values = value.split(settings.delimiter);
  12036. for (i = 0, n = values.length; i < n; i++) {
  12037. option = {};
  12038. option[field_label] = values[i];
  12039. option[field_value] = values[i];
  12040. settings_element.options.push(option);
  12041. }
  12042. settings_element.items = values;
  12043. } else {
  12044. settings_element.options = JSON.parse(data_raw);
  12045. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12046. settings_element.items.push(settings_element.options[i][field_value]);
  12047. }
  12048. }
  12049. };
  12050. /**
  12051. * Initializes selectize from a <select> element.
  12052. *
  12053. * @param {object} $input
  12054. * @param {object} settings_element
  12055. */
  12056. var init_select = function init_select($input, settings_element) {
  12057. var i,
  12058. n,
  12059. tagName,
  12060. $children,
  12061. order = 0;
  12062. var options = settings_element.options;
  12063. var optionsMap = {};
  12064. var readData = function readData($el) {
  12065. var data = attr_data && $el.attr(attr_data);
  12066. if (typeof data === 'string' && data.length) {
  12067. return JSON.parse(data);
  12068. }
  12069. return null;
  12070. };
  12071. var addOption = function addOption($option, group) {
  12072. $option = $($option);
  12073. var value = hash_key($option.val());
  12074. if (!value && !settings.allowEmptyOption) return;
  12075. // if the option already exists, it's probably been
  12076. // duplicated in another optgroup. in this case, push
  12077. // the current group to the "optgroup" property on the
  12078. // existing option so that it's rendered in both places.
  12079. if (optionsMap.hasOwnProperty(value)) {
  12080. if (group) {
  12081. var arr = optionsMap[value][field_optgroup];
  12082. if (!arr) {
  12083. optionsMap[value][field_optgroup] = group;
  12084. } else if (!$.isArray(arr)) {
  12085. optionsMap[value][field_optgroup] = [arr, group];
  12086. } else {
  12087. arr.push(group);
  12088. }
  12089. }
  12090. return;
  12091. }
  12092. var option = readData($option) || {};
  12093. option[field_label] = option[field_label] || $option.text();
  12094. option[field_value] = option[field_value] || value;
  12095. option[field_optgroup] = option[field_optgroup] || group;
  12096. optionsMap[value] = option;
  12097. options.push(option);
  12098. if ($option.is(':selected')) {
  12099. settings_element.items.push(value);
  12100. }
  12101. };
  12102. var addGroup = function addGroup($optgroup) {
  12103. var i, n, id, optgroup, $options;
  12104. $optgroup = $($optgroup);
  12105. id = $optgroup.attr('label');
  12106. if (id) {
  12107. optgroup = readData($optgroup) || {};
  12108. optgroup[field_optgroup_label] = id;
  12109. optgroup[field_optgroup_value] = id;
  12110. settings_element.optgroups.push(optgroup);
  12111. }
  12112. $options = $('option', $optgroup);
  12113. for (i = 0, n = $options.length; i < n; i++) {
  12114. addOption($options[i], id);
  12115. }
  12116. };
  12117. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  12118. $children = $input.children();
  12119. for (i = 0, n = $children.length; i < n; i++) {
  12120. tagName = $children[i].tagName.toLowerCase();
  12121. if (tagName === 'optgroup') {
  12122. addGroup($children[i]);
  12123. } else if (tagName === 'option') {
  12124. addOption($children[i]);
  12125. }
  12126. }
  12127. };
  12128. return this.each(function () {
  12129. if (this.selectize) return;
  12130. var instance;
  12131. var $input = $(this);
  12132. var tag_name = this.tagName.toLowerCase();
  12133. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  12134. if (!placeholder && !settings.allowEmptyOption) {
  12135. placeholder = $input.children('option[value=""]').text();
  12136. }
  12137. var settings_element = {
  12138. 'placeholder': placeholder,
  12139. 'options': [],
  12140. 'optgroups': [],
  12141. 'items': []
  12142. };
  12143. if (tag_name === 'select') {
  12144. init_select($input, settings_element);
  12145. } else {
  12146. init_textbox($input, settings_element);
  12147. }
  12148. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  12149. });
  12150. };
  12151. $.fn.selectize.defaults = Selectize.defaults;
  12152. $.fn.selectize.support = {
  12153. validity: SUPPORTS_VALIDITY_API
  12154. };
  12155. Selectize.define('drag_drop', function (options) {
  12156. if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  12157. if (this.settings.mode !== 'multi') return;
  12158. var self = this;
  12159. self.lock = function () {
  12160. var original = self.lock;
  12161. return function () {
  12162. var sortable = self.$control.data('sortable');
  12163. if (sortable) sortable.disable();
  12164. return original.apply(self, arguments);
  12165. };
  12166. }();
  12167. self.unlock = function () {
  12168. var original = self.unlock;
  12169. return function () {
  12170. var sortable = self.$control.data('sortable');
  12171. if (sortable) sortable.enable();
  12172. return original.apply(self, arguments);
  12173. };
  12174. }();
  12175. self.setup = function () {
  12176. var original = self.setup;
  12177. return function () {
  12178. original.apply(this, arguments);
  12179. var $control = self.$control.sortable({
  12180. items: '[data-value]',
  12181. forcePlaceholderSize: true,
  12182. disabled: self.isLocked,
  12183. start: function start(e, ui) {
  12184. ui.placeholder.css('width', ui.helper.css('width'));
  12185. $control.css({ overflow: 'visible' });
  12186. },
  12187. stop: function stop() {
  12188. $control.css({ overflow: 'hidden' });
  12189. var active = self.$activeItems ? self.$activeItems.slice() : null;
  12190. var values = [];
  12191. $control.children('[data-value]').each(function () {
  12192. values.push($(this).attr('data-value'));
  12193. });
  12194. self.setValue(values);
  12195. self.setActiveItem(active);
  12196. }
  12197. });
  12198. };
  12199. }();
  12200. });
  12201. Selectize.define('dropdown_header', function (options) {
  12202. var self = this;
  12203. options = $.extend({
  12204. title: 'Untitled',
  12205. headerClass: 'selectize-dropdown-header',
  12206. titleRowClass: 'selectize-dropdown-header-title',
  12207. labelClass: 'selectize-dropdown-header-label',
  12208. closeClass: 'selectize-dropdown-header-close',
  12209. html: function html(data) {
  12210. return '<div class="' + data.headerClass + '">' + '<div class="' + data.titleRowClass + '">' + '<span class="' + data.labelClass + '">' + data.title + '</span>' + '<a href="javascript:void(0)" class="' + data.closeClass + '">&times;</a>' + '</div>' + '</div>';
  12211. }
  12212. }, options);
  12213. self.setup = function () {
  12214. var original = self.setup;
  12215. return function () {
  12216. original.apply(self, arguments);
  12217. self.$dropdown_header = $(options.html(options));
  12218. self.$dropdown.prepend(self.$dropdown_header);
  12219. };
  12220. }();
  12221. });
  12222. Selectize.define('optgroup_columns', function (options) {
  12223. var self = this;
  12224. options = $.extend({
  12225. equalizeWidth: true,
  12226. equalizeHeight: true
  12227. }, options);
  12228. this.getAdjacentOption = function ($option, direction) {
  12229. var $options = $option.closest('[data-group]').find('[data-selectable]');
  12230. var index = $options.index($option) + direction;
  12231. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12232. };
  12233. this.onKeyDown = function () {
  12234. var original = self.onKeyDown;
  12235. return function (e) {
  12236. var index, $option, $options, $optgroup;
  12237. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  12238. self.ignoreHover = true;
  12239. $optgroup = this.$activeOption.closest('[data-group]');
  12240. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  12241. if (e.keyCode === KEY_LEFT) {
  12242. $optgroup = $optgroup.prev('[data-group]');
  12243. } else {
  12244. $optgroup = $optgroup.next('[data-group]');
  12245. }
  12246. $options = $optgroup.find('[data-selectable]');
  12247. $option = $options.eq(Math.min($options.length - 1, index));
  12248. if ($option.length) {
  12249. this.setActiveOption($option);
  12250. }
  12251. return;
  12252. }
  12253. return original.apply(this, arguments);
  12254. };
  12255. }();
  12256. var getScrollbarWidth = function getScrollbarWidth() {
  12257. var div;
  12258. var width = getScrollbarWidth.width;
  12259. var doc = document;
  12260. if (typeof width === 'undefined') {
  12261. div = doc.createElement('div');
  12262. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  12263. div = div.firstChild;
  12264. doc.body.appendChild(div);
  12265. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  12266. doc.body.removeChild(div);
  12267. }
  12268. return width;
  12269. };
  12270. var equalizeSizes = function equalizeSizes() {
  12271. var i, n, height_max, width, width_last, width_parent, $optgroups;
  12272. $optgroups = $('[data-group]', self.$dropdown_content);
  12273. n = $optgroups.length;
  12274. if (!n || !self.$dropdown_content.width()) return;
  12275. if (options.equalizeHeight) {
  12276. height_max = 0;
  12277. for (i = 0; i < n; i++) {
  12278. height_max = Math.max(height_max, $optgroups.eq(i).height());
  12279. }
  12280. $optgroups.css({ height: height_max });
  12281. }
  12282. if (options.equalizeWidth) {
  12283. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  12284. width = Math.round(width_parent / n);
  12285. $optgroups.css({ width: width });
  12286. if (n > 1) {
  12287. width_last = width_parent - width * (n - 1);
  12288. $optgroups.eq(n - 1).css({ width: width_last });
  12289. }
  12290. }
  12291. };
  12292. if (options.equalizeHeight || options.equalizeWidth) {
  12293. hook.after(this, 'positionDropdown', equalizeSizes);
  12294. hook.after(this, 'refreshOptions', equalizeSizes);
  12295. }
  12296. });
  12297. Selectize.define('remove_button', function (options) {
  12298. options = $.extend({
  12299. label: '&times;',
  12300. title: 'Remove',
  12301. className: 'remove',
  12302. append: true
  12303. }, options);
  12304. var singleClose = function singleClose(thisRef, options) {
  12305. options.className = 'remove-single';
  12306. var self = thisRef;
  12307. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12308. /**
  12309. * Appends an element as a child (with raw HTML).
  12310. *
  12311. * @param {string} html_container
  12312. * @param {string} html_element
  12313. * @return {string}
  12314. */
  12315. var append = function append(html_container, html_element) {
  12316. return html_container + html_element;
  12317. };
  12318. thisRef.setup = function () {
  12319. var original = self.setup;
  12320. return function () {
  12321. // override the item rendering method to add the button to each
  12322. if (options.append) {
  12323. var id = $(self.$input.context).attr('id');
  12324. var selectizer = $('#' + id);
  12325. var render_item = self.settings.render.item;
  12326. self.settings.render.item = function (data) {
  12327. return append(render_item.apply(thisRef, arguments), html);
  12328. };
  12329. }
  12330. original.apply(thisRef, arguments);
  12331. // add event listener
  12332. thisRef.$control.on('click', '.' + options.className, function (e) {
  12333. e.preventDefault();
  12334. if (self.isLocked) return;
  12335. self.clear();
  12336. });
  12337. };
  12338. }();
  12339. };
  12340. var multiClose = function multiClose(thisRef, options) {
  12341. var self = thisRef;
  12342. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12343. /**
  12344. * Appends an element as a child (with raw HTML).
  12345. *
  12346. * @param {string} html_container
  12347. * @param {string} html_element
  12348. * @return {string}
  12349. */
  12350. var append = function append(html_container, html_element) {
  12351. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  12352. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  12353. };
  12354. thisRef.setup = function () {
  12355. var original = self.setup;
  12356. return function () {
  12357. // override the item rendering method to add the button to each
  12358. if (options.append) {
  12359. var render_item = self.settings.render.item;
  12360. self.settings.render.item = function (data) {
  12361. return append(render_item.apply(thisRef, arguments), html);
  12362. };
  12363. }
  12364. original.apply(thisRef, arguments);
  12365. // add event listener
  12366. thisRef.$control.on('click', '.' + options.className, function (e) {
  12367. e.preventDefault();
  12368. if (self.isLocked) return;
  12369. var $item = $(e.currentTarget).parent();
  12370. self.setActiveItem($item);
  12371. if (self.deleteSelection()) {
  12372. self.setCaret(self.items.length);
  12373. }
  12374. });
  12375. };
  12376. }();
  12377. };
  12378. if (this.settings.mode === 'single') {
  12379. singleClose(this, options);
  12380. return;
  12381. } else {
  12382. multiClose(this, options);
  12383. }
  12384. });
  12385. Selectize.define('restore_on_backspace', function (options) {
  12386. var self = this;
  12387. options.text = options.text || function (option) {
  12388. return option[this.settings.labelField];
  12389. };
  12390. this.onKeyDown = function () {
  12391. var original = self.onKeyDown;
  12392. return function (e) {
  12393. var index, option;
  12394. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  12395. index = this.caretPos - 1;
  12396. if (index >= 0 && index < this.items.length) {
  12397. option = this.options[this.items[index]];
  12398. if (this.deleteSelection(e)) {
  12399. this.setTextboxValue(options.text.apply(this, [option]));
  12400. this.refreshOptions(true);
  12401. }
  12402. e.preventDefault();
  12403. return;
  12404. }
  12405. }
  12406. return original.apply(this, arguments);
  12407. };
  12408. }();
  12409. });
  12410. return Selectize;
  12411. });
  12412. /***/ }),
  12413. /* 30 */
  12414. /***/ (function(module, exports, __webpack_require__) {
  12415. "use strict";
  12416. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12417. /*!
  12418. Autosize 4.0.0
  12419. license: MIT
  12420. http://www.jacklmoore.com/autosize
  12421. */
  12422. (function (global, factory) {
  12423. if (true) {
  12424. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12425. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12426. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12427. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12428. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  12429. factory(exports, module);
  12430. } else {
  12431. var mod = {
  12432. exports: {}
  12433. };
  12434. factory(mod.exports, mod);
  12435. global.autosize = mod.exports;
  12436. }
  12437. })(undefined, function (exports, module) {
  12438. 'use strict';
  12439. var map = typeof Map === "function" ? new Map() : function () {
  12440. var keys = [];
  12441. var values = [];
  12442. return {
  12443. has: function has(key) {
  12444. return keys.indexOf(key) > -1;
  12445. },
  12446. get: function get(key) {
  12447. return values[keys.indexOf(key)];
  12448. },
  12449. set: function set(key, value) {
  12450. if (keys.indexOf(key) === -1) {
  12451. keys.push(key);
  12452. values.push(value);
  12453. }
  12454. },
  12455. 'delete': function _delete(key) {
  12456. var index = keys.indexOf(key);
  12457. if (index > -1) {
  12458. keys.splice(index, 1);
  12459. values.splice(index, 1);
  12460. }
  12461. }
  12462. };
  12463. }();
  12464. var createEvent = function createEvent(name) {
  12465. return new Event(name, { bubbles: true });
  12466. };
  12467. try {
  12468. new Event('test');
  12469. } catch (e) {
  12470. // IE does not support `new Event()`
  12471. createEvent = function createEvent(name) {
  12472. var evt = document.createEvent('Event');
  12473. evt.initEvent(name, true, false);
  12474. return evt;
  12475. };
  12476. }
  12477. function assign(ta) {
  12478. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  12479. var heightOffset = null;
  12480. var clientWidth = ta.clientWidth;
  12481. var cachedHeight = null;
  12482. function init() {
  12483. var style = window.getComputedStyle(ta, null);
  12484. if (style.resize === 'vertical') {
  12485. ta.style.resize = 'none';
  12486. } else if (style.resize === 'both') {
  12487. ta.style.resize = 'horizontal';
  12488. }
  12489. if (style.boxSizing === 'content-box') {
  12490. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  12491. } else {
  12492. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  12493. }
  12494. // Fix when a textarea is not on document body and heightOffset is Not a Number
  12495. if (isNaN(heightOffset)) {
  12496. heightOffset = 0;
  12497. }
  12498. update();
  12499. }
  12500. function changeOverflow(value) {
  12501. {
  12502. // Chrome/Safari-specific fix:
  12503. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  12504. // made available by removing the scrollbar. The following forces the necessary text reflow.
  12505. var width = ta.style.width;
  12506. ta.style.width = '0px';
  12507. // Force reflow:
  12508. /* jshint ignore:start */
  12509. ta.offsetWidth;
  12510. /* jshint ignore:end */
  12511. ta.style.width = width;
  12512. }
  12513. ta.style.overflowY = value;
  12514. }
  12515. function getParentOverflows(el) {
  12516. var arr = [];
  12517. while (el && el.parentNode && el.parentNode instanceof Element) {
  12518. if (el.parentNode.scrollTop) {
  12519. arr.push({
  12520. node: el.parentNode,
  12521. scrollTop: el.parentNode.scrollTop
  12522. });
  12523. }
  12524. el = el.parentNode;
  12525. }
  12526. return arr;
  12527. }
  12528. function resize() {
  12529. var originalHeight = ta.style.height;
  12530. var overflows = getParentOverflows(ta);
  12531. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  12532. ta.style.height = '';
  12533. var endHeight = ta.scrollHeight + heightOffset;
  12534. if (ta.scrollHeight === 0) {
  12535. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  12536. ta.style.height = originalHeight;
  12537. return;
  12538. }
  12539. ta.style.height = endHeight + 'px';
  12540. // used to check if an update is actually necessary on window.resize
  12541. clientWidth = ta.clientWidth;
  12542. // prevents scroll-position jumping
  12543. overflows.forEach(function (el) {
  12544. el.node.scrollTop = el.scrollTop;
  12545. });
  12546. if (docTop) {
  12547. document.documentElement.scrollTop = docTop;
  12548. }
  12549. }
  12550. function update() {
  12551. resize();
  12552. var styleHeight = Math.round(parseFloat(ta.style.height));
  12553. var computed = window.getComputedStyle(ta, null);
  12554. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  12555. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  12556. // The actual height not matching the style height (set via the resize method) indicates that
  12557. // the max-height has been exceeded, in which case the overflow should be allowed.
  12558. if (actualHeight !== styleHeight) {
  12559. if (computed.overflowY === 'hidden') {
  12560. changeOverflow('scroll');
  12561. resize();
  12562. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12563. }
  12564. } else {
  12565. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  12566. if (computed.overflowY !== 'hidden') {
  12567. changeOverflow('hidden');
  12568. resize();
  12569. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12570. }
  12571. }
  12572. if (cachedHeight !== actualHeight) {
  12573. cachedHeight = actualHeight;
  12574. var evt = createEvent('autosize:resized');
  12575. try {
  12576. ta.dispatchEvent(evt);
  12577. } catch (err) {
  12578. // Firefox will throw an error on dispatchEvent for a detached element
  12579. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  12580. }
  12581. }
  12582. }
  12583. var pageResize = function pageResize() {
  12584. if (ta.clientWidth !== clientWidth) {
  12585. update();
  12586. }
  12587. };
  12588. var destroy = function (style) {
  12589. window.removeEventListener('resize', pageResize, false);
  12590. ta.removeEventListener('input', update, false);
  12591. ta.removeEventListener('keyup', update, false);
  12592. ta.removeEventListener('autosize:destroy', destroy, false);
  12593. ta.removeEventListener('autosize:update', update, false);
  12594. Object.keys(style).forEach(function (key) {
  12595. ta.style[key] = style[key];
  12596. });
  12597. map['delete'](ta);
  12598. }.bind(ta, {
  12599. height: ta.style.height,
  12600. resize: ta.style.resize,
  12601. overflowY: ta.style.overflowY,
  12602. overflowX: ta.style.overflowX,
  12603. wordWrap: ta.style.wordWrap
  12604. });
  12605. ta.addEventListener('autosize:destroy', destroy, false);
  12606. // IE9 does not fire onpropertychange or oninput for deletions,
  12607. // so binding to onkeyup to catch most of those events.
  12608. // There is no way that I know of to detect something like 'cut' in IE9.
  12609. if ('onpropertychange' in ta && 'oninput' in ta) {
  12610. ta.addEventListener('keyup', update, false);
  12611. }
  12612. window.addEventListener('resize', pageResize, false);
  12613. ta.addEventListener('input', update, false);
  12614. ta.addEventListener('autosize:update', update, false);
  12615. ta.style.overflowX = 'hidden';
  12616. ta.style.wordWrap = 'break-word';
  12617. map.set(ta, {
  12618. destroy: destroy,
  12619. update: update
  12620. });
  12621. init();
  12622. }
  12623. function destroy(ta) {
  12624. var methods = map.get(ta);
  12625. if (methods) {
  12626. methods.destroy();
  12627. }
  12628. }
  12629. function update(ta) {
  12630. var methods = map.get(ta);
  12631. if (methods) {
  12632. methods.update();
  12633. }
  12634. }
  12635. var autosize = null;
  12636. // Do nothing in Node.js environment and IE8 (or lower)
  12637. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  12638. autosize = function autosize(el) {
  12639. return el;
  12640. };
  12641. autosize.destroy = function (el) {
  12642. return el;
  12643. };
  12644. autosize.update = function (el) {
  12645. return el;
  12646. };
  12647. } else {
  12648. autosize = function autosize(el, options) {
  12649. if (el) {
  12650. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  12651. return assign(x, options);
  12652. });
  12653. }
  12654. return el;
  12655. };
  12656. autosize.destroy = function (el) {
  12657. if (el) {
  12658. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  12659. }
  12660. return el;
  12661. };
  12662. autosize.update = function (el) {
  12663. if (el) {
  12664. Array.prototype.forEach.call(el.length ? el : [el], update);
  12665. }
  12666. return el;
  12667. };
  12668. }
  12669. module.exports = autosize;
  12670. });
  12671. /***/ }),
  12672. /* 31 */
  12673. /***/ (function(module, exports, __webpack_require__) {
  12674. "use strict";
  12675. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;
  12676. 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; };
  12677. /*!
  12678. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  12679. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  12680. * License: MIT */
  12681. (function (f) {
  12682. if (( false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  12683. module.exports = f();
  12684. } else if (true) {
  12685. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  12686. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12687. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12688. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12689. } else {
  12690. var g;if (typeof window !== "undefined") {
  12691. g = window;
  12692. } else if (typeof global !== "undefined") {
  12693. g = global;
  12694. } else if (typeof self !== "undefined") {
  12695. g = self;
  12696. } else {
  12697. g = this;
  12698. }g.enquire = f();
  12699. }
  12700. })(function () {
  12701. var define, module, exports;return function e(t, n, r) {
  12702. function s(o, u) {
  12703. if (!n[o]) {
  12704. if (!t[o]) {
  12705. var a = typeof require == "function" && require;if (!u && a) return require(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
  12706. }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
  12707. var n = t[o][1][e];return s(n ? n : e);
  12708. }, l, l.exports, e, t, n, r);
  12709. }return n[o].exports;
  12710. }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
  12711. s(r[o]);
  12712. }return s;
  12713. }({ 1: [function (require, module, exports) {
  12714. var QueryHandler = require(3);
  12715. var each = require(4).each;
  12716. /**
  12717. * Represents a single media query, manages it's state and registered handlers for this query
  12718. *
  12719. * @constructor
  12720. * @param {string} query the media query string
  12721. * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
  12722. */
  12723. function MediaQuery(query, isUnconditional) {
  12724. this.query = query;
  12725. this.isUnconditional = isUnconditional;
  12726. this.handlers = [];
  12727. this.mql = window.matchMedia(query);
  12728. var self = this;
  12729. this.listener = function (mql) {
  12730. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  12731. self.mql = mql.currentTarget || mql;
  12732. self.assess();
  12733. };
  12734. this.mql.addListener(this.listener);
  12735. }
  12736. MediaQuery.prototype = {
  12737. constuctor: MediaQuery,
  12738. /**
  12739. * add a handler for this query, triggering if already active
  12740. *
  12741. * @param {object} handler
  12742. * @param {function} handler.match callback for when query is activated
  12743. * @param {function} [handler.unmatch] callback for when query is deactivated
  12744. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  12745. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  12746. */
  12747. addHandler: function addHandler(handler) {
  12748. var qh = new QueryHandler(handler);
  12749. this.handlers.push(qh);
  12750. this.matches() && qh.on();
  12751. },
  12752. /**
  12753. * removes the given handler from the collection, and calls it's destroy methods
  12754. *
  12755. * @param {object || function} handler the handler to remove
  12756. */
  12757. removeHandler: function removeHandler(handler) {
  12758. var handlers = this.handlers;
  12759. each(handlers, function (h, i) {
  12760. if (h.equals(handler)) {
  12761. h.destroy();
  12762. return !handlers.splice(i, 1); //remove from array and exit each early
  12763. }
  12764. });
  12765. },
  12766. /**
  12767. * Determine whether the media query should be considered a match
  12768. *
  12769. * @return {Boolean} true if media query can be considered a match, false otherwise
  12770. */
  12771. matches: function matches() {
  12772. return this.mql.matches || this.isUnconditional;
  12773. },
  12774. /**
  12775. * Clears all handlers and unbinds events
  12776. */
  12777. clear: function clear() {
  12778. each(this.handlers, function (handler) {
  12779. handler.destroy();
  12780. });
  12781. this.mql.removeListener(this.listener);
  12782. this.handlers.length = 0; //clear array
  12783. },
  12784. /*
  12785. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  12786. */
  12787. assess: function assess() {
  12788. var action = this.matches() ? 'on' : 'off';
  12789. each(this.handlers, function (handler) {
  12790. handler[action]();
  12791. });
  12792. }
  12793. };
  12794. module.exports = MediaQuery;
  12795. }, { "3": 3, "4": 4 }], 2: [function (require, module, exports) {
  12796. var MediaQuery = require(1);
  12797. var Util = require(4);
  12798. var each = Util.each;
  12799. var isFunction = Util.isFunction;
  12800. var isArray = Util.isArray;
  12801. /**
  12802. * Allows for registration of query handlers.
  12803. * Manages the query handler's state and is responsible for wiring up browser events
  12804. *
  12805. * @constructor
  12806. */
  12807. function MediaQueryDispatch() {
  12808. if (!window.matchMedia) {
  12809. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  12810. }
  12811. this.queries = {};
  12812. this.browserIsIncapable = !window.matchMedia('only all').matches;
  12813. }
  12814. MediaQueryDispatch.prototype = {
  12815. constructor: MediaQueryDispatch,
  12816. /**
  12817. * Registers a handler for the given media query
  12818. *
  12819. * @param {string} q the media query
  12820. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  12821. * @param {function} options.match fired when query matched
  12822. * @param {function} [options.unmatch] fired when a query is no longer matched
  12823. * @param {function} [options.setup] fired when handler first triggered
  12824. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  12825. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  12826. */
  12827. register: function register(q, options, shouldDegrade) {
  12828. var queries = this.queries,
  12829. isUnconditional = shouldDegrade && this.browserIsIncapable;
  12830. if (!queries[q]) {
  12831. queries[q] = new MediaQuery(q, isUnconditional);
  12832. }
  12833. //normalise to object in an array
  12834. if (isFunction(options)) {
  12835. options = { match: options };
  12836. }
  12837. if (!isArray(options)) {
  12838. options = [options];
  12839. }
  12840. each(options, function (handler) {
  12841. if (isFunction(handler)) {
  12842. handler = { match: handler };
  12843. }
  12844. queries[q].addHandler(handler);
  12845. });
  12846. return this;
  12847. },
  12848. /**
  12849. * unregisters a query and all it's handlers, or a specific handler for a query
  12850. *
  12851. * @param {string} q the media query to target
  12852. * @param {object || function} [handler] specific handler to unregister
  12853. */
  12854. unregister: function unregister(q, handler) {
  12855. var query = this.queries[q];
  12856. if (query) {
  12857. if (handler) {
  12858. query.removeHandler(handler);
  12859. } else {
  12860. query.clear();
  12861. delete this.queries[q];
  12862. }
  12863. }
  12864. return this;
  12865. }
  12866. };
  12867. module.exports = MediaQueryDispatch;
  12868. }, { "1": 1, "4": 4 }], 3: [function (require, module, exports) {
  12869. /**
  12870. * Delegate to handle a media query being matched and unmatched.
  12871. *
  12872. * @param {object} options
  12873. * @param {function} options.match callback for when the media query is matched
  12874. * @param {function} [options.unmatch] callback for when the media query is unmatched
  12875. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  12876. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  12877. * @constructor
  12878. */
  12879. function QueryHandler(options) {
  12880. this.options = options;
  12881. !options.deferSetup && this.setup();
  12882. }
  12883. QueryHandler.prototype = {
  12884. constructor: QueryHandler,
  12885. /**
  12886. * coordinates setup of the handler
  12887. *
  12888. * @function
  12889. */
  12890. setup: function setup() {
  12891. if (this.options.setup) {
  12892. this.options.setup();
  12893. }
  12894. this.initialised = true;
  12895. },
  12896. /**
  12897. * coordinates setup and triggering of the handler
  12898. *
  12899. * @function
  12900. */
  12901. on: function on() {
  12902. !this.initialised && this.setup();
  12903. this.options.match && this.options.match();
  12904. },
  12905. /**
  12906. * coordinates the unmatch event for the handler
  12907. *
  12908. * @function
  12909. */
  12910. off: function off() {
  12911. this.options.unmatch && this.options.unmatch();
  12912. },
  12913. /**
  12914. * called when a handler is to be destroyed.
  12915. * delegates to the destroy or unmatch callbacks, depending on availability.
  12916. *
  12917. * @function
  12918. */
  12919. destroy: function destroy() {
  12920. this.options.destroy ? this.options.destroy() : this.off();
  12921. },
  12922. /**
  12923. * determines equality by reference.
  12924. * if object is supplied compare options, if function, compare match callback
  12925. *
  12926. * @function
  12927. * @param {object || function} [target] the target for comparison
  12928. */
  12929. equals: function equals(target) {
  12930. return this.options === target || this.options.match === target;
  12931. }
  12932. };
  12933. module.exports = QueryHandler;
  12934. }, {}], 4: [function (require, module, exports) {
  12935. /**
  12936. * Helper function for iterating over a collection
  12937. *
  12938. * @param collection
  12939. * @param fn
  12940. */
  12941. function each(collection, fn) {
  12942. var i = 0,
  12943. length = collection.length,
  12944. cont;
  12945. for (i; i < length; i++) {
  12946. cont = fn(collection[i], i);
  12947. if (cont === false) {
  12948. break; //allow early exit
  12949. }
  12950. }
  12951. }
  12952. /**
  12953. * Helper function for determining whether target object is an array
  12954. *
  12955. * @param target the object under test
  12956. * @return {Boolean} true if array, false otherwise
  12957. */
  12958. function isArray(target) {
  12959. return Object.prototype.toString.apply(target) === '[object Array]';
  12960. }
  12961. /**
  12962. * Helper function for determining whether target object is a function
  12963. *
  12964. * @param target the object under test
  12965. * @return {Boolean} true if function, false otherwise
  12966. */
  12967. function isFunction(target) {
  12968. return typeof target === 'function';
  12969. }
  12970. module.exports = {
  12971. isFunction: isFunction,
  12972. isArray: isArray,
  12973. each: each
  12974. };
  12975. }, {}], 5: [function (require, module, exports) {
  12976. var MediaQueryDispatch = require(2);
  12977. module.exports = new MediaQueryDispatch();
  12978. }, { "2": 2 }] }, {}, [5])(5);
  12979. });
  12980. /***/ }),
  12981. /* 32 */
  12982. /***/ (function(module, exports, __webpack_require__) {
  12983. "use strict";
  12984. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12985. /*! jQuery UI - v1.12.1 - 2017-03-23
  12986. * http://jqueryui.com
  12987. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  12988. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  12989. (function (factory) {
  12990. if (true) {
  12991. // AMD. Register as an anonymous module.
  12992. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12993. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12994. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12995. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12996. } else {
  12997. // Browser globals
  12998. factory(jQuery);
  12999. }
  13000. })(function ($) {
  13001. $.ui = $.ui || {};
  13002. var version = $.ui.version = "1.12.1";
  13003. /*!
  13004. * jQuery UI Widget 1.12.1
  13005. * http://jqueryui.com
  13006. *
  13007. * Copyright jQuery Foundation and other contributors
  13008. * Released under the MIT license.
  13009. * http://jquery.org/license
  13010. */
  13011. //>>label: Widget
  13012. //>>group: Core
  13013. //>>description: Provides a factory for creating stateful widgets with a common API.
  13014. //>>docs: http://api.jqueryui.com/jQuery.widget/
  13015. //>>demos: http://jqueryui.com/widget/
  13016. var widgetUuid = 0;
  13017. var widgetSlice = Array.prototype.slice;
  13018. $.cleanData = function (orig) {
  13019. return function (elems) {
  13020. var events, elem, i;
  13021. for (i = 0; (elem = elems[i]) != null; i++) {
  13022. try {
  13023. // Only trigger remove when necessary to save time
  13024. events = $._data(elem, "events");
  13025. if (events && events.remove) {
  13026. $(elem).triggerHandler("remove");
  13027. }
  13028. // Http://bugs.jquery.com/ticket/8235
  13029. } catch (e) {}
  13030. }
  13031. orig(elems);
  13032. };
  13033. }($.cleanData);
  13034. $.widget = function (name, base, prototype) {
  13035. var existingConstructor, constructor, basePrototype;
  13036. // ProxiedPrototype allows the provided prototype to remain unmodified
  13037. // so that it can be used as a mixin for multiple widgets (#8876)
  13038. var proxiedPrototype = {};
  13039. var namespace = name.split(".")[0];
  13040. name = name.split(".")[1];
  13041. var fullName = namespace + "-" + name;
  13042. if (!prototype) {
  13043. prototype = base;
  13044. base = $.Widget;
  13045. }
  13046. if ($.isArray(prototype)) {
  13047. prototype = $.extend.apply(null, [{}].concat(prototype));
  13048. }
  13049. // Create selector for plugin
  13050. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  13051. return !!$.data(elem, fullName);
  13052. };
  13053. $[namespace] = $[namespace] || {};
  13054. existingConstructor = $[namespace][name];
  13055. constructor = $[namespace][name] = function (options, element) {
  13056. // Allow instantiation without "new" keyword
  13057. if (!this._createWidget) {
  13058. return new constructor(options, element);
  13059. }
  13060. // Allow instantiation without initializing for simple inheritance
  13061. // must use "new" keyword (the code above always passes args)
  13062. if (arguments.length) {
  13063. this._createWidget(options, element);
  13064. }
  13065. };
  13066. // Extend with the existing constructor to carry over any static properties
  13067. $.extend(constructor, existingConstructor, {
  13068. version: prototype.version,
  13069. // Copy the object used to create the prototype in case we need to
  13070. // redefine the widget later
  13071. _proto: $.extend({}, prototype),
  13072. // Track widgets that inherit from this widget in case this widget is
  13073. // redefined after a widget inherits from it
  13074. _childConstructors: []
  13075. });
  13076. basePrototype = new base();
  13077. // We need to make the options hash a property directly on the new instance
  13078. // otherwise we'll modify the options hash on the prototype that we're
  13079. // inheriting from
  13080. basePrototype.options = $.widget.extend({}, basePrototype.options);
  13081. $.each(prototype, function (prop, value) {
  13082. if (!$.isFunction(value)) {
  13083. proxiedPrototype[prop] = value;
  13084. return;
  13085. }
  13086. proxiedPrototype[prop] = function () {
  13087. function _super() {
  13088. return base.prototype[prop].apply(this, arguments);
  13089. }
  13090. function _superApply(args) {
  13091. return base.prototype[prop].apply(this, args);
  13092. }
  13093. return function () {
  13094. var __super = this._super;
  13095. var __superApply = this._superApply;
  13096. var returnValue;
  13097. this._super = _super;
  13098. this._superApply = _superApply;
  13099. returnValue = value.apply(this, arguments);
  13100. this._super = __super;
  13101. this._superApply = __superApply;
  13102. return returnValue;
  13103. };
  13104. }();
  13105. });
  13106. constructor.prototype = $.widget.extend(basePrototype, {
  13107. // TODO: remove support for widgetEventPrefix
  13108. // always use the name + a colon as the prefix, e.g., draggable:start
  13109. // don't prefix for widgets that aren't DOM-based
  13110. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  13111. }, proxiedPrototype, {
  13112. constructor: constructor,
  13113. namespace: namespace,
  13114. widgetName: name,
  13115. widgetFullName: fullName
  13116. });
  13117. // If this widget is being redefined then we need to find all widgets that
  13118. // are inheriting from it and redefine all of them so that they inherit from
  13119. // the new version of this widget. We're essentially trying to replace one
  13120. // level in the prototype chain.
  13121. if (existingConstructor) {
  13122. $.each(existingConstructor._childConstructors, function (i, child) {
  13123. var childPrototype = child.prototype;
  13124. // Redefine the child widget using the same prototype that was
  13125. // originally used, but inherit from the new version of the base
  13126. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  13127. });
  13128. // Remove the list of existing child constructors from the old constructor
  13129. // so the old child constructors can be garbage collected
  13130. delete existingConstructor._childConstructors;
  13131. } else {
  13132. base._childConstructors.push(constructor);
  13133. }
  13134. $.widget.bridge(name, constructor);
  13135. return constructor;
  13136. };
  13137. $.widget.extend = function (target) {
  13138. var input = widgetSlice.call(arguments, 1);
  13139. var inputIndex = 0;
  13140. var inputLength = input.length;
  13141. var key;
  13142. var value;
  13143. for (; inputIndex < inputLength; inputIndex++) {
  13144. for (key in input[inputIndex]) {
  13145. value = input[inputIndex][key];
  13146. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  13147. // Clone objects
  13148. if ($.isPlainObject(value)) {
  13149. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  13150. // Don't extend strings, arrays, etc. with objects
  13151. $.widget.extend({}, value);
  13152. // Copy everything else by reference
  13153. } else {
  13154. target[key] = value;
  13155. }
  13156. }
  13157. }
  13158. }
  13159. return target;
  13160. };
  13161. $.widget.bridge = function (name, object) {
  13162. var fullName = object.prototype.widgetFullName || name;
  13163. $.fn[name] = function (options) {
  13164. var isMethodCall = typeof options === "string";
  13165. var args = widgetSlice.call(arguments, 1);
  13166. var returnValue = this;
  13167. if (isMethodCall) {
  13168. // If this is an empty collection, we need to have the instance method
  13169. // return undefined instead of the jQuery instance
  13170. if (!this.length && options === "instance") {
  13171. returnValue = undefined;
  13172. } else {
  13173. this.each(function () {
  13174. var methodValue;
  13175. var instance = $.data(this, fullName);
  13176. if (options === "instance") {
  13177. returnValue = instance;
  13178. return false;
  13179. }
  13180. if (!instance) {
  13181. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  13182. }
  13183. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  13184. return $.error("no such method '" + options + "' for " + name + " widget instance");
  13185. }
  13186. methodValue = instance[options].apply(instance, args);
  13187. if (methodValue !== instance && methodValue !== undefined) {
  13188. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  13189. return false;
  13190. }
  13191. });
  13192. }
  13193. } else {
  13194. // Allow multiple hashes to be passed on init
  13195. if (args.length) {
  13196. options = $.widget.extend.apply(null, [options].concat(args));
  13197. }
  13198. this.each(function () {
  13199. var instance = $.data(this, fullName);
  13200. if (instance) {
  13201. instance.option(options || {});
  13202. if (instance._init) {
  13203. instance._init();
  13204. }
  13205. } else {
  13206. $.data(this, fullName, new object(options, this));
  13207. }
  13208. });
  13209. }
  13210. return returnValue;
  13211. };
  13212. };
  13213. $.Widget = function () /* options, element */{};
  13214. $.Widget._childConstructors = [];
  13215. $.Widget.prototype = {
  13216. widgetName: "widget",
  13217. widgetEventPrefix: "",
  13218. defaultElement: "<div>",
  13219. options: {
  13220. classes: {},
  13221. disabled: false,
  13222. // Callbacks
  13223. create: null
  13224. },
  13225. _createWidget: function _createWidget(options, element) {
  13226. element = $(element || this.defaultElement || this)[0];
  13227. this.element = $(element);
  13228. this.uuid = widgetUuid++;
  13229. this.eventNamespace = "." + this.widgetName + this.uuid;
  13230. this.bindings = $();
  13231. this.hoverable = $();
  13232. this.focusable = $();
  13233. this.classesElementLookup = {};
  13234. if (element !== this) {
  13235. $.data(element, this.widgetFullName, this);
  13236. this._on(true, this.element, {
  13237. remove: function remove(event) {
  13238. if (event.target === element) {
  13239. this.destroy();
  13240. }
  13241. }
  13242. });
  13243. this.document = $(element.style ?
  13244. // Element within the document
  13245. element.ownerDocument :
  13246. // Element is window or document
  13247. element.document || element);
  13248. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  13249. }
  13250. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  13251. this._create();
  13252. if (this.options.disabled) {
  13253. this._setOptionDisabled(this.options.disabled);
  13254. }
  13255. this._trigger("create", null, this._getCreateEventData());
  13256. this._init();
  13257. },
  13258. _getCreateOptions: function _getCreateOptions() {
  13259. return {};
  13260. },
  13261. _getCreateEventData: $.noop,
  13262. _create: $.noop,
  13263. _init: $.noop,
  13264. destroy: function destroy() {
  13265. var that = this;
  13266. this._destroy();
  13267. $.each(this.classesElementLookup, function (key, value) {
  13268. that._removeClass(value, key);
  13269. });
  13270. // We can probably remove the unbind calls in 2.0
  13271. // all event bindings should go through this._on()
  13272. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  13273. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  13274. // Clean up events and states
  13275. this.bindings.off(this.eventNamespace);
  13276. },
  13277. _destroy: $.noop,
  13278. widget: function widget() {
  13279. return this.element;
  13280. },
  13281. option: function option(key, value) {
  13282. var options = key;
  13283. var parts;
  13284. var curOption;
  13285. var i;
  13286. if (arguments.length === 0) {
  13287. // Don't return a reference to the internal hash
  13288. return $.widget.extend({}, this.options);
  13289. }
  13290. if (typeof key === "string") {
  13291. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  13292. options = {};
  13293. parts = key.split(".");
  13294. key = parts.shift();
  13295. if (parts.length) {
  13296. curOption = options[key] = $.widget.extend({}, this.options[key]);
  13297. for (i = 0; i < parts.length - 1; i++) {
  13298. curOption[parts[i]] = curOption[parts[i]] || {};
  13299. curOption = curOption[parts[i]];
  13300. }
  13301. key = parts.pop();
  13302. if (arguments.length === 1) {
  13303. return curOption[key] === undefined ? null : curOption[key];
  13304. }
  13305. curOption[key] = value;
  13306. } else {
  13307. if (arguments.length === 1) {
  13308. return this.options[key] === undefined ? null : this.options[key];
  13309. }
  13310. options[key] = value;
  13311. }
  13312. }
  13313. this._setOptions(options);
  13314. return this;
  13315. },
  13316. _setOptions: function _setOptions(options) {
  13317. var key;
  13318. for (key in options) {
  13319. this._setOption(key, options[key]);
  13320. }
  13321. return this;
  13322. },
  13323. _setOption: function _setOption(key, value) {
  13324. if (key === "classes") {
  13325. this._setOptionClasses(value);
  13326. }
  13327. this.options[key] = value;
  13328. if (key === "disabled") {
  13329. this._setOptionDisabled(value);
  13330. }
  13331. return this;
  13332. },
  13333. _setOptionClasses: function _setOptionClasses(value) {
  13334. var classKey, elements, currentElements;
  13335. for (classKey in value) {
  13336. currentElements = this.classesElementLookup[classKey];
  13337. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  13338. continue;
  13339. }
  13340. // We are doing this to create a new jQuery object because the _removeClass() call
  13341. // on the next line is going to destroy the reference to the current elements being
  13342. // tracked. We need to save a copy of this collection so that we can add the new classes
  13343. // below.
  13344. elements = $(currentElements.get());
  13345. this._removeClass(currentElements, classKey);
  13346. // We don't use _addClass() here, because that uses this.options.classes
  13347. // for generating the string of classes. We want to use the value passed in from
  13348. // _setOption(), this is the new value of the classes option which was passed to
  13349. // _setOption(). We pass this value directly to _classes().
  13350. elements.addClass(this._classes({
  13351. element: elements,
  13352. keys: classKey,
  13353. classes: value,
  13354. add: true
  13355. }));
  13356. }
  13357. },
  13358. _setOptionDisabled: function _setOptionDisabled(value) {
  13359. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  13360. // If the widget is becoming disabled, then nothing is interactive
  13361. if (value) {
  13362. this._removeClass(this.hoverable, null, "ui-state-hover");
  13363. this._removeClass(this.focusable, null, "ui-state-focus");
  13364. }
  13365. },
  13366. enable: function enable() {
  13367. return this._setOptions({ disabled: false });
  13368. },
  13369. disable: function disable() {
  13370. return this._setOptions({ disabled: true });
  13371. },
  13372. _classes: function _classes(options) {
  13373. var full = [];
  13374. var that = this;
  13375. options = $.extend({
  13376. element: this.element,
  13377. classes: this.options.classes || {}
  13378. }, options);
  13379. function processClassString(classes, checkOption) {
  13380. var current, i;
  13381. for (i = 0; i < classes.length; i++) {
  13382. current = that.classesElementLookup[classes[i]] || $();
  13383. if (options.add) {
  13384. current = $($.unique(current.get().concat(options.element.get())));
  13385. } else {
  13386. current = $(current.not(options.element).get());
  13387. }
  13388. that.classesElementLookup[classes[i]] = current;
  13389. full.push(classes[i]);
  13390. if (checkOption && options.classes[classes[i]]) {
  13391. full.push(options.classes[classes[i]]);
  13392. }
  13393. }
  13394. }
  13395. this._on(options.element, {
  13396. "remove": "_untrackClassesElement"
  13397. });
  13398. if (options.keys) {
  13399. processClassString(options.keys.match(/\S+/g) || [], true);
  13400. }
  13401. if (options.extra) {
  13402. processClassString(options.extra.match(/\S+/g) || []);
  13403. }
  13404. return full.join(" ");
  13405. },
  13406. _untrackClassesElement: function _untrackClassesElement(event) {
  13407. var that = this;
  13408. $.each(that.classesElementLookup, function (key, value) {
  13409. if ($.inArray(event.target, value) !== -1) {
  13410. that.classesElementLookup[key] = $(value.not(event.target).get());
  13411. }
  13412. });
  13413. },
  13414. _removeClass: function _removeClass(element, keys, extra) {
  13415. return this._toggleClass(element, keys, extra, false);
  13416. },
  13417. _addClass: function _addClass(element, keys, extra) {
  13418. return this._toggleClass(element, keys, extra, true);
  13419. },
  13420. _toggleClass: function _toggleClass(element, keys, extra, add) {
  13421. add = typeof add === "boolean" ? add : extra;
  13422. var shift = typeof element === "string" || element === null,
  13423. options = {
  13424. extra: shift ? keys : extra,
  13425. keys: shift ? element : keys,
  13426. element: shift ? this.element : element,
  13427. add: add
  13428. };
  13429. options.element.toggleClass(this._classes(options), add);
  13430. return this;
  13431. },
  13432. _on: function _on(suppressDisabledCheck, element, handlers) {
  13433. var delegateElement;
  13434. var instance = this;
  13435. // No suppressDisabledCheck flag, shuffle arguments
  13436. if (typeof suppressDisabledCheck !== "boolean") {
  13437. handlers = element;
  13438. element = suppressDisabledCheck;
  13439. suppressDisabledCheck = false;
  13440. }
  13441. // No element argument, shuffle and use this.element
  13442. if (!handlers) {
  13443. handlers = element;
  13444. element = this.element;
  13445. delegateElement = this.widget();
  13446. } else {
  13447. element = delegateElement = $(element);
  13448. this.bindings = this.bindings.add(element);
  13449. }
  13450. $.each(handlers, function (event, handler) {
  13451. function handlerProxy() {
  13452. // Allow widgets to customize the disabled handling
  13453. // - disabled as an array instead of boolean
  13454. // - disabled class as method for disabling individual parts
  13455. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  13456. return;
  13457. }
  13458. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13459. }
  13460. // Copy the guid so direct unbinding works
  13461. if (typeof handler !== "string") {
  13462. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  13463. }
  13464. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  13465. var eventName = match[1] + instance.eventNamespace;
  13466. var selector = match[2];
  13467. if (selector) {
  13468. delegateElement.on(eventName, selector, handlerProxy);
  13469. } else {
  13470. element.on(eventName, handlerProxy);
  13471. }
  13472. });
  13473. },
  13474. _off: function _off(element, eventName) {
  13475. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  13476. element.off(eventName).off(eventName);
  13477. // Clear the stack to avoid memory leaks (#10056)
  13478. this.bindings = $(this.bindings.not(element).get());
  13479. this.focusable = $(this.focusable.not(element).get());
  13480. this.hoverable = $(this.hoverable.not(element).get());
  13481. },
  13482. _delay: function _delay(handler, delay) {
  13483. function handlerProxy() {
  13484. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13485. }
  13486. var instance = this;
  13487. return setTimeout(handlerProxy, delay || 0);
  13488. },
  13489. _hoverable: function _hoverable(element) {
  13490. this.hoverable = this.hoverable.add(element);
  13491. this._on(element, {
  13492. mouseenter: function mouseenter(event) {
  13493. this._addClass($(event.currentTarget), null, "ui-state-hover");
  13494. },
  13495. mouseleave: function mouseleave(event) {
  13496. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  13497. }
  13498. });
  13499. },
  13500. _focusable: function _focusable(element) {
  13501. this.focusable = this.focusable.add(element);
  13502. this._on(element, {
  13503. focusin: function focusin(event) {
  13504. this._addClass($(event.currentTarget), null, "ui-state-focus");
  13505. },
  13506. focusout: function focusout(event) {
  13507. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  13508. }
  13509. });
  13510. },
  13511. _trigger: function _trigger(type, event, data) {
  13512. var prop, orig;
  13513. var callback = this.options[type];
  13514. data = data || {};
  13515. event = $.Event(event);
  13516. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  13517. // The original event may come from any element
  13518. // so we need to reset the target on the new event
  13519. event.target = this.element[0];
  13520. // Copy original event properties over to the new event
  13521. orig = event.originalEvent;
  13522. if (orig) {
  13523. for (prop in orig) {
  13524. if (!(prop in event)) {
  13525. event[prop] = orig[prop];
  13526. }
  13527. }
  13528. }
  13529. this.element.trigger(event, data);
  13530. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  13531. }
  13532. };
  13533. $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
  13534. $.Widget.prototype["_" + method] = function (element, options, callback) {
  13535. if (typeof options === "string") {
  13536. options = { effect: options };
  13537. }
  13538. var hasOptions;
  13539. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  13540. options = options || {};
  13541. if (typeof options === "number") {
  13542. options = { duration: options };
  13543. }
  13544. hasOptions = !$.isEmptyObject(options);
  13545. options.complete = callback;
  13546. if (options.delay) {
  13547. element.delay(options.delay);
  13548. }
  13549. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  13550. element[method](options);
  13551. } else if (effectName !== method && element[effectName]) {
  13552. element[effectName](options.duration, options.easing, callback);
  13553. } else {
  13554. element.queue(function (next) {
  13555. $(this)[method]();
  13556. if (callback) {
  13557. callback.call(element[0]);
  13558. }
  13559. next();
  13560. });
  13561. }
  13562. };
  13563. });
  13564. var widget = $.widget;
  13565. /*!
  13566. * jQuery UI Keycode 1.12.1
  13567. * http://jqueryui.com
  13568. *
  13569. * Copyright jQuery Foundation and other contributors
  13570. * Released under the MIT license.
  13571. * http://jquery.org/license
  13572. */
  13573. //>>label: Keycode
  13574. //>>group: Core
  13575. //>>description: Provide keycodes as keynames
  13576. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  13577. var keycode = $.ui.keyCode = {
  13578. BACKSPACE: 8,
  13579. COMMA: 188,
  13580. DELETE: 46,
  13581. DOWN: 40,
  13582. END: 35,
  13583. ENTER: 13,
  13584. ESCAPE: 27,
  13585. HOME: 36,
  13586. LEFT: 37,
  13587. PAGE_DOWN: 34,
  13588. PAGE_UP: 33,
  13589. PERIOD: 190,
  13590. RIGHT: 39,
  13591. SPACE: 32,
  13592. TAB: 9,
  13593. UP: 38
  13594. };
  13595. // This file is deprecated
  13596. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  13597. /*!
  13598. * jQuery UI Mouse 1.12.1
  13599. * http://jqueryui.com
  13600. *
  13601. * Copyright jQuery Foundation and other contributors
  13602. * Released under the MIT license.
  13603. * http://jquery.org/license
  13604. */
  13605. //>>label: Mouse
  13606. //>>group: Widgets
  13607. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  13608. //>>docs: http://api.jqueryui.com/mouse/
  13609. var mouseHandled = false;
  13610. $(document).on("mouseup", function () {
  13611. mouseHandled = false;
  13612. });
  13613. var widgetsMouse = $.widget("ui.mouse", {
  13614. version: "1.12.1",
  13615. options: {
  13616. cancel: "input, textarea, button, select, option",
  13617. distance: 1,
  13618. delay: 0
  13619. },
  13620. _mouseInit: function _mouseInit() {
  13621. var that = this;
  13622. this.element.on("mousedown." + this.widgetName, function (event) {
  13623. return that._mouseDown(event);
  13624. }).on("click." + this.widgetName, function (event) {
  13625. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  13626. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  13627. event.stopImmediatePropagation();
  13628. return false;
  13629. }
  13630. });
  13631. this.started = false;
  13632. },
  13633. // TODO: make sure destroying one instance of mouse doesn't mess with
  13634. // other instances of mouse
  13635. _mouseDestroy: function _mouseDestroy() {
  13636. this.element.off("." + this.widgetName);
  13637. if (this._mouseMoveDelegate) {
  13638. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13639. }
  13640. },
  13641. _mouseDown: function _mouseDown(event) {
  13642. // don't let more than one widget handle mouseStart
  13643. if (mouseHandled) {
  13644. return;
  13645. }
  13646. this._mouseMoved = false;
  13647. // We may have missed mouseup (out of window)
  13648. this._mouseStarted && this._mouseUp(event);
  13649. this._mouseDownEvent = event;
  13650. var that = this,
  13651. btnIsLeft = event.which === 1,
  13652. // event.target.nodeName works around a bug in IE 8 with
  13653. // disabled inputs (#7620)
  13654. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  13655. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  13656. return true;
  13657. }
  13658. this.mouseDelayMet = !this.options.delay;
  13659. if (!this.mouseDelayMet) {
  13660. this._mouseDelayTimer = setTimeout(function () {
  13661. that.mouseDelayMet = true;
  13662. }, this.options.delay);
  13663. }
  13664. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13665. this._mouseStarted = this._mouseStart(event) !== false;
  13666. if (!this._mouseStarted) {
  13667. event.preventDefault();
  13668. return true;
  13669. }
  13670. }
  13671. // Click event may never have fired (Gecko & Opera)
  13672. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  13673. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  13674. }
  13675. // These delegates are required to keep context
  13676. this._mouseMoveDelegate = function (event) {
  13677. return that._mouseMove(event);
  13678. };
  13679. this._mouseUpDelegate = function (event) {
  13680. return that._mouseUp(event);
  13681. };
  13682. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  13683. event.preventDefault();
  13684. mouseHandled = true;
  13685. return true;
  13686. },
  13687. _mouseMove: function _mouseMove(event) {
  13688. // Only check for mouseups outside the document if you've moved inside the document
  13689. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  13690. // fire a mousemove event if content is placed under the cursor. See #7778
  13691. // Support: IE <9
  13692. if (this._mouseMoved) {
  13693. // IE mouseup check - mouseup happened when mouse was out of window
  13694. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  13695. return this._mouseUp(event);
  13696. // Iframe mouseup check - mouseup occurred in another document
  13697. } else if (!event.which) {
  13698. // Support: Safari <=8 - 9
  13699. // Safari sets which to 0 if you press any of the following keys
  13700. // during a drag (#14461)
  13701. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  13702. this.ignoreMissingWhich = true;
  13703. } else if (!this.ignoreMissingWhich) {
  13704. return this._mouseUp(event);
  13705. }
  13706. }
  13707. }
  13708. if (event.which || event.button) {
  13709. this._mouseMoved = true;
  13710. }
  13711. if (this._mouseStarted) {
  13712. this._mouseDrag(event);
  13713. return event.preventDefault();
  13714. }
  13715. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13716. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  13717. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  13718. }
  13719. return !this._mouseStarted;
  13720. },
  13721. _mouseUp: function _mouseUp(event) {
  13722. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13723. if (this._mouseStarted) {
  13724. this._mouseStarted = false;
  13725. if (event.target === this._mouseDownEvent.target) {
  13726. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  13727. }
  13728. this._mouseStop(event);
  13729. }
  13730. if (this._mouseDelayTimer) {
  13731. clearTimeout(this._mouseDelayTimer);
  13732. delete this._mouseDelayTimer;
  13733. }
  13734. this.ignoreMissingWhich = false;
  13735. mouseHandled = false;
  13736. event.preventDefault();
  13737. },
  13738. _mouseDistanceMet: function _mouseDistanceMet(event) {
  13739. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  13740. },
  13741. _mouseDelayMet: function _mouseDelayMet() /* event */{
  13742. return this.mouseDelayMet;
  13743. },
  13744. // These are placeholder methods, to be overriden by extending plugin
  13745. _mouseStart: function _mouseStart() /* event */{},
  13746. _mouseDrag: function _mouseDrag() /* event */{},
  13747. _mouseStop: function _mouseStop() /* event */{},
  13748. _mouseCapture: function _mouseCapture() /* event */{
  13749. return true;
  13750. }
  13751. });
  13752. /*!
  13753. * jQuery UI Slider 1.12.1
  13754. * http://jqueryui.com
  13755. *
  13756. * Copyright jQuery Foundation and other contributors
  13757. * Released under the MIT license.
  13758. * http://jquery.org/license
  13759. */
  13760. //>>label: Slider
  13761. //>>group: Widgets
  13762. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  13763. //>>docs: http://api.jqueryui.com/slider/
  13764. //>>demos: http://jqueryui.com/slider/
  13765. //>>css.structure: ../../themes/base/core.css
  13766. //>>css.structure: ../../themes/base/slider.css
  13767. //>>css.theme: ../../themes/base/theme.css
  13768. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  13769. version: "1.12.1",
  13770. widgetEventPrefix: "slide",
  13771. options: {
  13772. animate: false,
  13773. classes: {
  13774. "ui-slider": "ui-corner-all",
  13775. "ui-slider-handle": "ui-corner-all",
  13776. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  13777. // element, but worked best visually with a variety of themes
  13778. "ui-slider-range": "ui-corner-all ui-widget-header"
  13779. },
  13780. distance: 0,
  13781. max: 100,
  13782. min: 0,
  13783. orientation: "horizontal",
  13784. range: false,
  13785. step: 1,
  13786. value: 0,
  13787. values: null,
  13788. // Callbacks
  13789. change: null,
  13790. slide: null,
  13791. start: null,
  13792. stop: null
  13793. },
  13794. // Number of pages in a slider
  13795. // (how many times can you page up/down to go through the whole range)
  13796. numPages: 5,
  13797. _create: function _create() {
  13798. this._keySliding = false;
  13799. this._mouseSliding = false;
  13800. this._animateOff = true;
  13801. this._handleIndex = null;
  13802. this._detectOrientation();
  13803. this._mouseInit();
  13804. this._calculateNewMax();
  13805. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  13806. this._refresh();
  13807. this._animateOff = false;
  13808. },
  13809. _refresh: function _refresh() {
  13810. this._createRange();
  13811. this._createHandles();
  13812. this._setupEvents();
  13813. this._refreshValue();
  13814. },
  13815. _createHandles: function _createHandles() {
  13816. var i,
  13817. handleCount,
  13818. options = this.options,
  13819. existingHandles = this.element.find(".ui-slider-handle"),
  13820. handle = "<span tabindex='0'></span>",
  13821. handles = [];
  13822. handleCount = options.values && options.values.length || 1;
  13823. if (existingHandles.length > handleCount) {
  13824. existingHandles.slice(handleCount).remove();
  13825. existingHandles = existingHandles.slice(0, handleCount);
  13826. }
  13827. for (i = existingHandles.length; i < handleCount; i++) {
  13828. handles.push(handle);
  13829. }
  13830. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  13831. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  13832. this.handle = this.handles.eq(0);
  13833. this.handles.each(function (i) {
  13834. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  13835. });
  13836. },
  13837. _createRange: function _createRange() {
  13838. var options = this.options;
  13839. if (options.range) {
  13840. if (options.range === true) {
  13841. if (!options.values) {
  13842. options.values = [this._valueMin(), this._valueMin()];
  13843. } else if (options.values.length && options.values.length !== 2) {
  13844. options.values = [options.values[0], options.values[0]];
  13845. } else if ($.isArray(options.values)) {
  13846. options.values = options.values.slice(0);
  13847. }
  13848. }
  13849. if (!this.range || !this.range.length) {
  13850. this.range = $("<div>").appendTo(this.element);
  13851. this._addClass(this.range, "ui-slider-range");
  13852. } else {
  13853. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  13854. // Handle range switching from true to min/max
  13855. this.range.css({
  13856. "left": "",
  13857. "bottom": ""
  13858. });
  13859. }
  13860. if (options.range === "min" || options.range === "max") {
  13861. this._addClass(this.range, "ui-slider-range-" + options.range);
  13862. }
  13863. } else {
  13864. if (this.range) {
  13865. this.range.remove();
  13866. }
  13867. this.range = null;
  13868. }
  13869. },
  13870. _setupEvents: function _setupEvents() {
  13871. this._off(this.handles);
  13872. this._on(this.handles, this._handleEvents);
  13873. this._hoverable(this.handles);
  13874. this._focusable(this.handles);
  13875. },
  13876. _destroy: function _destroy() {
  13877. this.handles.remove();
  13878. if (this.range) {
  13879. this.range.remove();
  13880. }
  13881. this._mouseDestroy();
  13882. },
  13883. _mouseCapture: function _mouseCapture(event) {
  13884. var position,
  13885. normValue,
  13886. distance,
  13887. closestHandle,
  13888. index,
  13889. allowed,
  13890. offset,
  13891. mouseOverHandle,
  13892. that = this,
  13893. o = this.options;
  13894. if (o.disabled) {
  13895. return false;
  13896. }
  13897. this.elementSize = {
  13898. width: this.element.outerWidth(),
  13899. height: this.element.outerHeight()
  13900. };
  13901. this.elementOffset = this.element.offset();
  13902. position = { x: event.pageX, y: event.pageY };
  13903. normValue = this._normValueFromMouse(position);
  13904. distance = this._valueMax() - this._valueMin() + 1;
  13905. this.handles.each(function (i) {
  13906. var thisDistance = Math.abs(normValue - that.values(i));
  13907. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  13908. distance = thisDistance;
  13909. closestHandle = $(this);
  13910. index = i;
  13911. }
  13912. });
  13913. allowed = this._start(event, index);
  13914. if (allowed === false) {
  13915. return false;
  13916. }
  13917. this._mouseSliding = true;
  13918. this._handleIndex = index;
  13919. this._addClass(closestHandle, null, "ui-state-active");
  13920. closestHandle.trigger("focus");
  13921. offset = closestHandle.offset();
  13922. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  13923. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  13924. left: event.pageX - offset.left - closestHandle.width() / 2,
  13925. top: event.pageY - offset.top - closestHandle.height() / 2 - (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + (parseInt(closestHandle.css("marginTop"), 10) || 0)
  13926. };
  13927. if (!this.handles.hasClass("ui-state-hover")) {
  13928. this._slide(event, index, normValue);
  13929. }
  13930. this._animateOff = true;
  13931. return true;
  13932. },
  13933. _mouseStart: function _mouseStart() {
  13934. return true;
  13935. },
  13936. _mouseDrag: function _mouseDrag(event) {
  13937. var position = { x: event.pageX, y: event.pageY },
  13938. normValue = this._normValueFromMouse(position);
  13939. this._slide(event, this._handleIndex, normValue);
  13940. return false;
  13941. },
  13942. _mouseStop: function _mouseStop(event) {
  13943. this._removeClass(this.handles, null, "ui-state-active");
  13944. this._mouseSliding = false;
  13945. this._stop(event, this._handleIndex);
  13946. this._change(event, this._handleIndex);
  13947. this._handleIndex = null;
  13948. this._clickOffset = null;
  13949. this._animateOff = false;
  13950. return false;
  13951. },
  13952. _detectOrientation: function _detectOrientation() {
  13953. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  13954. },
  13955. _normValueFromMouse: function _normValueFromMouse(position) {
  13956. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  13957. if (this.orientation === "horizontal") {
  13958. pixelTotal = this.elementSize.width;
  13959. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  13960. } else {
  13961. pixelTotal = this.elementSize.height;
  13962. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  13963. }
  13964. percentMouse = pixelMouse / pixelTotal;
  13965. if (percentMouse > 1) {
  13966. percentMouse = 1;
  13967. }
  13968. if (percentMouse < 0) {
  13969. percentMouse = 0;
  13970. }
  13971. if (this.orientation === "vertical") {
  13972. percentMouse = 1 - percentMouse;
  13973. }
  13974. valueTotal = this._valueMax() - this._valueMin();
  13975. valueMouse = this._valueMin() + percentMouse * valueTotal;
  13976. return this._trimAlignValue(valueMouse);
  13977. },
  13978. _uiHash: function _uiHash(index, value, values) {
  13979. var uiHash = {
  13980. handle: this.handles[index],
  13981. handleIndex: index,
  13982. value: value !== undefined ? value : this.value()
  13983. };
  13984. if (this._hasMultipleValues()) {
  13985. uiHash.value = value !== undefined ? value : this.values(index);
  13986. uiHash.values = values || this.values();
  13987. }
  13988. return uiHash;
  13989. },
  13990. _hasMultipleValues: function _hasMultipleValues() {
  13991. return this.options.values && this.options.values.length;
  13992. },
  13993. _start: function _start(event, index) {
  13994. return this._trigger("start", event, this._uiHash(index));
  13995. },
  13996. _slide: function _slide(event, index, newVal) {
  13997. var allowed,
  13998. otherVal,
  13999. currentValue = this.value(),
  14000. newValues = this.values();
  14001. if (this._hasMultipleValues()) {
  14002. otherVal = this.values(index ? 0 : 1);
  14003. currentValue = this.values(index);
  14004. if (this.options.values.length === 2 && this.options.range === true) {
  14005. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  14006. }
  14007. newValues[index] = newVal;
  14008. }
  14009. if (newVal === currentValue) {
  14010. return;
  14011. }
  14012. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  14013. // A slide can be canceled by returning false from the slide callback
  14014. if (allowed === false) {
  14015. return;
  14016. }
  14017. if (this._hasMultipleValues()) {
  14018. this.values(index, newVal);
  14019. } else {
  14020. this.value(newVal);
  14021. }
  14022. },
  14023. _stop: function _stop(event, index) {
  14024. this._trigger("stop", event, this._uiHash(index));
  14025. },
  14026. _change: function _change(event, index) {
  14027. if (!this._keySliding && !this._mouseSliding) {
  14028. //store the last changed value index for reference when handles overlap
  14029. this._lastChangedValue = index;
  14030. this._trigger("change", event, this._uiHash(index));
  14031. }
  14032. },
  14033. value: function value(newValue) {
  14034. if (arguments.length) {
  14035. this.options.value = this._trimAlignValue(newValue);
  14036. this._refreshValue();
  14037. this._change(null, 0);
  14038. return;
  14039. }
  14040. return this._value();
  14041. },
  14042. values: function values(index, newValue) {
  14043. var vals, newValues, i;
  14044. if (arguments.length > 1) {
  14045. this.options.values[index] = this._trimAlignValue(newValue);
  14046. this._refreshValue();
  14047. this._change(null, index);
  14048. return;
  14049. }
  14050. if (arguments.length) {
  14051. if ($.isArray(arguments[0])) {
  14052. vals = this.options.values;
  14053. newValues = arguments[0];
  14054. for (i = 0; i < vals.length; i += 1) {
  14055. vals[i] = this._trimAlignValue(newValues[i]);
  14056. this._change(null, i);
  14057. }
  14058. this._refreshValue();
  14059. } else {
  14060. if (this._hasMultipleValues()) {
  14061. return this._values(index);
  14062. } else {
  14063. return this.value();
  14064. }
  14065. }
  14066. } else {
  14067. return this._values();
  14068. }
  14069. },
  14070. _setOption: function _setOption(key, value) {
  14071. var i,
  14072. valsLength = 0;
  14073. if (key === "range" && this.options.range === true) {
  14074. if (value === "min") {
  14075. this.options.value = this._values(0);
  14076. this.options.values = null;
  14077. } else if (value === "max") {
  14078. this.options.value = this._values(this.options.values.length - 1);
  14079. this.options.values = null;
  14080. }
  14081. }
  14082. if ($.isArray(this.options.values)) {
  14083. valsLength = this.options.values.length;
  14084. }
  14085. this._super(key, value);
  14086. switch (key) {
  14087. case "orientation":
  14088. this._detectOrientation();
  14089. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  14090. this._refreshValue();
  14091. if (this.options.range) {
  14092. this._refreshRange(value);
  14093. }
  14094. // Reset positioning from previous orientation
  14095. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  14096. break;
  14097. case "value":
  14098. this._animateOff = true;
  14099. this._refreshValue();
  14100. this._change(null, 0);
  14101. this._animateOff = false;
  14102. break;
  14103. case "values":
  14104. this._animateOff = true;
  14105. this._refreshValue();
  14106. // Start from the last handle to prevent unreachable handles (#9046)
  14107. for (i = valsLength - 1; i >= 0; i--) {
  14108. this._change(null, i);
  14109. }
  14110. this._animateOff = false;
  14111. break;
  14112. case "step":
  14113. case "min":
  14114. case "max":
  14115. this._animateOff = true;
  14116. this._calculateNewMax();
  14117. this._refreshValue();
  14118. this._animateOff = false;
  14119. break;
  14120. case "range":
  14121. this._animateOff = true;
  14122. this._refresh();
  14123. this._animateOff = false;
  14124. break;
  14125. }
  14126. },
  14127. _setOptionDisabled: function _setOptionDisabled(value) {
  14128. this._super(value);
  14129. this._toggleClass(null, "ui-state-disabled", !!value);
  14130. },
  14131. //internal value getter
  14132. // _value() returns value trimmed by min and max, aligned by step
  14133. _value: function _value() {
  14134. var val = this.options.value;
  14135. val = this._trimAlignValue(val);
  14136. return val;
  14137. },
  14138. //internal values getter
  14139. // _values() returns array of values trimmed by min and max, aligned by step
  14140. // _values( index ) returns single value trimmed by min and max, aligned by step
  14141. _values: function _values(index) {
  14142. var val, vals, i;
  14143. if (arguments.length) {
  14144. val = this.options.values[index];
  14145. val = this._trimAlignValue(val);
  14146. return val;
  14147. } else if (this._hasMultipleValues()) {
  14148. // .slice() creates a copy of the array
  14149. // this copy gets trimmed by min and max and then returned
  14150. vals = this.options.values.slice();
  14151. for (i = 0; i < vals.length; i += 1) {
  14152. vals[i] = this._trimAlignValue(vals[i]);
  14153. }
  14154. return vals;
  14155. } else {
  14156. return [];
  14157. }
  14158. },
  14159. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  14160. _trimAlignValue: function _trimAlignValue(val) {
  14161. if (val <= this._valueMin()) {
  14162. return this._valueMin();
  14163. }
  14164. if (val >= this._valueMax()) {
  14165. return this._valueMax();
  14166. }
  14167. var step = this.options.step > 0 ? this.options.step : 1,
  14168. valModStep = (val - this._valueMin()) % step,
  14169. alignValue = val - valModStep;
  14170. if (Math.abs(valModStep) * 2 >= step) {
  14171. alignValue += valModStep > 0 ? step : -step;
  14172. }
  14173. // Since JavaScript has problems with large floats, round
  14174. // the final value to 5 digits after the decimal point (see #4124)
  14175. return parseFloat(alignValue.toFixed(5));
  14176. },
  14177. _calculateNewMax: function _calculateNewMax() {
  14178. var max = this.options.max,
  14179. min = this._valueMin(),
  14180. step = this.options.step,
  14181. aboveMin = Math.round((max - min) / step) * step;
  14182. max = aboveMin + min;
  14183. if (max > this.options.max) {
  14184. //If max is not divisible by step, rounding off may increase its value
  14185. max -= step;
  14186. }
  14187. this.max = parseFloat(max.toFixed(this._precision()));
  14188. },
  14189. _precision: function _precision() {
  14190. var precision = this._precisionOf(this.options.step);
  14191. if (this.options.min !== null) {
  14192. precision = Math.max(precision, this._precisionOf(this.options.min));
  14193. }
  14194. return precision;
  14195. },
  14196. _precisionOf: function _precisionOf(num) {
  14197. var str = num.toString(),
  14198. decimal = str.indexOf(".");
  14199. return decimal === -1 ? 0 : str.length - decimal - 1;
  14200. },
  14201. _valueMin: function _valueMin() {
  14202. return this.options.min;
  14203. },
  14204. _valueMax: function _valueMax() {
  14205. return this.max;
  14206. },
  14207. _refreshRange: function _refreshRange(orientation) {
  14208. if (orientation === "vertical") {
  14209. this.range.css({ "width": "", "left": "" });
  14210. }
  14211. if (orientation === "horizontal") {
  14212. this.range.css({ "height": "", "bottom": "" });
  14213. }
  14214. },
  14215. _refreshValue: function _refreshValue() {
  14216. var lastValPercent,
  14217. valPercent,
  14218. value,
  14219. valueMin,
  14220. valueMax,
  14221. oRange = this.options.range,
  14222. o = this.options,
  14223. that = this,
  14224. animate = !this._animateOff ? o.animate : false,
  14225. _set = {};
  14226. if (this._hasMultipleValues()) {
  14227. this.handles.each(function (i) {
  14228. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  14229. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14230. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14231. if (that.options.range === true) {
  14232. if (that.orientation === "horizontal") {
  14233. if (i === 0) {
  14234. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14235. left: valPercent + "%"
  14236. }, o.animate);
  14237. }
  14238. if (i === 1) {
  14239. that.range[animate ? "animate" : "css"]({
  14240. width: valPercent - lastValPercent + "%"
  14241. }, {
  14242. queue: false,
  14243. duration: o.animate
  14244. });
  14245. }
  14246. } else {
  14247. if (i === 0) {
  14248. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14249. bottom: valPercent + "%"
  14250. }, o.animate);
  14251. }
  14252. if (i === 1) {
  14253. that.range[animate ? "animate" : "css"]({
  14254. height: valPercent - lastValPercent + "%"
  14255. }, {
  14256. queue: false,
  14257. duration: o.animate
  14258. });
  14259. }
  14260. }
  14261. }
  14262. lastValPercent = valPercent;
  14263. });
  14264. } else {
  14265. value = this.value();
  14266. valueMin = this._valueMin();
  14267. valueMax = this._valueMax();
  14268. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  14269. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14270. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14271. if (oRange === "min" && this.orientation === "horizontal") {
  14272. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14273. width: valPercent + "%"
  14274. }, o.animate);
  14275. }
  14276. if (oRange === "max" && this.orientation === "horizontal") {
  14277. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14278. width: 100 - valPercent + "%"
  14279. }, o.animate);
  14280. }
  14281. if (oRange === "min" && this.orientation === "vertical") {
  14282. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14283. height: valPercent + "%"
  14284. }, o.animate);
  14285. }
  14286. if (oRange === "max" && this.orientation === "vertical") {
  14287. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14288. height: 100 - valPercent + "%"
  14289. }, o.animate);
  14290. }
  14291. }
  14292. },
  14293. _handleEvents: {
  14294. keydown: function keydown(event) {
  14295. var allowed,
  14296. curVal,
  14297. newVal,
  14298. step,
  14299. index = $(event.target).data("ui-slider-handle-index");
  14300. switch (event.keyCode) {
  14301. case $.ui.keyCode.HOME:
  14302. case $.ui.keyCode.END:
  14303. case $.ui.keyCode.PAGE_UP:
  14304. case $.ui.keyCode.PAGE_DOWN:
  14305. case $.ui.keyCode.UP:
  14306. case $.ui.keyCode.RIGHT:
  14307. case $.ui.keyCode.DOWN:
  14308. case $.ui.keyCode.LEFT:
  14309. event.preventDefault();
  14310. if (!this._keySliding) {
  14311. this._keySliding = true;
  14312. this._addClass($(event.target), null, "ui-state-active");
  14313. allowed = this._start(event, index);
  14314. if (allowed === false) {
  14315. return;
  14316. }
  14317. }
  14318. break;
  14319. }
  14320. step = this.options.step;
  14321. if (this._hasMultipleValues()) {
  14322. curVal = newVal = this.values(index);
  14323. } else {
  14324. curVal = newVal = this.value();
  14325. }
  14326. switch (event.keyCode) {
  14327. case $.ui.keyCode.HOME:
  14328. newVal = this._valueMin();
  14329. break;
  14330. case $.ui.keyCode.END:
  14331. newVal = this._valueMax();
  14332. break;
  14333. case $.ui.keyCode.PAGE_UP:
  14334. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  14335. break;
  14336. case $.ui.keyCode.PAGE_DOWN:
  14337. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  14338. break;
  14339. case $.ui.keyCode.UP:
  14340. case $.ui.keyCode.RIGHT:
  14341. if (curVal === this._valueMax()) {
  14342. return;
  14343. }
  14344. newVal = this._trimAlignValue(curVal + step);
  14345. break;
  14346. case $.ui.keyCode.DOWN:
  14347. case $.ui.keyCode.LEFT:
  14348. if (curVal === this._valueMin()) {
  14349. return;
  14350. }
  14351. newVal = this._trimAlignValue(curVal - step);
  14352. break;
  14353. }
  14354. this._slide(event, index, newVal);
  14355. },
  14356. keyup: function keyup(event) {
  14357. var index = $(event.target).data("ui-slider-handle-index");
  14358. if (this._keySliding) {
  14359. this._keySliding = false;
  14360. this._stop(event, index);
  14361. this._change(event, index);
  14362. this._removeClass($(event.target), null, "ui-state-active");
  14363. }
  14364. }
  14365. }
  14366. });
  14367. });
  14368. /***/ }),
  14369. /* 33 */
  14370. /***/ (function(module, exports, __webpack_require__) {
  14371. "use strict";
  14372. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14373. 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; };
  14374. (function (global, factory) {
  14375. ( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14376. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14377. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14378. __WEBPACK_AMD_DEFINE_FACTORY__),
  14379. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  14380. })(undefined, function () {
  14381. 'use strict';
  14382. var _createClass = function () {
  14383. function defineProperties(target, props) {
  14384. for (var i = 0; i < props.length; i++) {
  14385. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  14386. }
  14387. }return function (Constructor, protoProps, staticProps) {
  14388. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14389. };
  14390. }();
  14391. function _classCallCheck(instance, Constructor) {
  14392. if (!(instance instanceof Constructor)) {
  14393. throw new TypeError("Cannot call a class as a function");
  14394. }
  14395. }
  14396. /**
  14397. * Sticky Sidebar JavaScript Plugin.
  14398. * @version 3.2.0
  14399. * @author Ahmed Bouhuolia <a.bouhuolia@gmail.com>
  14400. * @license The MIT License (MIT)
  14401. */
  14402. var StickySidebar = function () {
  14403. // ---------------------------------
  14404. // # Define Constants
  14405. // ---------------------------------
  14406. //
  14407. var EVENT_KEY = '.stickySidebar';
  14408. var DEFAULTS = {
  14409. /**
  14410. * Additional top spacing of the element when it becomes sticky.
  14411. * @type {Numeric|Function}
  14412. */
  14413. topSpacing: 0,
  14414. /**
  14415. * Additional bottom spacing of the element when it becomes sticky.
  14416. * @type {Numeric|Function}
  14417. */
  14418. bottomSpacing: 0,
  14419. /**
  14420. * Container sidebar selector to know what the beginning and end of sticky element.
  14421. * @type {String|False}
  14422. */
  14423. containerSelector: false,
  14424. /**
  14425. * Inner wrapper selector.
  14426. * @type {String}
  14427. */
  14428. innerWrapperSelector: '.inner-wrapper-sticky',
  14429. /**
  14430. * The name of CSS class to apply to elements when they have become stuck.
  14431. * @type {String|False}
  14432. */
  14433. stickyClass: 'is-affixed',
  14434. /**
  14435. * Detect when sidebar and its container change height so re-calculate their dimensions.
  14436. * @type {Boolean}
  14437. */
  14438. resizeSensor: true,
  14439. /**
  14440. * The sidebar returns to its normal position if its width below this value.
  14441. * @type {Numeric}
  14442. */
  14443. minWidth: false
  14444. };
  14445. // ---------------------------------
  14446. // # Class Definition
  14447. // ---------------------------------
  14448. //
  14449. /**
  14450. * Sticky Sidebar Class.
  14451. * @public
  14452. */
  14453. var StickySidebar = function () {
  14454. /**
  14455. * Sticky Sidebar Constructor.
  14456. * @constructor
  14457. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  14458. * @param {Object} options - The options of sticky sidebar.
  14459. */
  14460. function StickySidebar(sidebar) {
  14461. var _this = this;
  14462. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  14463. _classCallCheck(this, StickySidebar);
  14464. this.options = StickySidebar.extend(DEFAULTS, options);
  14465. // Sidebar element query if there's no one, throw error.
  14466. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  14467. if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
  14468. this.sidebarInner = false;
  14469. this.container = this.sidebar.parentElement;
  14470. // Current Affix Type of sidebar element.
  14471. this.affixedType = 'STATIC';
  14472. this.direction = 'down';
  14473. this.support = {
  14474. transform: false,
  14475. transform3d: false
  14476. };
  14477. this._initialized = false;
  14478. this._breakpoint = false;
  14479. this._resizeListeners = [];
  14480. // Dimenstions of sidebar, container and screen viewport.
  14481. this.dimensions = {
  14482. translateY: 0,
  14483. topSpacing: 0,
  14484. bottomSpacing: 0,
  14485. sidebarHeight: 0,
  14486. sidebarWidth: 0,
  14487. containerTop: 0,
  14488. containerHeight: 0,
  14489. viewportHeight: 0,
  14490. viewportTop: 0,
  14491. lastViewportTop: 0
  14492. };
  14493. // Bind event handlers for referencability.
  14494. ['handleEvent'].forEach(function (method) {
  14495. _this[method] = _this[method].bind(_this);
  14496. });
  14497. // Initialize sticky sidebar for first time.
  14498. this.initialize();
  14499. }
  14500. /**
  14501. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  14502. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  14503. * @private
  14504. */
  14505. _createClass(StickySidebar, [{
  14506. key: 'initialize',
  14507. value: function initialize() {
  14508. var _this2 = this;
  14509. this._setSupportFeatures();
  14510. // Get sticky sidebar inner wrapper, if not found, will create one.
  14511. if (this.options.innerWrapperSelector) {
  14512. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  14513. if (null === this.sidebarInner) this.sidebarInner = false;
  14514. }
  14515. if (!this.sidebarInner) {
  14516. var wrapper = document.createElement('div');
  14517. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  14518. this.sidebar.appendChild(wrapper);
  14519. while (this.sidebar.firstChild != wrapper) {
  14520. wrapper.appendChild(this.sidebar.firstChild);
  14521. }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  14522. }
  14523. // Container wrapper of the sidebar.
  14524. if (this.options.containerSelector) {
  14525. var containers = document.querySelectorAll(this.options.containerSelector);
  14526. containers = Array.prototype.slice.call(containers);
  14527. containers.forEach(function (container, item) {
  14528. if (!container.contains(_this2.sidebar)) return;
  14529. _this2.container = container;
  14530. });
  14531. if (!containers.length) throw new Error("The container does not contains on the sidebar.");
  14532. }
  14533. // If top/bottom spacing is not function parse value to integer.
  14534. if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  14535. if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  14536. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  14537. this._widthBreakpoint();
  14538. // Calculate dimensions of sidebar, container and viewport.
  14539. this.calcDimensions();
  14540. // Affix sidebar in proper position.
  14541. this.stickyPosition();
  14542. // Bind all events.
  14543. this.bindEvents();
  14544. // Inform other properties the sticky sidebar is initialized.
  14545. this._initialized = true;
  14546. }
  14547. /**
  14548. * Bind all events of sticky sidebar plugin.
  14549. * @protected
  14550. */
  14551. }, {
  14552. key: 'bindEvents',
  14553. value: function bindEvents() {
  14554. window.addEventListener('resize', this, { passive: true });
  14555. window.addEventListener('scroll', this, { passive: true });
  14556. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  14557. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14558. new ResizeSensor(this.sidebarInner, this.handleEvent);
  14559. new ResizeSensor(this.container, this.handleEvent);
  14560. }
  14561. }
  14562. /**
  14563. * Handles all events of the plugin.
  14564. * @param {Object} event - Event object passed from listener.
  14565. */
  14566. }, {
  14567. key: 'handleEvent',
  14568. value: function handleEvent(event) {
  14569. this.updateSticky(event);
  14570. }
  14571. /**
  14572. * Calculates dimesntions of sidebar, container and screen viewpoint
  14573. * @public
  14574. */
  14575. }, {
  14576. key: 'calcDimensions',
  14577. value: function calcDimensions() {
  14578. if (this._breakpoint) return;
  14579. var dims = this.dimensions;
  14580. // Container of sticky sidebar dimensions.
  14581. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  14582. dims.containerHeight = this.container.clientHeight;
  14583. dims.containerBottom = dims.containerTop + dims.containerHeight;
  14584. // Sidebar dimensions.
  14585. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  14586. dims.sidebarWidth = this.sidebar.offsetWidth;
  14587. // Screen viewport dimensions.
  14588. dims.viewportHeight = window.innerHeight;
  14589. this._calcDimensionsWithScroll();
  14590. }
  14591. /**
  14592. * Some dimensions values need to be up-to-date when scrolling the page.
  14593. * @private
  14594. */
  14595. }, {
  14596. key: '_calcDimensionsWithScroll',
  14597. value: function _calcDimensionsWithScroll() {
  14598. var dims = this.dimensions;
  14599. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  14600. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  14601. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  14602. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  14603. dims.topSpacing = this.options.topSpacing;
  14604. dims.bottomSpacing = this.options.bottomSpacing;
  14605. if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  14606. if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  14607. }
  14608. /**
  14609. * Detarmine wheather the sidebar is bigger than viewport.
  14610. * @public
  14611. * @return {Boolean}
  14612. */
  14613. }, {
  14614. key: 'isSidebarFitsViewport',
  14615. value: function isSidebarFitsViewport() {
  14616. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  14617. }
  14618. /**
  14619. * Observe browser scrolling direction top and down.
  14620. */
  14621. }, {
  14622. key: 'observeScrollDir',
  14623. value: function observeScrollDir() {
  14624. var dims = this.dimensions;
  14625. if (dims.lastViewportTop === dims.viewportTop) return;
  14626. var furthest = 'down' === this.direction ? Math.min : Math.max;
  14627. // If the browser is scrolling not in the same direction.
  14628. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
  14629. }
  14630. /**
  14631. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  14632. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  14633. * is bigger than viewport and vice versa.
  14634. * @public
  14635. * @return {String|False} - Proper affix type.
  14636. */
  14637. }, {
  14638. key: 'getAffixType',
  14639. value: function getAffixType() {
  14640. var dims = this.dimensions,
  14641. affixType = false;
  14642. this._calcDimensionsWithScroll();
  14643. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  14644. var colliderTop = dims.viewportTop + dims.topSpacing;
  14645. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  14646. // When browser is scrolling top.
  14647. if ('up' === this.direction) {
  14648. if (colliderTop <= dims.containerTop) {
  14649. dims.translateY = 0;
  14650. affixType = 'STATIC';
  14651. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  14652. dims.translateY = colliderTop - dims.containerTop;
  14653. affixType = 'VIEWPORT-TOP';
  14654. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  14655. affixType = 'VIEWPORT-UNBOTTOM';
  14656. }
  14657. // When browser is scrolling up.
  14658. } else {
  14659. // When sidebar element is not bigger than screen viewport.
  14660. if (this.isSidebarFitsViewport()) {
  14661. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  14662. dims.translateY = dims.containerBottom - sidebarBottom;
  14663. affixType = 'CONTAINER-BOTTOM';
  14664. } else if (colliderTop >= dims.containerTop) {
  14665. dims.translateY = colliderTop - dims.containerTop;
  14666. affixType = 'VIEWPORT-TOP';
  14667. }
  14668. // When sidebar element is bigger than screen viewport.
  14669. } else {
  14670. if (dims.containerBottom <= colliderBottom) {
  14671. dims.translateY = dims.containerBottom - sidebarBottom;
  14672. affixType = 'CONTAINER-BOTTOM';
  14673. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  14674. dims.translateY = colliderBottom - sidebarBottom;
  14675. affixType = 'VIEWPORT-BOTTOM';
  14676. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  14677. affixType = 'VIEWPORT-UNBOTTOM';
  14678. }
  14679. }
  14680. }
  14681. // Make sure the translate Y is not bigger than container height.
  14682. dims.translateY = Math.max(0, dims.translateY);
  14683. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  14684. dims.lastViewportTop = dims.viewportTop;
  14685. return affixType;
  14686. }
  14687. /**
  14688. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  14689. * to its affix type.
  14690. * @private
  14691. * @param {String} affixType - Affix type of sticky sidebar.
  14692. * @return {Object}
  14693. */
  14694. }, {
  14695. key: '_getStyle',
  14696. value: function _getStyle(affixType) {
  14697. if ('undefined' === typeof affixType) return;
  14698. var style = { inner: {}, outer: {} };
  14699. var dims = this.dimensions;
  14700. switch (affixType) {
  14701. case 'VIEWPORT-TOP':
  14702. style.inner = { position: 'fixed', top: this.options.topSpacing,
  14703. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
  14704. break;
  14705. case 'VIEWPORT-BOTTOM':
  14706. style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  14707. bottom: this.options.bottomSpacing, width: dims.sidebarWidth };
  14708. break;
  14709. case 'CONTAINER-BOTTOM':
  14710. case 'VIEWPORT-UNBOTTOM':
  14711. var translate = this._getTranslate(0, dims.translateY + 'px');
  14712. if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
  14713. break;
  14714. }
  14715. switch (affixType) {
  14716. case 'VIEWPORT-TOP':
  14717. case 'VIEWPORT-BOTTOM':
  14718. case 'VIEWPORT-UNBOTTOM':
  14719. case 'CONTAINER-BOTTOM':
  14720. style.outer = { height: dims.sidebarHeight, position: 'relative' };
  14721. break;
  14722. }
  14723. style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
  14724. style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
  14725. bottom: '', width: '', transform: this._getTranslate() }, style.inner);
  14726. return style;
  14727. }
  14728. /**
  14729. * Cause the sidebar to be sticky according to affix type by adding inline
  14730. * style, adding helper class and trigger events.
  14731. * @function
  14732. * @protected
  14733. * @param {string} force - Update sticky sidebar position by force.
  14734. */
  14735. }, {
  14736. key: 'stickyPosition',
  14737. value: function stickyPosition(force) {
  14738. if (this._breakpoint) return;
  14739. force = force || false;
  14740. var affixType = this.getAffixType();
  14741. var style = this._getStyle(affixType);
  14742. if ((this.affixedType != affixType || force) && affixType) {
  14743. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  14744. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  14745. if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  14746. for (var key in style.outer) {
  14747. this.sidebar.style[key] = style.outer[key];
  14748. }
  14749. for (var _key in style.inner) {
  14750. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  14751. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  14752. }
  14753. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  14754. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  14755. } else {
  14756. if (this._initialized) this.sidebarInner.style.left = style.inner.left;
  14757. }
  14758. this.affixedType = affixType;
  14759. }
  14760. /**
  14761. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  14762. * @protected
  14763. */
  14764. }, {
  14765. key: '_widthBreakpoint',
  14766. value: function _widthBreakpoint() {
  14767. if (window.innerWidth <= this.options.minWidth) {
  14768. this._breakpoint = true;
  14769. this.affixedType = 'STATIC';
  14770. this.sidebar.removeAttribute('style');
  14771. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  14772. this.sidebarInner.removeAttribute('style');
  14773. } else {
  14774. this._breakpoint = false;
  14775. }
  14776. }
  14777. /**
  14778. * Switchs between functions stack for each event type, if there's no
  14779. * event, it will re-initialize sticky sidebar.
  14780. * @public
  14781. */
  14782. }, {
  14783. key: 'updateSticky',
  14784. value: function updateSticky() {
  14785. var _this3 = this;
  14786. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14787. if (this._running) return;
  14788. this._running = true;
  14789. (function (eventType) {
  14790. requestAnimationFrame(function () {
  14791. switch (eventType) {
  14792. // When browser is scrolling and re-calculate just dimensions
  14793. // within scroll.
  14794. case 'scroll':
  14795. _this3._calcDimensionsWithScroll();
  14796. _this3.observeScrollDir();
  14797. _this3.stickyPosition();
  14798. break;
  14799. // When browser is resizing or there's no event, observe width
  14800. // breakpoint and re-calculate dimensions.
  14801. case 'resize':
  14802. default:
  14803. _this3._widthBreakpoint();
  14804. _this3.calcDimensions();
  14805. _this3.stickyPosition(true);
  14806. break;
  14807. }
  14808. _this3._running = false;
  14809. });
  14810. })(event.type);
  14811. }
  14812. /**
  14813. * Set browser support features to the public property.
  14814. * @private
  14815. */
  14816. }, {
  14817. key: '_setSupportFeatures',
  14818. value: function _setSupportFeatures() {
  14819. var support = this.support;
  14820. support.transform = StickySidebar.supportTransform();
  14821. support.transform3d = StickySidebar.supportTransform(true);
  14822. }
  14823. /**
  14824. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  14825. * and the same with translate. if browser doesn't support both return false.
  14826. * @param {Number} y - Value of Y-axis.
  14827. * @param {Number} x - Value of X-axis.
  14828. * @param {Number} z - Value of Z-axis.
  14829. * @return {String|False}
  14830. */
  14831. }, {
  14832. key: '_getTranslate',
  14833. value: function _getTranslate() {
  14834. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  14835. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  14836. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  14837. if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
  14838. }
  14839. /**
  14840. * Destroy sticky sidebar plugin.
  14841. * @public
  14842. */
  14843. }, {
  14844. key: 'destroy',
  14845. value: function destroy() {
  14846. window.removeEventListener('resize', this);
  14847. window.removeEventListener('scroll', this);
  14848. this.sidebar.classList.remove(this.options.stickyClass);
  14849. this.sidebar.style.minHeight = '';
  14850. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  14851. var styleReset = { inner: {}, outer: {} };
  14852. styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
  14853. styleReset.outer = { height: '', position: '' };
  14854. for (var key in styleReset.outer) {
  14855. this.sidebar.style[key] = styleReset.outer[key];
  14856. }for (var _key2 in styleReset.inner) {
  14857. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  14858. }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14859. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  14860. ResizeSensor.detach(this.container, this.handleEvent);
  14861. }
  14862. }
  14863. /**
  14864. * Detarmine if the browser supports CSS transfrom feature.
  14865. * @function
  14866. * @static
  14867. * @param {Boolean} transform3d - Detect transform with translate3d.
  14868. * @return {String}
  14869. */
  14870. }], [{
  14871. key: 'supportTransform',
  14872. value: function supportTransform(transform3d) {
  14873. var result = false,
  14874. property = transform3d ? 'perspective' : 'transform',
  14875. upper = property.charAt(0).toUpperCase() + property.slice(1),
  14876. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  14877. support = document.createElement('support'),
  14878. style = support.style;
  14879. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  14880. if (style[property] !== undefined) {
  14881. result = property;
  14882. return false;
  14883. }
  14884. });
  14885. return result;
  14886. }
  14887. /**
  14888. * Trigger custom event.
  14889. * @static
  14890. * @param {DOMObject} element - Target element on the DOM.
  14891. * @param {String} eventName - Event name.
  14892. * @param {Object} data -
  14893. */
  14894. }, {
  14895. key: 'eventTrigger',
  14896. value: function eventTrigger(element, eventName, data) {
  14897. try {
  14898. var event = new CustomEvent(eventName, { detail: data });
  14899. } catch (e) {
  14900. var event = document.createEvent('CustomEvent');
  14901. event.initCustomEvent(eventName, true, true, data);
  14902. }
  14903. element.dispatchEvent(event);
  14904. }
  14905. /**
  14906. * Extend options object with defaults.
  14907. * @function
  14908. * @static
  14909. */
  14910. }, {
  14911. key: 'extend',
  14912. value: function extend(defaults, options) {
  14913. var results = {};
  14914. for (var key in defaults) {
  14915. if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
  14916. }
  14917. return results;
  14918. }
  14919. /**
  14920. * Get current coordinates left and top of specific element.
  14921. * @static
  14922. */
  14923. }, {
  14924. key: 'offsetRelative',
  14925. value: function offsetRelative(element) {
  14926. var result = { left: 0, top: 0 };
  14927. do {
  14928. var offsetTop = element.offsetTop;
  14929. var offsetLeft = element.offsetLeft;
  14930. if (!isNaN(offsetTop)) result.top += offsetTop;
  14931. if (!isNaN(offsetLeft)) result.left += offsetLeft;
  14932. } while (element = element.offsetParent);
  14933. return result;
  14934. }
  14935. /**
  14936. * Add specific class name to specific element.
  14937. * @static
  14938. * @param {ObjectDOM} element
  14939. * @param {String} className
  14940. */
  14941. }, {
  14942. key: 'addClass',
  14943. value: function addClass(element, className) {
  14944. if (!StickySidebar.hasClass(element, className)) {
  14945. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  14946. }
  14947. }
  14948. /**
  14949. * Remove specific class name to specific element
  14950. * @static
  14951. * @param {ObjectDOM} element
  14952. * @param {String} className
  14953. */
  14954. }, {
  14955. key: 'removeClass',
  14956. value: function removeClass(element, className) {
  14957. if (StickySidebar.hasClass(element, className)) {
  14958. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  14959. }
  14960. }
  14961. /**
  14962. * Detarmine weather the element has specific class name.
  14963. * @static
  14964. * @param {ObjectDOM} element
  14965. * @param {String} className
  14966. */
  14967. }, {
  14968. key: 'hasClass',
  14969. value: function hasClass(element, className) {
  14970. if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  14971. }
  14972. }]);
  14973. return StickySidebar;
  14974. }();
  14975. return StickySidebar;
  14976. }();
  14977. // Global
  14978. // -------------------------
  14979. window.StickySidebar = StickySidebar;
  14980. return StickySidebar;
  14981. });
  14982. //# sourceMappingURL=sticky-sidebar.js.map
  14983. /***/ }),
  14984. /* 34 */
  14985. /***/ (function(module, exports, __webpack_require__) {
  14986. "use strict";
  14987. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14988. 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; };
  14989. /*! tether 1.4.0 */
  14990. (function (root, factory) {
  14991. if (true) {
  14992. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14993. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14994. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14995. __WEBPACK_AMD_DEFINE_FACTORY__),
  14996. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14997. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  14998. module.exports = factory(require, exports, module);
  14999. } else {
  15000. root.Tether = factory();
  15001. }
  15002. })(undefined, function (require, exports, module) {
  15003. 'use strict';
  15004. var _createClass = function () {
  15005. function defineProperties(target, props) {
  15006. for (var i = 0; i < props.length; i++) {
  15007. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  15008. }
  15009. }return function (Constructor, protoProps, staticProps) {
  15010. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15011. };
  15012. }();
  15013. function _classCallCheck(instance, Constructor) {
  15014. if (!(instance instanceof Constructor)) {
  15015. throw new TypeError('Cannot call a class as a function');
  15016. }
  15017. }
  15018. var TetherBase = undefined;
  15019. if (typeof TetherBase === 'undefined') {
  15020. TetherBase = { modules: [] };
  15021. }
  15022. var zeroElement = null;
  15023. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  15024. // if the element lies within a nested document (<frame> or <iframe>-like).
  15025. function getActualBoundingClientRect(node) {
  15026. var boundingRect = node.getBoundingClientRect();
  15027. // The original object returned by getBoundingClientRect is immutable, so we clone it
  15028. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  15029. var rect = {};
  15030. for (var k in boundingRect) {
  15031. rect[k] = boundingRect[k];
  15032. }
  15033. if (node.ownerDocument !== document) {
  15034. var _frameElement = node.ownerDocument.defaultView.frameElement;
  15035. if (_frameElement) {
  15036. var frameRect = getActualBoundingClientRect(_frameElement);
  15037. rect.top += frameRect.top;
  15038. rect.bottom += frameRect.top;
  15039. rect.left += frameRect.left;
  15040. rect.right += frameRect.left;
  15041. }
  15042. }
  15043. return rect;
  15044. }
  15045. function getScrollParents(el) {
  15046. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  15047. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  15048. var computedStyle = getComputedStyle(el) || {};
  15049. var position = computedStyle.position;
  15050. var parents = [];
  15051. if (position === 'fixed') {
  15052. return [el];
  15053. }
  15054. var parent = el;
  15055. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  15056. var style = undefined;
  15057. try {
  15058. style = getComputedStyle(parent);
  15059. } catch (err) {}
  15060. if (typeof style === 'undefined' || style === null) {
  15061. parents.push(parent);
  15062. return parents;
  15063. }
  15064. var _style = style;
  15065. var overflow = _style.overflow;
  15066. var overflowX = _style.overflowX;
  15067. var overflowY = _style.overflowY;
  15068. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  15069. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  15070. parents.push(parent);
  15071. }
  15072. }
  15073. }
  15074. parents.push(el.ownerDocument.body);
  15075. // If the node is within a frame, account for the parent window scroll
  15076. if (el.ownerDocument !== document) {
  15077. parents.push(el.ownerDocument.defaultView);
  15078. }
  15079. return parents;
  15080. }
  15081. var uniqueId = function () {
  15082. var id = 0;
  15083. return function () {
  15084. return ++id;
  15085. };
  15086. }();
  15087. var zeroPosCache = {};
  15088. var getOrigin = function getOrigin() {
  15089. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  15090. // jitter as the user scrolls that messes with our ability to detect if two positions
  15091. // are equivilant or not. We place an element at the top left of the page that will
  15092. // get the same jitter, so we can cancel the two out.
  15093. var node = zeroElement;
  15094. if (!node || !document.body.contains(node)) {
  15095. node = document.createElement('div');
  15096. node.setAttribute('data-tether-id', uniqueId());
  15097. extend(node.style, {
  15098. top: 0,
  15099. left: 0,
  15100. position: 'absolute'
  15101. });
  15102. document.body.appendChild(node);
  15103. zeroElement = node;
  15104. }
  15105. var id = node.getAttribute('data-tether-id');
  15106. if (typeof zeroPosCache[id] === 'undefined') {
  15107. zeroPosCache[id] = getActualBoundingClientRect(node);
  15108. // Clear the cache when this position call is done
  15109. defer(function () {
  15110. delete zeroPosCache[id];
  15111. });
  15112. }
  15113. return zeroPosCache[id];
  15114. };
  15115. function removeUtilElements() {
  15116. if (zeroElement) {
  15117. document.body.removeChild(zeroElement);
  15118. }
  15119. zeroElement = null;
  15120. };
  15121. function getBounds(el) {
  15122. var doc = undefined;
  15123. if (el === document) {
  15124. doc = document;
  15125. el = document.documentElement;
  15126. } else {
  15127. doc = el.ownerDocument;
  15128. }
  15129. var docEl = doc.documentElement;
  15130. var box = getActualBoundingClientRect(el);
  15131. var origin = getOrigin();
  15132. box.top -= origin.top;
  15133. box.left -= origin.left;
  15134. if (typeof box.width === 'undefined') {
  15135. box.width = document.body.scrollWidth - box.left - box.right;
  15136. }
  15137. if (typeof box.height === 'undefined') {
  15138. box.height = document.body.scrollHeight - box.top - box.bottom;
  15139. }
  15140. box.top = box.top - docEl.clientTop;
  15141. box.left = box.left - docEl.clientLeft;
  15142. box.right = doc.body.clientWidth - box.width - box.left;
  15143. box.bottom = doc.body.clientHeight - box.height - box.top;
  15144. return box;
  15145. }
  15146. function getOffsetParent(el) {
  15147. return el.offsetParent || document.documentElement;
  15148. }
  15149. var _scrollBarSize = null;
  15150. function getScrollBarSize() {
  15151. if (_scrollBarSize) {
  15152. return _scrollBarSize;
  15153. }
  15154. var inner = document.createElement('div');
  15155. inner.style.width = '100%';
  15156. inner.style.height = '200px';
  15157. var outer = document.createElement('div');
  15158. extend(outer.style, {
  15159. position: 'absolute',
  15160. top: 0,
  15161. left: 0,
  15162. pointerEvents: 'none',
  15163. visibility: 'hidden',
  15164. width: '200px',
  15165. height: '150px',
  15166. overflow: 'hidden'
  15167. });
  15168. outer.appendChild(inner);
  15169. document.body.appendChild(outer);
  15170. var widthContained = inner.offsetWidth;
  15171. outer.style.overflow = 'scroll';
  15172. var widthScroll = inner.offsetWidth;
  15173. if (widthContained === widthScroll) {
  15174. widthScroll = outer.clientWidth;
  15175. }
  15176. document.body.removeChild(outer);
  15177. var width = widthContained - widthScroll;
  15178. _scrollBarSize = { width: width, height: width };
  15179. return _scrollBarSize;
  15180. }
  15181. function extend() {
  15182. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  15183. var args = [];
  15184. Array.prototype.push.apply(args, arguments);
  15185. args.slice(1).forEach(function (obj) {
  15186. if (obj) {
  15187. for (var key in obj) {
  15188. if ({}.hasOwnProperty.call(obj, key)) {
  15189. out[key] = obj[key];
  15190. }
  15191. }
  15192. }
  15193. });
  15194. return out;
  15195. }
  15196. function removeClass(el, name) {
  15197. if (typeof el.classList !== 'undefined') {
  15198. name.split(' ').forEach(function (cls) {
  15199. if (cls.trim()) {
  15200. el.classList.remove(cls);
  15201. }
  15202. });
  15203. } else {
  15204. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  15205. var className = getClassName(el).replace(regex, ' ');
  15206. setClassName(el, className);
  15207. }
  15208. }
  15209. function addClass(el, name) {
  15210. if (typeof el.classList !== 'undefined') {
  15211. name.split(' ').forEach(function (cls) {
  15212. if (cls.trim()) {
  15213. el.classList.add(cls);
  15214. }
  15215. });
  15216. } else {
  15217. removeClass(el, name);
  15218. var cls = getClassName(el) + (' ' + name);
  15219. setClassName(el, cls);
  15220. }
  15221. }
  15222. function hasClass(el, name) {
  15223. if (typeof el.classList !== 'undefined') {
  15224. return el.classList.contains(name);
  15225. }
  15226. var className = getClassName(el);
  15227. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  15228. }
  15229. function getClassName(el) {
  15230. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  15231. // completely separately SVGAnimatedString base classes
  15232. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  15233. return el.className.baseVal;
  15234. }
  15235. return el.className;
  15236. }
  15237. function setClassName(el, className) {
  15238. el.setAttribute('class', className);
  15239. }
  15240. function updateClasses(el, add, all) {
  15241. // Of the set of 'all' classes, we need the 'add' classes, and only the
  15242. // 'add' classes to be set.
  15243. all.forEach(function (cls) {
  15244. if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
  15245. removeClass(el, cls);
  15246. }
  15247. });
  15248. add.forEach(function (cls) {
  15249. if (!hasClass(el, cls)) {
  15250. addClass(el, cls);
  15251. }
  15252. });
  15253. }
  15254. var deferred = [];
  15255. var defer = function defer(fn) {
  15256. deferred.push(fn);
  15257. };
  15258. var flush = function flush() {
  15259. var fn = undefined;
  15260. while (fn = deferred.pop()) {
  15261. fn();
  15262. }
  15263. };
  15264. var Evented = function () {
  15265. function Evented() {
  15266. _classCallCheck(this, Evented);
  15267. }
  15268. _createClass(Evented, [{
  15269. key: 'on',
  15270. value: function on(event, handler, ctx) {
  15271. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  15272. if (typeof this.bindings === 'undefined') {
  15273. this.bindings = {};
  15274. }
  15275. if (typeof this.bindings[event] === 'undefined') {
  15276. this.bindings[event] = [];
  15277. }
  15278. this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
  15279. }
  15280. }, {
  15281. key: 'once',
  15282. value: function once(event, handler, ctx) {
  15283. this.on(event, handler, ctx, true);
  15284. }
  15285. }, {
  15286. key: 'off',
  15287. value: function off(event, handler) {
  15288. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  15289. return;
  15290. }
  15291. if (typeof handler === 'undefined') {
  15292. delete this.bindings[event];
  15293. } else {
  15294. var i = 0;
  15295. while (i < this.bindings[event].length) {
  15296. if (this.bindings[event][i].handler === handler) {
  15297. this.bindings[event].splice(i, 1);
  15298. } else {
  15299. ++i;
  15300. }
  15301. }
  15302. }
  15303. }
  15304. }, {
  15305. key: 'trigger',
  15306. value: function trigger(event) {
  15307. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  15308. var i = 0;
  15309. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15310. args[_key - 1] = arguments[_key];
  15311. }
  15312. while (i < this.bindings[event].length) {
  15313. var _bindings$event$i = this.bindings[event][i];
  15314. var handler = _bindings$event$i.handler;
  15315. var ctx = _bindings$event$i.ctx;
  15316. var once = _bindings$event$i.once;
  15317. var context = ctx;
  15318. if (typeof context === 'undefined') {
  15319. context = this;
  15320. }
  15321. handler.apply(context, args);
  15322. if (once) {
  15323. this.bindings[event].splice(i, 1);
  15324. } else {
  15325. ++i;
  15326. }
  15327. }
  15328. }
  15329. }
  15330. }]);
  15331. return Evented;
  15332. }();
  15333. TetherBase.Utils = {
  15334. getActualBoundingClientRect: getActualBoundingClientRect,
  15335. getScrollParents: getScrollParents,
  15336. getBounds: getBounds,
  15337. getOffsetParent: getOffsetParent,
  15338. extend: extend,
  15339. addClass: addClass,
  15340. removeClass: removeClass,
  15341. hasClass: hasClass,
  15342. updateClasses: updateClasses,
  15343. defer: defer,
  15344. flush: flush,
  15345. uniqueId: uniqueId,
  15346. Evented: Evented,
  15347. getScrollBarSize: getScrollBarSize,
  15348. removeUtilElements: removeUtilElements
  15349. };
  15350. /* globals TetherBase, performance */
  15351. 'use strict';
  15352. var _slicedToArray = function () {
  15353. function sliceIterator(arr, i) {
  15354. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  15355. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  15356. _arr.push(_s.value);if (i && _arr.length === i) break;
  15357. }
  15358. } catch (err) {
  15359. _d = true;_e = err;
  15360. } finally {
  15361. try {
  15362. if (!_n && _i['return']) _i['return']();
  15363. } finally {
  15364. if (_d) throw _e;
  15365. }
  15366. }return _arr;
  15367. }return function (arr, i) {
  15368. if (Array.isArray(arr)) {
  15369. return arr;
  15370. } else if (Symbol.iterator in Object(arr)) {
  15371. return sliceIterator(arr, i);
  15372. } else {
  15373. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  15374. }
  15375. };
  15376. }();
  15377. var _createClass = function () {
  15378. function defineProperties(target, props) {
  15379. for (var i = 0; i < props.length; i++) {
  15380. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  15381. }
  15382. }return function (Constructor, protoProps, staticProps) {
  15383. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15384. };
  15385. }();
  15386. var _get = function get(_x6, _x7, _x8) {
  15387. var _again = true;_function: while (_again) {
  15388. var object = _x6,
  15389. property = _x7,
  15390. receiver = _x8;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  15391. var parent = Object.getPrototypeOf(object);if (parent === null) {
  15392. return undefined;
  15393. } else {
  15394. _x6 = parent;_x7 = property;_x8 = receiver;_again = true;desc = parent = undefined;continue _function;
  15395. }
  15396. } else if ('value' in desc) {
  15397. return desc.value;
  15398. } else {
  15399. var getter = desc.get;if (getter === undefined) {
  15400. return undefined;
  15401. }return getter.call(receiver);
  15402. }
  15403. }
  15404. };
  15405. function _classCallCheck(instance, Constructor) {
  15406. if (!(instance instanceof Constructor)) {
  15407. throw new TypeError('Cannot call a class as a function');
  15408. }
  15409. }
  15410. function _inherits(subClass, superClass) {
  15411. if (typeof superClass !== 'function' && superClass !== null) {
  15412. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  15413. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  15414. }
  15415. if (typeof TetherBase === 'undefined') {
  15416. throw new Error('You must include the utils.js file before tether.js');
  15417. }
  15418. var _TetherBase$Utils = TetherBase.Utils;
  15419. var getScrollParents = _TetherBase$Utils.getScrollParents;
  15420. var getBounds = _TetherBase$Utils.getBounds;
  15421. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  15422. var extend = _TetherBase$Utils.extend;
  15423. var addClass = _TetherBase$Utils.addClass;
  15424. var removeClass = _TetherBase$Utils.removeClass;
  15425. var updateClasses = _TetherBase$Utils.updateClasses;
  15426. var defer = _TetherBase$Utils.defer;
  15427. var flush = _TetherBase$Utils.flush;
  15428. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  15429. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  15430. function within(a, b) {
  15431. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  15432. return a + diff >= b && b >= a - diff;
  15433. }
  15434. var transformKey = function () {
  15435. if (typeof document === 'undefined') {
  15436. return '';
  15437. }
  15438. var el = document.createElement('div');
  15439. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  15440. for (var i = 0; i < transforms.length; ++i) {
  15441. var key = transforms[i];
  15442. if (el.style[key] !== undefined) {
  15443. return key;
  15444. }
  15445. }
  15446. }();
  15447. var tethers = [];
  15448. var position = function position() {
  15449. tethers.forEach(function (tether) {
  15450. tether.position(false);
  15451. });
  15452. flush();
  15453. };
  15454. function now() {
  15455. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  15456. return performance.now();
  15457. }
  15458. return +new Date();
  15459. }
  15460. (function () {
  15461. var lastCall = null;
  15462. var lastDuration = null;
  15463. var pendingTimeout = null;
  15464. var tick = function tick() {
  15465. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  15466. // We voluntarily throttle ourselves if we can't manage 60fps
  15467. lastDuration = Math.min(lastDuration - 16, 250);
  15468. // Just in case this is the last event, remember to position just once more
  15469. pendingTimeout = setTimeout(tick, 250);
  15470. return;
  15471. }
  15472. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  15473. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  15474. return;
  15475. }
  15476. if (pendingTimeout != null) {
  15477. clearTimeout(pendingTimeout);
  15478. pendingTimeout = null;
  15479. }
  15480. lastCall = now();
  15481. position();
  15482. lastDuration = now() - lastCall;
  15483. };
  15484. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  15485. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  15486. window.addEventListener(event, tick);
  15487. });
  15488. }
  15489. })();
  15490. var MIRROR_LR = {
  15491. center: 'center',
  15492. left: 'right',
  15493. right: 'left'
  15494. };
  15495. var MIRROR_TB = {
  15496. middle: 'middle',
  15497. top: 'bottom',
  15498. bottom: 'top'
  15499. };
  15500. var OFFSET_MAP = {
  15501. top: 0,
  15502. left: 0,
  15503. middle: '50%',
  15504. center: '50%',
  15505. bottom: '100%',
  15506. right: '100%'
  15507. };
  15508. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  15509. var left = attachment.left;
  15510. var top = attachment.top;
  15511. if (left === 'auto') {
  15512. left = MIRROR_LR[relativeToAttachment.left];
  15513. }
  15514. if (top === 'auto') {
  15515. top = MIRROR_TB[relativeToAttachment.top];
  15516. }
  15517. return { left: left, top: top };
  15518. };
  15519. var attachmentToOffset = function attachmentToOffset(attachment) {
  15520. var left = attachment.left;
  15521. var top = attachment.top;
  15522. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  15523. left = OFFSET_MAP[attachment.left];
  15524. }
  15525. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  15526. top = OFFSET_MAP[attachment.top];
  15527. }
  15528. return { left: left, top: top };
  15529. };
  15530. function addOffset() {
  15531. var out = { top: 0, left: 0 };
  15532. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  15533. offsets[_key] = arguments[_key];
  15534. }
  15535. offsets.forEach(function (_ref) {
  15536. var top = _ref.top;
  15537. var left = _ref.left;
  15538. if (typeof top === 'string') {
  15539. top = parseFloat(top, 10);
  15540. }
  15541. if (typeof left === 'string') {
  15542. left = parseFloat(left, 10);
  15543. }
  15544. out.top += top;
  15545. out.left += left;
  15546. });
  15547. return out;
  15548. }
  15549. function offsetToPx(offset, size) {
  15550. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
  15551. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  15552. }
  15553. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
  15554. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  15555. }
  15556. return offset;
  15557. }
  15558. var parseOffset = function parseOffset(value) {
  15559. var _value$split = value.split(' ');
  15560. var _value$split2 = _slicedToArray(_value$split, 2);
  15561. var top = _value$split2[0];
  15562. var left = _value$split2[1];
  15563. return { top: top, left: left };
  15564. };
  15565. var parseAttachment = parseOffset;
  15566. var TetherClass = function (_Evented) {
  15567. _inherits(TetherClass, _Evented);
  15568. function TetherClass(options) {
  15569. var _this = this;
  15570. _classCallCheck(this, TetherClass);
  15571. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  15572. this.position = this.position.bind(this);
  15573. tethers.push(this);
  15574. this.history = [];
  15575. this.setOptions(options, false);
  15576. TetherBase.modules.forEach(function (module) {
  15577. if (typeof module.initialize !== 'undefined') {
  15578. module.initialize.call(_this);
  15579. }
  15580. });
  15581. this.position();
  15582. }
  15583. _createClass(TetherClass, [{
  15584. key: 'getClass',
  15585. value: function getClass() {
  15586. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  15587. var classes = this.options.classes;
  15588. if (typeof classes !== 'undefined' && classes[key]) {
  15589. return this.options.classes[key];
  15590. } else if (this.options.classPrefix) {
  15591. return this.options.classPrefix + '-' + key;
  15592. } else {
  15593. return key;
  15594. }
  15595. }
  15596. }, {
  15597. key: 'setOptions',
  15598. value: function setOptions(options) {
  15599. var _this2 = this;
  15600. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  15601. var defaults = {
  15602. offset: '0 0',
  15603. targetOffset: '0 0',
  15604. targetAttachment: 'auto auto',
  15605. classPrefix: 'tether'
  15606. };
  15607. this.options = extend(defaults, options);
  15608. var _options = this.options;
  15609. var element = _options.element;
  15610. var target = _options.target;
  15611. var targetModifier = _options.targetModifier;
  15612. this.element = element;
  15613. this.target = target;
  15614. this.targetModifier = targetModifier;
  15615. if (this.target === 'viewport') {
  15616. this.target = document.body;
  15617. this.targetModifier = 'visible';
  15618. } else if (this.target === 'scroll-handle') {
  15619. this.target = document.body;
  15620. this.targetModifier = 'scroll-handle';
  15621. }
  15622. ['element', 'target'].forEach(function (key) {
  15623. if (typeof _this2[key] === 'undefined') {
  15624. throw new Error('Tether Error: Both element and target must be defined');
  15625. }
  15626. if (typeof _this2[key].jquery !== 'undefined') {
  15627. _this2[key] = _this2[key][0];
  15628. } else if (typeof _this2[key] === 'string') {
  15629. _this2[key] = document.querySelector(_this2[key]);
  15630. }
  15631. });
  15632. addClass(this.element, this.getClass('element'));
  15633. if (!(this.options.addTargetClasses === false)) {
  15634. addClass(this.target, this.getClass('target'));
  15635. }
  15636. if (!this.options.attachment) {
  15637. throw new Error('Tether Error: You must provide an attachment');
  15638. }
  15639. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  15640. this.attachment = parseAttachment(this.options.attachment);
  15641. this.offset = parseOffset(this.options.offset);
  15642. this.targetOffset = parseOffset(this.options.targetOffset);
  15643. if (typeof this.scrollParents !== 'undefined') {
  15644. this.disable();
  15645. }
  15646. if (this.targetModifier === 'scroll-handle') {
  15647. this.scrollParents = [this.target];
  15648. } else {
  15649. this.scrollParents = getScrollParents(this.target);
  15650. }
  15651. if (!(this.options.enabled === false)) {
  15652. this.enable(pos);
  15653. }
  15654. }
  15655. }, {
  15656. key: 'getTargetBounds',
  15657. value: function getTargetBounds() {
  15658. if (typeof this.targetModifier !== 'undefined') {
  15659. if (this.targetModifier === 'visible') {
  15660. if (this.target === document.body) {
  15661. return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  15662. } else {
  15663. var bounds = getBounds(this.target);
  15664. var out = {
  15665. height: bounds.height,
  15666. width: bounds.width,
  15667. top: bounds.top,
  15668. left: bounds.left
  15669. };
  15670. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  15671. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  15672. out.height = Math.min(innerHeight, out.height);
  15673. out.height -= 2;
  15674. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  15675. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  15676. out.width = Math.min(innerWidth, out.width);
  15677. out.width -= 2;
  15678. if (out.top < pageYOffset) {
  15679. out.top = pageYOffset;
  15680. }
  15681. if (out.left < pageXOffset) {
  15682. out.left = pageXOffset;
  15683. }
  15684. return out;
  15685. }
  15686. } else if (this.targetModifier === 'scroll-handle') {
  15687. var bounds = undefined;
  15688. var target = this.target;
  15689. if (target === document.body) {
  15690. target = document.documentElement;
  15691. bounds = {
  15692. left: pageXOffset,
  15693. top: pageYOffset,
  15694. height: innerHeight,
  15695. width: innerWidth
  15696. };
  15697. } else {
  15698. bounds = getBounds(target);
  15699. }
  15700. var style = getComputedStyle(target);
  15701. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  15702. var scrollBottom = 0;
  15703. if (hasBottomScroll) {
  15704. scrollBottom = 15;
  15705. }
  15706. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  15707. var out = {
  15708. width: 15,
  15709. height: height * 0.975 * (height / target.scrollHeight),
  15710. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  15711. };
  15712. var fitAdj = 0;
  15713. if (height < 408 && this.target === document.body) {
  15714. fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  15715. }
  15716. if (this.target !== document.body) {
  15717. out.height = Math.max(out.height, 24);
  15718. }
  15719. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  15720. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  15721. if (this.target === document.body) {
  15722. out.height = Math.max(out.height, 24);
  15723. }
  15724. return out;
  15725. }
  15726. } else {
  15727. return getBounds(this.target);
  15728. }
  15729. }
  15730. }, {
  15731. key: 'clearCache',
  15732. value: function clearCache() {
  15733. this._cache = {};
  15734. }
  15735. }, {
  15736. key: 'cache',
  15737. value: function cache(k, getter) {
  15738. // More than one module will often need the same DOM info, so
  15739. // we keep a cache which is cleared on each position call
  15740. if (typeof this._cache === 'undefined') {
  15741. this._cache = {};
  15742. }
  15743. if (typeof this._cache[k] === 'undefined') {
  15744. this._cache[k] = getter.call(this);
  15745. }
  15746. return this._cache[k];
  15747. }
  15748. }, {
  15749. key: 'enable',
  15750. value: function enable() {
  15751. var _this3 = this;
  15752. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15753. if (!(this.options.addTargetClasses === false)) {
  15754. addClass(this.target, this.getClass('enabled'));
  15755. }
  15756. addClass(this.element, this.getClass('enabled'));
  15757. this.enabled = true;
  15758. this.scrollParents.forEach(function (parent) {
  15759. if (parent !== _this3.target.ownerDocument) {
  15760. parent.addEventListener('scroll', _this3.position);
  15761. }
  15762. });
  15763. if (pos) {
  15764. this.position();
  15765. }
  15766. }
  15767. }, {
  15768. key: 'disable',
  15769. value: function disable() {
  15770. var _this4 = this;
  15771. removeClass(this.target, this.getClass('enabled'));
  15772. removeClass(this.element, this.getClass('enabled'));
  15773. this.enabled = false;
  15774. if (typeof this.scrollParents !== 'undefined') {
  15775. this.scrollParents.forEach(function (parent) {
  15776. parent.removeEventListener('scroll', _this4.position);
  15777. });
  15778. }
  15779. }
  15780. }, {
  15781. key: 'destroy',
  15782. value: function destroy() {
  15783. var _this5 = this;
  15784. this.disable();
  15785. tethers.forEach(function (tether, i) {
  15786. if (tether === _this5) {
  15787. tethers.splice(i, 1);
  15788. }
  15789. });
  15790. // Remove any elements we were using for convenience from the DOM
  15791. if (tethers.length === 0) {
  15792. removeUtilElements();
  15793. }
  15794. }
  15795. }, {
  15796. key: 'updateAttachClasses',
  15797. value: function updateAttachClasses(elementAttach, targetAttach) {
  15798. var _this6 = this;
  15799. elementAttach = elementAttach || this.attachment;
  15800. targetAttach = targetAttach || this.targetAttachment;
  15801. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  15802. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  15803. // updateAttachClasses can be called more than once in a position call, so
  15804. // we need to clean up after ourselves such that when the last defer gets
  15805. // ran it doesn't add any extra classes from previous calls.
  15806. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  15807. }
  15808. if (typeof this._addAttachClasses === 'undefined') {
  15809. this._addAttachClasses = [];
  15810. }
  15811. var add = this._addAttachClasses;
  15812. if (elementAttach.top) {
  15813. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  15814. }
  15815. if (elementAttach.left) {
  15816. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  15817. }
  15818. if (targetAttach.top) {
  15819. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  15820. }
  15821. if (targetAttach.left) {
  15822. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  15823. }
  15824. var all = [];
  15825. sides.forEach(function (side) {
  15826. all.push(_this6.getClass('element-attached') + '-' + side);
  15827. all.push(_this6.getClass('target-attached') + '-' + side);
  15828. });
  15829. defer(function () {
  15830. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  15831. return;
  15832. }
  15833. updateClasses(_this6.element, _this6._addAttachClasses, all);
  15834. if (!(_this6.options.addTargetClasses === false)) {
  15835. updateClasses(_this6.target, _this6._addAttachClasses, all);
  15836. }
  15837. delete _this6._addAttachClasses;
  15838. });
  15839. }
  15840. }, {
  15841. key: 'position',
  15842. value: function position() {
  15843. var _this7 = this;
  15844. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15845. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  15846. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  15847. if (!this.enabled) {
  15848. return;
  15849. }
  15850. this.clearCache();
  15851. // Turn 'auto' attachments into the appropriate corner or edge
  15852. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  15853. this.updateAttachClasses(this.attachment, targetAttachment);
  15854. var elementPos = this.cache('element-bounds', function () {
  15855. return getBounds(_this7.element);
  15856. });
  15857. var width = elementPos.width;
  15858. var height = elementPos.height;
  15859. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  15860. var _lastSize = this.lastSize;
  15861. // We cache the height and width to make it possible to position elements that are
  15862. // getting hidden.
  15863. width = _lastSize.width;
  15864. height = _lastSize.height;
  15865. } else {
  15866. this.lastSize = { width: width, height: height };
  15867. }
  15868. var targetPos = this.cache('target-bounds', function () {
  15869. return _this7.getTargetBounds();
  15870. });
  15871. var targetSize = targetPos;
  15872. // Get an actual px offset from the attachment
  15873. var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
  15874. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  15875. var manualOffset = offsetToPx(this.offset, { width: width, height: height });
  15876. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  15877. // Add the manually provided offset
  15878. offset = addOffset(offset, manualOffset);
  15879. targetOffset = addOffset(targetOffset, manualTargetOffset);
  15880. // It's now our goal to make (element position + offset) == (target position + target offset)
  15881. var left = targetPos.left + targetOffset.left - offset.left;
  15882. var top = targetPos.top + targetOffset.top - offset.top;
  15883. for (var i = 0; i < TetherBase.modules.length; ++i) {
  15884. var _module2 = TetherBase.modules[i];
  15885. var ret = _module2.position.call(this, {
  15886. left: left,
  15887. top: top,
  15888. targetAttachment: targetAttachment,
  15889. targetPos: targetPos,
  15890. elementPos: elementPos,
  15891. offset: offset,
  15892. targetOffset: targetOffset,
  15893. manualOffset: manualOffset,
  15894. manualTargetOffset: manualTargetOffset,
  15895. scrollbarSize: scrollbarSize,
  15896. attachment: this.attachment
  15897. });
  15898. if (ret === false) {
  15899. return false;
  15900. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  15901. continue;
  15902. } else {
  15903. top = ret.top;
  15904. left = ret.left;
  15905. }
  15906. }
  15907. // We describe the position three different ways to give the optimizer
  15908. // a chance to decide the best possible way to position the element
  15909. // with the fewest repaints.
  15910. var next = {
  15911. // It's position relative to the page (absolute positioning when
  15912. // the element is a child of the body)
  15913. page: {
  15914. top: top,
  15915. left: left
  15916. },
  15917. // It's position relative to the viewport (fixed positioning)
  15918. viewport: {
  15919. top: top - pageYOffset,
  15920. bottom: pageYOffset - top - height + innerHeight,
  15921. left: left - pageXOffset,
  15922. right: pageXOffset - left - width + innerWidth
  15923. }
  15924. };
  15925. var doc = this.target.ownerDocument;
  15926. var win = doc.defaultView;
  15927. var scrollbarSize = undefined;
  15928. if (win.innerHeight > doc.documentElement.clientHeight) {
  15929. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15930. next.viewport.bottom -= scrollbarSize.height;
  15931. }
  15932. if (win.innerWidth > doc.documentElement.clientWidth) {
  15933. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15934. next.viewport.right -= scrollbarSize.width;
  15935. }
  15936. if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
  15937. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  15938. next.page.bottom = doc.body.scrollHeight - top - height;
  15939. next.page.right = doc.body.scrollWidth - left - width;
  15940. }
  15941. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  15942. (function () {
  15943. var offsetParent = _this7.cache('target-offsetparent', function () {
  15944. return getOffsetParent(_this7.target);
  15945. });
  15946. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  15947. return getBounds(offsetParent);
  15948. });
  15949. var offsetParentStyle = getComputedStyle(offsetParent);
  15950. var offsetParentSize = offsetPosition;
  15951. var offsetBorder = {};
  15952. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  15953. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  15954. });
  15955. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  15956. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  15957. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  15958. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  15959. // We're within the visible part of the target's scroll parent
  15960. var scrollTop = offsetParent.scrollTop;
  15961. var scrollLeft = offsetParent.scrollLeft;
  15962. // It's position relative to the target's offset parent (absolute positioning when
  15963. // the element is moved to be a child of the target's offset parent).
  15964. next.offset = {
  15965. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  15966. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  15967. };
  15968. }
  15969. }
  15970. })();
  15971. }
  15972. // We could also travel up the DOM and try each containing context, rather than only
  15973. // looking at the body, but we're gonna get diminishing returns.
  15974. this.move(next);
  15975. this.history.unshift(next);
  15976. if (this.history.length > 3) {
  15977. this.history.pop();
  15978. }
  15979. if (flushChanges) {
  15980. flush();
  15981. }
  15982. return true;
  15983. }
  15984. // THE ISSUE
  15985. }, {
  15986. key: 'move',
  15987. value: function move(pos) {
  15988. var _this8 = this;
  15989. if (!(typeof this.element.parentNode !== 'undefined')) {
  15990. return;
  15991. }
  15992. var same = {};
  15993. for (var type in pos) {
  15994. same[type] = {};
  15995. for (var key in pos[type]) {
  15996. var found = false;
  15997. for (var i = 0; i < this.history.length; ++i) {
  15998. var point = this.history[i];
  15999. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  16000. found = true;
  16001. break;
  16002. }
  16003. }
  16004. if (!found) {
  16005. same[type][key] = true;
  16006. }
  16007. }
  16008. }
  16009. var css = { top: '', left: '', right: '', bottom: '' };
  16010. var transcribe = function transcribe(_same, _pos) {
  16011. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  16012. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  16013. if (gpu !== false) {
  16014. var yPos = undefined,
  16015. xPos = undefined;
  16016. if (_same.top) {
  16017. css.top = 0;
  16018. yPos = _pos.top;
  16019. } else {
  16020. css.bottom = 0;
  16021. yPos = -_pos.bottom;
  16022. }
  16023. if (_same.left) {
  16024. css.left = 0;
  16025. xPos = _pos.left;
  16026. } else {
  16027. css.right = 0;
  16028. xPos = -_pos.right;
  16029. }
  16030. if (window.matchMedia) {
  16031. // HubSpot/tether#207
  16032. var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
  16033. if (!retina) {
  16034. xPos = Math.round(xPos);
  16035. yPos = Math.round(yPos);
  16036. }
  16037. }
  16038. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  16039. if (transformKey !== 'msTransform') {
  16040. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  16041. // but IE9 doesn't support 3d transforms and will choke.
  16042. css[transformKey] += " translateZ(0)";
  16043. }
  16044. } else {
  16045. if (_same.top) {
  16046. css.top = _pos.top + 'px';
  16047. } else {
  16048. css.bottom = _pos.bottom + 'px';
  16049. }
  16050. if (_same.left) {
  16051. css.left = _pos.left + 'px';
  16052. } else {
  16053. css.right = _pos.right + 'px';
  16054. }
  16055. }
  16056. };
  16057. var moved = false;
  16058. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  16059. css.position = 'absolute';
  16060. transcribe(same.page, pos.page);
  16061. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  16062. css.position = 'fixed';
  16063. transcribe(same.viewport, pos.viewport);
  16064. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  16065. (function () {
  16066. css.position = 'absolute';
  16067. var offsetParent = _this8.cache('target-offsetparent', function () {
  16068. return getOffsetParent(_this8.target);
  16069. });
  16070. if (getOffsetParent(_this8.element) !== offsetParent) {
  16071. defer(function () {
  16072. _this8.element.parentNode.removeChild(_this8.element);
  16073. offsetParent.appendChild(_this8.element);
  16074. });
  16075. }
  16076. transcribe(same.offset, pos.offset);
  16077. moved = true;
  16078. })();
  16079. } else {
  16080. css.position = 'absolute';
  16081. transcribe({ top: true, left: true }, pos.page);
  16082. }
  16083. if (!moved) {
  16084. if (this.options.bodyElement) {
  16085. this.options.bodyElement.appendChild(this.element);
  16086. } else {
  16087. var offsetParentIsBody = true;
  16088. var currentNode = this.element.parentNode;
  16089. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  16090. if (getComputedStyle(currentNode).position !== 'static') {
  16091. offsetParentIsBody = false;
  16092. break;
  16093. }
  16094. currentNode = currentNode.parentNode;
  16095. }
  16096. if (!offsetParentIsBody) {
  16097. this.element.parentNode.removeChild(this.element);
  16098. this.element.ownerDocument.body.appendChild(this.element);
  16099. }
  16100. }
  16101. }
  16102. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  16103. var writeCSS = {};
  16104. var write = false;
  16105. for (var key in css) {
  16106. var val = css[key];
  16107. var elVal = this.element.style[key];
  16108. if (elVal !== val) {
  16109. write = true;
  16110. writeCSS[key] = val;
  16111. }
  16112. }
  16113. if (write) {
  16114. defer(function () {
  16115. extend(_this8.element.style, writeCSS);
  16116. _this8.trigger('repositioned');
  16117. });
  16118. }
  16119. }
  16120. }]);
  16121. return TetherClass;
  16122. }(Evented);
  16123. TetherClass.modules = [];
  16124. TetherBase.position = position;
  16125. var Tether = extend(TetherClass, TetherBase);
  16126. /* globals TetherBase */
  16127. 'use strict';
  16128. var _slicedToArray = function () {
  16129. function sliceIterator(arr, i) {
  16130. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16131. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16132. _arr.push(_s.value);if (i && _arr.length === i) break;
  16133. }
  16134. } catch (err) {
  16135. _d = true;_e = err;
  16136. } finally {
  16137. try {
  16138. if (!_n && _i['return']) _i['return']();
  16139. } finally {
  16140. if (_d) throw _e;
  16141. }
  16142. }return _arr;
  16143. }return function (arr, i) {
  16144. if (Array.isArray(arr)) {
  16145. return arr;
  16146. } else if (Symbol.iterator in Object(arr)) {
  16147. return sliceIterator(arr, i);
  16148. } else {
  16149. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16150. }
  16151. };
  16152. }();
  16153. var _TetherBase$Utils = TetherBase.Utils;
  16154. var getBounds = _TetherBase$Utils.getBounds;
  16155. var extend = _TetherBase$Utils.extend;
  16156. var updateClasses = _TetherBase$Utils.updateClasses;
  16157. var defer = _TetherBase$Utils.defer;
  16158. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  16159. function getBoundingRect(tether, to) {
  16160. if (to === 'scrollParent') {
  16161. to = tether.scrollParents[0];
  16162. } else if (to === 'window') {
  16163. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  16164. }
  16165. if (to === document) {
  16166. to = to.documentElement;
  16167. }
  16168. if (typeof to.nodeType !== 'undefined') {
  16169. (function () {
  16170. var node = to;
  16171. var size = getBounds(to);
  16172. var pos = size;
  16173. var style = getComputedStyle(to);
  16174. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  16175. // Account any parent Frames scroll offset
  16176. if (node.ownerDocument !== document) {
  16177. var win = node.ownerDocument.defaultView;
  16178. to[0] += win.pageXOffset;
  16179. to[1] += win.pageYOffset;
  16180. to[2] += win.pageXOffset;
  16181. to[3] += win.pageYOffset;
  16182. }
  16183. BOUNDS_FORMAT.forEach(function (side, i) {
  16184. side = side[0].toUpperCase() + side.substr(1);
  16185. if (side === 'Top' || side === 'Left') {
  16186. to[i] += parseFloat(style['border' + side + 'Width']);
  16187. } else {
  16188. to[i] -= parseFloat(style['border' + side + 'Width']);
  16189. }
  16190. });
  16191. })();
  16192. }
  16193. return to;
  16194. }
  16195. TetherBase.modules.push({
  16196. position: function position(_ref) {
  16197. var _this = this;
  16198. var top = _ref.top;
  16199. var left = _ref.left;
  16200. var targetAttachment = _ref.targetAttachment;
  16201. if (!this.options.constraints) {
  16202. return true;
  16203. }
  16204. var _cache = this.cache('element-bounds', function () {
  16205. return getBounds(_this.element);
  16206. });
  16207. var height = _cache.height;
  16208. var width = _cache.width;
  16209. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16210. var _lastSize = this.lastSize;
  16211. // Handle the item getting hidden as a result of our positioning without glitching
  16212. // the classes in and out
  16213. width = _lastSize.width;
  16214. height = _lastSize.height;
  16215. }
  16216. var targetSize = this.cache('target-bounds', function () {
  16217. return _this.getTargetBounds();
  16218. });
  16219. var targetHeight = targetSize.height;
  16220. var targetWidth = targetSize.width;
  16221. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  16222. this.options.constraints.forEach(function (constraint) {
  16223. var outOfBoundsClass = constraint.outOfBoundsClass;
  16224. var pinnedClass = constraint.pinnedClass;
  16225. if (outOfBoundsClass) {
  16226. allClasses.push(outOfBoundsClass);
  16227. }
  16228. if (pinnedClass) {
  16229. allClasses.push(pinnedClass);
  16230. }
  16231. });
  16232. allClasses.forEach(function (cls) {
  16233. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  16234. allClasses.push(cls + '-' + side);
  16235. });
  16236. });
  16237. var addClasses = [];
  16238. var tAttachment = extend({}, targetAttachment);
  16239. var eAttachment = extend({}, this.attachment);
  16240. this.options.constraints.forEach(function (constraint) {
  16241. var to = constraint.to;
  16242. var attachment = constraint.attachment;
  16243. var pin = constraint.pin;
  16244. if (typeof attachment === 'undefined') {
  16245. attachment = '';
  16246. }
  16247. var changeAttachX = undefined,
  16248. changeAttachY = undefined;
  16249. if (attachment.indexOf(' ') >= 0) {
  16250. var _attachment$split = attachment.split(' ');
  16251. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  16252. changeAttachY = _attachment$split2[0];
  16253. changeAttachX = _attachment$split2[1];
  16254. } else {
  16255. changeAttachX = changeAttachY = attachment;
  16256. }
  16257. var bounds = getBoundingRect(_this, to);
  16258. if (changeAttachY === 'target' || changeAttachY === 'both') {
  16259. if (top < bounds[1] && tAttachment.top === 'top') {
  16260. top += targetHeight;
  16261. tAttachment.top = 'bottom';
  16262. }
  16263. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  16264. top -= targetHeight;
  16265. tAttachment.top = 'top';
  16266. }
  16267. }
  16268. if (changeAttachY === 'together') {
  16269. if (tAttachment.top === 'top') {
  16270. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  16271. top += targetHeight;
  16272. tAttachment.top = 'bottom';
  16273. top += height;
  16274. eAttachment.top = 'top';
  16275. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  16276. top -= height - targetHeight;
  16277. tAttachment.top = 'bottom';
  16278. eAttachment.top = 'bottom';
  16279. }
  16280. }
  16281. if (tAttachment.top === 'bottom') {
  16282. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  16283. top -= targetHeight;
  16284. tAttachment.top = 'top';
  16285. top -= height;
  16286. eAttachment.top = 'bottom';
  16287. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  16288. top += height - targetHeight;
  16289. tAttachment.top = 'top';
  16290. eAttachment.top = 'top';
  16291. }
  16292. }
  16293. if (tAttachment.top === 'middle') {
  16294. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16295. top -= height;
  16296. eAttachment.top = 'bottom';
  16297. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  16298. top += height;
  16299. eAttachment.top = 'top';
  16300. }
  16301. }
  16302. }
  16303. if (changeAttachX === 'target' || changeAttachX === 'both') {
  16304. if (left < bounds[0] && tAttachment.left === 'left') {
  16305. left += targetWidth;
  16306. tAttachment.left = 'right';
  16307. }
  16308. if (left + width > bounds[2] && tAttachment.left === 'right') {
  16309. left -= targetWidth;
  16310. tAttachment.left = 'left';
  16311. }
  16312. }
  16313. if (changeAttachX === 'together') {
  16314. if (left < bounds[0] && tAttachment.left === 'left') {
  16315. if (eAttachment.left === 'right') {
  16316. left += targetWidth;
  16317. tAttachment.left = 'right';
  16318. left += width;
  16319. eAttachment.left = 'left';
  16320. } else if (eAttachment.left === 'left') {
  16321. left += targetWidth;
  16322. tAttachment.left = 'right';
  16323. left -= width;
  16324. eAttachment.left = 'right';
  16325. }
  16326. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  16327. if (eAttachment.left === 'left') {
  16328. left -= targetWidth;
  16329. tAttachment.left = 'left';
  16330. left -= width;
  16331. eAttachment.left = 'right';
  16332. } else if (eAttachment.left === 'right') {
  16333. left -= targetWidth;
  16334. tAttachment.left = 'left';
  16335. left += width;
  16336. eAttachment.left = 'left';
  16337. }
  16338. } else if (tAttachment.left === 'center') {
  16339. if (left + width > bounds[2] && eAttachment.left === 'left') {
  16340. left -= width;
  16341. eAttachment.left = 'right';
  16342. } else if (left < bounds[0] && eAttachment.left === 'right') {
  16343. left += width;
  16344. eAttachment.left = 'left';
  16345. }
  16346. }
  16347. }
  16348. if (changeAttachY === 'element' || changeAttachY === 'both') {
  16349. if (top < bounds[1] && eAttachment.top === 'bottom') {
  16350. top += height;
  16351. eAttachment.top = 'top';
  16352. }
  16353. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16354. top -= height;
  16355. eAttachment.top = 'bottom';
  16356. }
  16357. }
  16358. if (changeAttachX === 'element' || changeAttachX === 'both') {
  16359. if (left < bounds[0]) {
  16360. if (eAttachment.left === 'right') {
  16361. left += width;
  16362. eAttachment.left = 'left';
  16363. } else if (eAttachment.left === 'center') {
  16364. left += width / 2;
  16365. eAttachment.left = 'left';
  16366. }
  16367. }
  16368. if (left + width > bounds[2]) {
  16369. if (eAttachment.left === 'left') {
  16370. left -= width;
  16371. eAttachment.left = 'right';
  16372. } else if (eAttachment.left === 'center') {
  16373. left -= width / 2;
  16374. eAttachment.left = 'right';
  16375. }
  16376. }
  16377. }
  16378. if (typeof pin === 'string') {
  16379. pin = pin.split(',').map(function (p) {
  16380. return p.trim();
  16381. });
  16382. } else if (pin === true) {
  16383. pin = ['top', 'left', 'right', 'bottom'];
  16384. }
  16385. pin = pin || [];
  16386. var pinned = [];
  16387. var oob = [];
  16388. if (top < bounds[1]) {
  16389. if (pin.indexOf('top') >= 0) {
  16390. top = bounds[1];
  16391. pinned.push('top');
  16392. } else {
  16393. oob.push('top');
  16394. }
  16395. }
  16396. if (top + height > bounds[3]) {
  16397. if (pin.indexOf('bottom') >= 0) {
  16398. top = bounds[3] - height;
  16399. pinned.push('bottom');
  16400. } else {
  16401. oob.push('bottom');
  16402. }
  16403. }
  16404. if (left < bounds[0]) {
  16405. if (pin.indexOf('left') >= 0) {
  16406. left = bounds[0];
  16407. pinned.push('left');
  16408. } else {
  16409. oob.push('left');
  16410. }
  16411. }
  16412. if (left + width > bounds[2]) {
  16413. if (pin.indexOf('right') >= 0) {
  16414. left = bounds[2] - width;
  16415. pinned.push('right');
  16416. } else {
  16417. oob.push('right');
  16418. }
  16419. }
  16420. if (pinned.length) {
  16421. (function () {
  16422. var pinnedClass = undefined;
  16423. if (typeof _this.options.pinnedClass !== 'undefined') {
  16424. pinnedClass = _this.options.pinnedClass;
  16425. } else {
  16426. pinnedClass = _this.getClass('pinned');
  16427. }
  16428. addClasses.push(pinnedClass);
  16429. pinned.forEach(function (side) {
  16430. addClasses.push(pinnedClass + '-' + side);
  16431. });
  16432. })();
  16433. }
  16434. if (oob.length) {
  16435. (function () {
  16436. var oobClass = undefined;
  16437. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  16438. oobClass = _this.options.outOfBoundsClass;
  16439. } else {
  16440. oobClass = _this.getClass('out-of-bounds');
  16441. }
  16442. addClasses.push(oobClass);
  16443. oob.forEach(function (side) {
  16444. addClasses.push(oobClass + '-' + side);
  16445. });
  16446. })();
  16447. }
  16448. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  16449. eAttachment.left = tAttachment.left = false;
  16450. }
  16451. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  16452. eAttachment.top = tAttachment.top = false;
  16453. }
  16454. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  16455. _this.updateAttachClasses(eAttachment, tAttachment);
  16456. _this.trigger('update', {
  16457. attachment: eAttachment,
  16458. targetAttachment: tAttachment
  16459. });
  16460. }
  16461. });
  16462. defer(function () {
  16463. if (!(_this.options.addTargetClasses === false)) {
  16464. updateClasses(_this.target, addClasses, allClasses);
  16465. }
  16466. updateClasses(_this.element, addClasses, allClasses);
  16467. });
  16468. return { top: top, left: left };
  16469. }
  16470. });
  16471. /* globals TetherBase */
  16472. 'use strict';
  16473. var _TetherBase$Utils = TetherBase.Utils;
  16474. var getBounds = _TetherBase$Utils.getBounds;
  16475. var updateClasses = _TetherBase$Utils.updateClasses;
  16476. var defer = _TetherBase$Utils.defer;
  16477. TetherBase.modules.push({
  16478. position: function position(_ref) {
  16479. var _this = this;
  16480. var top = _ref.top;
  16481. var left = _ref.left;
  16482. var _cache = this.cache('element-bounds', function () {
  16483. return getBounds(_this.element);
  16484. });
  16485. var height = _cache.height;
  16486. var width = _cache.width;
  16487. var targetPos = this.getTargetBounds();
  16488. var bottom = top + height;
  16489. var right = left + width;
  16490. var abutted = [];
  16491. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  16492. ['left', 'right'].forEach(function (side) {
  16493. var targetPosSide = targetPos[side];
  16494. if (targetPosSide === left || targetPosSide === right) {
  16495. abutted.push(side);
  16496. }
  16497. });
  16498. }
  16499. if (left <= targetPos.right && right >= targetPos.left) {
  16500. ['top', 'bottom'].forEach(function (side) {
  16501. var targetPosSide = targetPos[side];
  16502. if (targetPosSide === top || targetPosSide === bottom) {
  16503. abutted.push(side);
  16504. }
  16505. });
  16506. }
  16507. var allClasses = [];
  16508. var addClasses = [];
  16509. var sides = ['left', 'top', 'right', 'bottom'];
  16510. allClasses.push(this.getClass('abutted'));
  16511. sides.forEach(function (side) {
  16512. allClasses.push(_this.getClass('abutted') + '-' + side);
  16513. });
  16514. if (abutted.length) {
  16515. addClasses.push(this.getClass('abutted'));
  16516. }
  16517. abutted.forEach(function (side) {
  16518. addClasses.push(_this.getClass('abutted') + '-' + side);
  16519. });
  16520. defer(function () {
  16521. if (!(_this.options.addTargetClasses === false)) {
  16522. updateClasses(_this.target, addClasses, allClasses);
  16523. }
  16524. updateClasses(_this.element, addClasses, allClasses);
  16525. });
  16526. return true;
  16527. }
  16528. });
  16529. /* globals TetherBase */
  16530. 'use strict';
  16531. var _slicedToArray = function () {
  16532. function sliceIterator(arr, i) {
  16533. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16534. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16535. _arr.push(_s.value);if (i && _arr.length === i) break;
  16536. }
  16537. } catch (err) {
  16538. _d = true;_e = err;
  16539. } finally {
  16540. try {
  16541. if (!_n && _i['return']) _i['return']();
  16542. } finally {
  16543. if (_d) throw _e;
  16544. }
  16545. }return _arr;
  16546. }return function (arr, i) {
  16547. if (Array.isArray(arr)) {
  16548. return arr;
  16549. } else if (Symbol.iterator in Object(arr)) {
  16550. return sliceIterator(arr, i);
  16551. } else {
  16552. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16553. }
  16554. };
  16555. }();
  16556. TetherBase.modules.push({
  16557. position: function position(_ref) {
  16558. var top = _ref.top;
  16559. var left = _ref.left;
  16560. if (!this.options.shift) {
  16561. return;
  16562. }
  16563. var shift = this.options.shift;
  16564. if (typeof this.options.shift === 'function') {
  16565. shift = this.options.shift.call(this, { top: top, left: left });
  16566. }
  16567. var shiftTop = undefined,
  16568. shiftLeft = undefined;
  16569. if (typeof shift === 'string') {
  16570. shift = shift.split(' ');
  16571. shift[1] = shift[1] || shift[0];
  16572. var _shift = shift;
  16573. var _shift2 = _slicedToArray(_shift, 2);
  16574. shiftTop = _shift2[0];
  16575. shiftLeft = _shift2[1];
  16576. shiftTop = parseFloat(shiftTop, 10);
  16577. shiftLeft = parseFloat(shiftLeft, 10);
  16578. } else {
  16579. shiftTop = shift.top;
  16580. shiftLeft = shift.left;
  16581. }
  16582. top += shiftTop;
  16583. left += shiftLeft;
  16584. return { top: top, left: left };
  16585. }
  16586. });
  16587. return Tether;
  16588. });
  16589. /***/ }),
  16590. /* 35 */
  16591. /***/ (function(module, exports, __webpack_require__) {
  16592. "use strict";
  16593. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  16594. /*
  16595. * Toastr
  16596. * Copyright 2012-2015
  16597. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  16598. * All Rights Reserved.
  16599. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  16600. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  16601. *
  16602. * ARIA Support: Greta Krafsig
  16603. *
  16604. * Project: https://github.com/CodeSeven/toastr
  16605. */
  16606. /* global define */
  16607. (function (define) {
  16608. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  16609. return function () {
  16610. var $container;
  16611. var listener;
  16612. var toastId = 0;
  16613. var toastType = {
  16614. error: 'error',
  16615. info: 'info',
  16616. success: 'success',
  16617. warning: 'warning'
  16618. };
  16619. var toastr = {
  16620. clear: clear,
  16621. remove: remove,
  16622. error: error,
  16623. getContainer: getContainer,
  16624. info: info,
  16625. options: {},
  16626. subscribe: subscribe,
  16627. success: success,
  16628. version: '2.1.3',
  16629. warning: warning
  16630. };
  16631. var previousToast;
  16632. return toastr;
  16633. ////////////////
  16634. function error(message, title, optionsOverride) {
  16635. return notify({
  16636. type: toastType.error,
  16637. iconClass: getOptions().iconClasses.error,
  16638. message: message,
  16639. optionsOverride: optionsOverride,
  16640. title: title
  16641. });
  16642. }
  16643. function getContainer(options, create) {
  16644. if (!options) {
  16645. options = getOptions();
  16646. }
  16647. $container = $('#' + options.containerId);
  16648. if ($container.length) {
  16649. return $container;
  16650. }
  16651. if (create) {
  16652. $container = createContainer(options);
  16653. }
  16654. return $container;
  16655. }
  16656. function info(message, title, optionsOverride) {
  16657. return notify({
  16658. type: toastType.info,
  16659. iconClass: getOptions().iconClasses.info,
  16660. message: message,
  16661. optionsOverride: optionsOverride,
  16662. title: title
  16663. });
  16664. }
  16665. function subscribe(callback) {
  16666. listener = callback;
  16667. }
  16668. function success(message, title, optionsOverride) {
  16669. return notify({
  16670. type: toastType.success,
  16671. iconClass: getOptions().iconClasses.success,
  16672. message: message,
  16673. optionsOverride: optionsOverride,
  16674. title: title
  16675. });
  16676. }
  16677. function warning(message, title, optionsOverride) {
  16678. return notify({
  16679. type: toastType.warning,
  16680. iconClass: getOptions().iconClasses.warning,
  16681. message: message,
  16682. optionsOverride: optionsOverride,
  16683. title: title
  16684. });
  16685. }
  16686. function clear($toastElement, clearOptions) {
  16687. var options = getOptions();
  16688. if (!$container) {
  16689. getContainer(options);
  16690. }
  16691. if (!clearToast($toastElement, options, clearOptions)) {
  16692. clearContainer(options);
  16693. }
  16694. }
  16695. function remove($toastElement) {
  16696. var options = getOptions();
  16697. if (!$container) {
  16698. getContainer(options);
  16699. }
  16700. if ($toastElement && $(':focus', $toastElement).length === 0) {
  16701. removeToast($toastElement);
  16702. return;
  16703. }
  16704. if ($container.children().length) {
  16705. $container.remove();
  16706. }
  16707. }
  16708. // internal functions
  16709. function clearContainer(options) {
  16710. var toastsToClear = $container.children();
  16711. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  16712. clearToast($(toastsToClear[i]), options);
  16713. }
  16714. }
  16715. function clearToast($toastElement, options, clearOptions) {
  16716. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  16717. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  16718. $toastElement[options.hideMethod]({
  16719. duration: options.hideDuration,
  16720. easing: options.hideEasing,
  16721. complete: function complete() {
  16722. removeToast($toastElement);
  16723. }
  16724. });
  16725. return true;
  16726. }
  16727. return false;
  16728. }
  16729. function createContainer(options) {
  16730. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  16731. $container.appendTo($(options.target));
  16732. return $container;
  16733. }
  16734. function getDefaults() {
  16735. return {
  16736. tapToDismiss: true,
  16737. toastClass: 'toast',
  16738. containerId: 'toast-container',
  16739. debug: false,
  16740. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  16741. showDuration: 300,
  16742. showEasing: 'swing', //swing and linear are built into jQuery
  16743. onShown: undefined,
  16744. hideMethod: 'fadeOut',
  16745. hideDuration: 1000,
  16746. hideEasing: 'swing',
  16747. onHidden: undefined,
  16748. closeMethod: false,
  16749. closeDuration: false,
  16750. closeEasing: false,
  16751. closeOnHover: true,
  16752. extendedTimeOut: 1000,
  16753. iconClasses: {
  16754. error: 'toast-error',
  16755. info: 'toast-info',
  16756. success: 'toast-success',
  16757. warning: 'toast-warning'
  16758. },
  16759. iconClass: 'toast-info',
  16760. positionClass: 'toast-top-right',
  16761. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  16762. titleClass: 'toast-title',
  16763. messageClass: 'toast-message',
  16764. escapeHtml: false,
  16765. target: 'body',
  16766. closeHtml: '<button type="button">&times;</button>',
  16767. closeClass: 'toast-close-button',
  16768. newestOnTop: true,
  16769. preventDuplicates: false,
  16770. progressBar: false,
  16771. progressClass: 'toast-progress',
  16772. rtl: false
  16773. };
  16774. }
  16775. function publish(args) {
  16776. if (!listener) {
  16777. return;
  16778. }
  16779. listener(args);
  16780. }
  16781. function notify(map) {
  16782. var options = getOptions();
  16783. var iconClass = map.iconClass || options.iconClass;
  16784. if (typeof map.optionsOverride !== 'undefined') {
  16785. options = $.extend(options, map.optionsOverride);
  16786. iconClass = map.optionsOverride.iconClass || iconClass;
  16787. }
  16788. if (shouldExit(options, map)) {
  16789. return;
  16790. }
  16791. toastId++;
  16792. $container = getContainer(options, true);
  16793. var intervalId = null;
  16794. var $toastElement = $('<div/>');
  16795. var $titleElement = $('<div/>');
  16796. var $messageElement = $('<div/>');
  16797. var $progressElement = $('<div/>');
  16798. var $closeElement = $(options.closeHtml);
  16799. var progressBar = {
  16800. intervalId: null,
  16801. hideEta: null,
  16802. maxHideTime: null
  16803. };
  16804. var response = {
  16805. toastId: toastId,
  16806. state: 'visible',
  16807. startTime: new Date(),
  16808. options: options,
  16809. map: map
  16810. };
  16811. personalizeToast();
  16812. displayToast();
  16813. handleEvents();
  16814. publish(response);
  16815. if (options.debug && console) {
  16816. console.log(response);
  16817. }
  16818. return $toastElement;
  16819. function escapeHtml(source) {
  16820. if (source == null) {
  16821. source = '';
  16822. }
  16823. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  16824. }
  16825. function personalizeToast() {
  16826. setIcon();
  16827. setTitle();
  16828. setMessage();
  16829. setCloseButton();
  16830. setProgressBar();
  16831. setRTL();
  16832. setSequence();
  16833. setAria();
  16834. }
  16835. function setAria() {
  16836. var ariaValue = '';
  16837. switch (map.iconClass) {
  16838. case 'toast-success':
  16839. case 'toast-info':
  16840. ariaValue = 'polite';
  16841. break;
  16842. default:
  16843. ariaValue = 'assertive';
  16844. }
  16845. $toastElement.attr('aria-live', ariaValue);
  16846. }
  16847. function handleEvents() {
  16848. if (options.closeOnHover) {
  16849. $toastElement.hover(stickAround, delayedHideToast);
  16850. }
  16851. if (!options.onclick && options.tapToDismiss) {
  16852. $toastElement.click(hideToast);
  16853. }
  16854. if (options.closeButton && $closeElement) {
  16855. $closeElement.click(function (event) {
  16856. if (event.stopPropagation) {
  16857. event.stopPropagation();
  16858. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  16859. event.cancelBubble = true;
  16860. }
  16861. if (options.onCloseClick) {
  16862. options.onCloseClick(event);
  16863. }
  16864. hideToast(true);
  16865. });
  16866. }
  16867. if (options.onclick) {
  16868. $toastElement.click(function (event) {
  16869. options.onclick(event);
  16870. hideToast();
  16871. });
  16872. }
  16873. }
  16874. function displayToast() {
  16875. $toastElement.hide();
  16876. $toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });
  16877. if (options.timeOut > 0) {
  16878. intervalId = setTimeout(hideToast, options.timeOut);
  16879. progressBar.maxHideTime = parseFloat(options.timeOut);
  16880. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16881. if (options.progressBar) {
  16882. progressBar.intervalId = setInterval(updateProgress, 10);
  16883. }
  16884. }
  16885. }
  16886. function setIcon() {
  16887. if (map.iconClass) {
  16888. $toastElement.addClass(options.toastClass).addClass(iconClass).addClass('mg-toast');
  16889. }
  16890. }
  16891. function setSequence() {
  16892. if (options.newestOnTop) {
  16893. $container.prepend($toastElement);
  16894. } else {
  16895. $container.append($toastElement);
  16896. }
  16897. }
  16898. function setTitle() {
  16899. if (map.title) {
  16900. var suffix = map.title;
  16901. if (options.escapeHtml) {
  16902. suffix = escapeHtml(map.title);
  16903. }
  16904. $titleElement.append(suffix).addClass(options.titleClass);
  16905. $toastElement.append($titleElement);
  16906. }
  16907. }
  16908. function setMessage() {
  16909. if (map.message) {
  16910. var suffix = map.message;
  16911. if (options.escapeHtml) {
  16912. suffix = escapeHtml(map.message);
  16913. }
  16914. $messageElement.append(suffix).addClass(options.messageClass);
  16915. $toastElement.append($messageElement);
  16916. }
  16917. }
  16918. function setCloseButton() {
  16919. if (options.closeButton) {
  16920. $closeElement.addClass(options.closeClass).attr('role', 'button');
  16921. $toastElement.prepend($closeElement);
  16922. }
  16923. }
  16924. function setProgressBar() {
  16925. if (options.progressBar) {
  16926. $progressElement.addClass(options.progressClass);
  16927. $toastElement.prepend($progressElement);
  16928. }
  16929. }
  16930. function setRTL() {
  16931. if (options.rtl) {
  16932. $toastElement.addClass('rtl');
  16933. }
  16934. }
  16935. function shouldExit(options, map) {
  16936. if (options.preventDuplicates) {
  16937. if (map.message === previousToast) {
  16938. return true;
  16939. } else {
  16940. previousToast = map.message;
  16941. }
  16942. }
  16943. return false;
  16944. }
  16945. function hideToast(override) {
  16946. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  16947. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  16948. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  16949. if ($(':focus', $toastElement).length && !override) {
  16950. return;
  16951. }
  16952. clearTimeout(progressBar.intervalId);
  16953. return $toastElement[method]({
  16954. duration: duration,
  16955. easing: easing,
  16956. complete: function complete() {
  16957. removeToast($toastElement);
  16958. clearTimeout(intervalId);
  16959. if (options.onHidden && response.state !== 'hidden') {
  16960. options.onHidden();
  16961. }
  16962. response.state = 'hidden';
  16963. response.endTime = new Date();
  16964. publish(response);
  16965. }
  16966. });
  16967. }
  16968. function delayedHideToast() {
  16969. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  16970. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  16971. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  16972. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16973. }
  16974. }
  16975. function stickAround() {
  16976. clearTimeout(intervalId);
  16977. progressBar.hideEta = 0;
  16978. $toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });
  16979. }
  16980. function updateProgress() {
  16981. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  16982. $progressElement.width(percentage + '%');
  16983. }
  16984. }
  16985. function getOptions() {
  16986. return $.extend({}, getDefaults(), toastr.options);
  16987. }
  16988. function removeToast($toastElement) {
  16989. if (!$container) {
  16990. $container = getContainer();
  16991. }
  16992. if ($toastElement.is(':visible')) {
  16993. return;
  16994. }
  16995. $toastElement.remove();
  16996. $toastElement = null;
  16997. if ($container.children().length === 0) {
  16998. $container.remove();
  16999. previousToast = undefined;
  17000. }
  17001. }
  17002. }();
  17003. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17004. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17005. })(__webpack_require__(36));
  17006. /***/ }),
  17007. /* 36 */
  17008. /***/ (function(module, exports) {
  17009. module.exports = function() {
  17010. throw new Error("define cannot be used indirect");
  17011. };
  17012. /***/ })
  17013. /******/ ]);