layers-ui.js 663 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624
  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. return '<div class="option">'
  10307. + '<div class="title" style="font-size: 16px;">'+escape(data[field_label])+'</div>'
  10308. + '<div class="desc">'
  10309. + data['description']
  10310. + '</div>'
  10311. + '</div>';
  10312. }
  10313. return '<div class="option">' + escape(data[field_label]) + '</div>';
  10314. },
  10315. 'item': function item(data, escape) {
  10316. if(data.description) {
  10317. return '<div class="item">'
  10318. + '<div class="title" style="font-size: 16px;">'+escape(data[field_label])+'</div>'
  10319. + '<div class="desc">'
  10320. + data['description']
  10321. + '</div>'
  10322. + '</div>';
  10323. }
  10324. return '<div class="item">' + escape(data[field_label]) + '</div>';
  10325. },
  10326. 'option_create': function option_create(data, escape) {
  10327. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  10328. }
  10329. };
  10330. self.settings.render = $.extend({}, templates, self.settings.render);
  10331. },
  10332. /**
  10333. * Maps fired events to callbacks provided
  10334. * in the settings used when creating the control.
  10335. */
  10336. setupCallbacks: function setupCallbacks() {
  10337. var key,
  10338. fn,
  10339. callbacks = {
  10340. 'initialize': 'onInitialize',
  10341. 'change': 'onChange',
  10342. 'item_add': 'onItemAdd',
  10343. 'item_remove': 'onItemRemove',
  10344. 'clear': 'onClear',
  10345. 'option_add': 'onOptionAdd',
  10346. 'option_remove': 'onOptionRemove',
  10347. 'option_clear': 'onOptionClear',
  10348. 'optgroup_add': 'onOptionGroupAdd',
  10349. 'optgroup_remove': 'onOptionGroupRemove',
  10350. 'optgroup_clear': 'onOptionGroupClear',
  10351. 'dropdown_open': 'onDropdownOpen',
  10352. 'dropdown_close': 'onDropdownClose',
  10353. 'type': 'onType',
  10354. 'load': 'onLoad',
  10355. 'focus': 'onFocus',
  10356. 'blur': 'onBlur'
  10357. };
  10358. for (key in callbacks) {
  10359. if (callbacks.hasOwnProperty(key)) {
  10360. fn = this.settings[callbacks[key]];
  10361. if (fn) this.on(key, fn);
  10362. }
  10363. }
  10364. },
  10365. /**
  10366. * Triggered when the main control element
  10367. * has a click event.
  10368. *
  10369. * @param {object} e
  10370. * @return {boolean}
  10371. */
  10372. onClick: function onClick(e) {
  10373. var self = this;
  10374. // necessary for mobile webkit devices (manual focus triggering
  10375. // is ignored unless invoked within a click event)
  10376. if (!self.isFocused) {
  10377. self.focus();
  10378. e.preventDefault();
  10379. }
  10380. },
  10381. /**
  10382. * Triggered when the main control element
  10383. * has a mouse down event.
  10384. *
  10385. * @param {object} e
  10386. * @return {boolean}
  10387. */
  10388. onMouseDown: function onMouseDown(e) {
  10389. var self = this;
  10390. var defaultPrevented = e.isDefaultPrevented();
  10391. var $target = $(e.target);
  10392. if (self.isFocused) {
  10393. // retain focus by preventing native handling. if the
  10394. // event target is the input it should not be modified.
  10395. // otherwise, text selection within the input won't work.
  10396. if (e.target !== self.$control_input[0]) {
  10397. if (self.settings.mode === 'single') {
  10398. // toggle dropdown
  10399. self.isOpen ? self.close() : self.open();
  10400. } else if (!defaultPrevented) {
  10401. self.setActiveItem(null);
  10402. }
  10403. return false;
  10404. }
  10405. } else {
  10406. // give control focus
  10407. if (!defaultPrevented) {
  10408. window.setTimeout(function () {
  10409. self.focus();
  10410. }, 0);
  10411. }
  10412. }
  10413. },
  10414. /**
  10415. * Triggered when the value of the control has been changed.
  10416. * This should propagate the event to the original DOM
  10417. * input / select element.
  10418. */
  10419. onChange: function onChange() {
  10420. this.$input.trigger('change');
  10421. },
  10422. /**
  10423. * Triggered on <input> paste.
  10424. *
  10425. * @param {object} e
  10426. * @returns {boolean}
  10427. */
  10428. onPaste: function onPaste(e) {
  10429. var self = this;
  10430. if (self.isFull() || self.isInputHidden || self.isLocked) {
  10431. e.preventDefault();
  10432. return;
  10433. }
  10434. // If a regex or string is included, this will split the pasted
  10435. // input and create Items for each separate value
  10436. if (self.settings.splitOn) {
  10437. // Wait for pasted text to be recognized in value
  10438. setTimeout(function () {
  10439. var pastedText = self.$control_input.val();
  10440. if (!pastedText.match(self.settings.splitOn)) {
  10441. return;
  10442. }
  10443. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  10444. for (var i = 0, n = splitInput.length; i < n; i++) {
  10445. self.createItem(splitInput[i]);
  10446. }
  10447. }, 0);
  10448. }
  10449. },
  10450. /**
  10451. * Triggered on <input> keypress.
  10452. *
  10453. * @param {object} e
  10454. * @returns {boolean}
  10455. */
  10456. onKeyPress: function onKeyPress(e) {
  10457. if (this.isLocked) return e && e.preventDefault();
  10458. var character = String.fromCharCode(e.keyCode || e.which);
  10459. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  10460. this.createItem();
  10461. e.preventDefault();
  10462. return false;
  10463. }
  10464. },
  10465. /**
  10466. * Triggered on <input> keydown.
  10467. *
  10468. * @param {object} e
  10469. * @returns {boolean}
  10470. */
  10471. onKeyDown: function onKeyDown(e) {
  10472. var isInput = e.target === this.$control_input[0];
  10473. var self = this;
  10474. if (self.isLocked) {
  10475. if (e.keyCode !== KEY_TAB) {
  10476. e.preventDefault();
  10477. }
  10478. return;
  10479. }
  10480. switch (e.keyCode) {
  10481. case KEY_A:
  10482. if (self.isCmdDown) {
  10483. self.selectAll();
  10484. return;
  10485. }
  10486. break;
  10487. case KEY_ESC:
  10488. if (self.isOpen) {
  10489. e.preventDefault();
  10490. e.stopPropagation();
  10491. self.close();
  10492. }
  10493. return;
  10494. case KEY_N:
  10495. if (!e.ctrlKey || e.altKey) break;
  10496. case KEY_DOWN:
  10497. if (!self.isOpen && self.hasOptions) {
  10498. self.open();
  10499. } else if (self.$activeOption) {
  10500. self.ignoreHover = true;
  10501. var $next = self.getAdjacentOption(self.$activeOption, 1);
  10502. if ($next.length) self.setActiveOption($next, true, true);
  10503. }
  10504. e.preventDefault();
  10505. return;
  10506. case KEY_P:
  10507. if (!e.ctrlKey || e.altKey) break;
  10508. case KEY_UP:
  10509. if (self.$activeOption) {
  10510. self.ignoreHover = true;
  10511. var $prev = self.getAdjacentOption(self.$activeOption, -1);
  10512. if ($prev.length) self.setActiveOption($prev, true, true);
  10513. }
  10514. e.preventDefault();
  10515. return;
  10516. case KEY_RETURN:
  10517. if (self.isOpen && self.$activeOption) {
  10518. self.onOptionSelect({ currentTarget: self.$activeOption });
  10519. e.preventDefault();
  10520. }
  10521. return;
  10522. case KEY_LEFT:
  10523. self.advanceSelection(-1, e);
  10524. return;
  10525. case KEY_RIGHT:
  10526. self.advanceSelection(1, e);
  10527. return;
  10528. case KEY_TAB:
  10529. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  10530. self.onOptionSelect({ currentTarget: self.$activeOption });
  10531. // Default behaviour is to jump to the next field, we only want this
  10532. // if the current field doesn't accept any more entries
  10533. if (!self.isFull()) {
  10534. e.preventDefault();
  10535. }
  10536. }
  10537. if (self.settings.create && self.createItem()) {
  10538. e.preventDefault();
  10539. }
  10540. return;
  10541. case KEY_BACKSPACE:
  10542. case KEY_DELETE:
  10543. self.deleteSelection(e);
  10544. return;
  10545. }
  10546. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  10547. e.preventDefault();
  10548. return;
  10549. }
  10550. },
  10551. /**
  10552. * Triggered on <input> keyup.
  10553. *
  10554. * @param {object} e
  10555. * @returns {boolean}
  10556. */
  10557. onKeyUp: function onKeyUp(e) {
  10558. var self = this;
  10559. if (self.isLocked) return e && e.preventDefault();
  10560. var value = self.$control_input.val() || '';
  10561. if (self.lastValue !== value) {
  10562. self.lastValue = value;
  10563. self.onSearchChange(value);
  10564. self.refreshOptions();
  10565. self.trigger('type', value);
  10566. }
  10567. },
  10568. /**
  10569. * Invokes the user-provide option provider / loader.
  10570. *
  10571. * Note: this function is debounced in the Selectize
  10572. * constructor (by `settings.loadThrottle` milliseconds)
  10573. *
  10574. * @param {string} value
  10575. */
  10576. onSearchChange: function onSearchChange(value) {
  10577. var self = this;
  10578. var fn = self.settings.load;
  10579. if (!fn) return;
  10580. if (self.loadedSearches.hasOwnProperty(value)) return;
  10581. self.loadedSearches[value] = true;
  10582. self.load(function (callback) {
  10583. fn.apply(self, [value, callback]);
  10584. });
  10585. },
  10586. /**
  10587. * Triggered on <input> focus.
  10588. *
  10589. * @param {object} e (optional)
  10590. * @returns {boolean}
  10591. */
  10592. onFocus: function onFocus(e) {
  10593. var self = this;
  10594. var wasFocused = self.isFocused;
  10595. if (self.isDisabled) {
  10596. self.blur();
  10597. e && e.preventDefault();
  10598. return false;
  10599. }
  10600. if (self.ignoreFocus) return;
  10601. self.isFocused = true;
  10602. if (self.settings.preload === 'focus') self.onSearchChange('');
  10603. if (!wasFocused) self.trigger('focus');
  10604. if (!self.$activeItems.length) {
  10605. self.showInput();
  10606. self.setActiveItem(null);
  10607. self.refreshOptions(!!self.settings.openOnFocus);
  10608. }
  10609. self.refreshState();
  10610. },
  10611. /**
  10612. * Triggered on <input> blur.
  10613. *
  10614. * @param {object} e
  10615. * @param {Element} dest
  10616. */
  10617. onBlur: function onBlur(e, dest) {
  10618. var self = this;
  10619. if (!self.isFocused) return;
  10620. self.isFocused = false;
  10621. if (self.ignoreFocus) {
  10622. return;
  10623. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  10624. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  10625. self.ignoreBlur = true;
  10626. self.onFocus(e);
  10627. return;
  10628. }
  10629. var deactivate = function deactivate() {
  10630. self.close();
  10631. self.setTextboxValue('');
  10632. self.setActiveItem(null);
  10633. self.setActiveOption(null);
  10634. self.setCaret(self.items.length);
  10635. self.refreshState();
  10636. // IE11 bug: element still marked as active
  10637. dest && dest.focus && dest.focus();
  10638. self.ignoreFocus = false;
  10639. self.trigger('blur');
  10640. };
  10641. self.ignoreFocus = true;
  10642. if (self.settings.create && self.settings.createOnBlur) {
  10643. self.createItem(null, false, deactivate);
  10644. } else {
  10645. deactivate();
  10646. }
  10647. },
  10648. /**
  10649. * Triggered when the user rolls over
  10650. * an option in the autocomplete dropdown menu.
  10651. *
  10652. * @param {object} e
  10653. * @returns {boolean}
  10654. */
  10655. onOptionHover: function onOptionHover(e) {
  10656. if (this.ignoreHover) return;
  10657. this.setActiveOption(e.currentTarget, false);
  10658. },
  10659. /**
  10660. * Triggered when the user clicks on an option
  10661. * in the autocomplete dropdown menu.
  10662. *
  10663. * @param {object} e
  10664. * @returns {boolean}
  10665. */
  10666. onOptionSelect: function onOptionSelect(e) {
  10667. var value,
  10668. $target,
  10669. $option,
  10670. self = this;
  10671. if (e.preventDefault) {
  10672. e.preventDefault();
  10673. e.stopPropagation();
  10674. }
  10675. $target = $(e.currentTarget);
  10676. if ($target.hasClass('create')) {
  10677. self.createItem(null, function () {
  10678. if (self.settings.closeAfterSelect) {
  10679. self.close();
  10680. }
  10681. });
  10682. } else {
  10683. value = $target.attr('data-value');
  10684. if (typeof value !== 'undefined') {
  10685. self.lastQuery = null;
  10686. self.setTextboxValue('');
  10687. self.addItem(value);
  10688. if (self.settings.closeAfterSelect) {
  10689. self.close();
  10690. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  10691. self.setActiveOption(self.getOption(value));
  10692. }
  10693. }
  10694. }
  10695. },
  10696. /**
  10697. * Triggered when the user clicks on an item
  10698. * that has been selected.
  10699. *
  10700. * @param {object} e
  10701. * @returns {boolean}
  10702. */
  10703. onItemSelect: function onItemSelect(e) {
  10704. var self = this;
  10705. if (self.isLocked) return;
  10706. if (self.settings.mode === 'multi') {
  10707. e.preventDefault();
  10708. self.setActiveItem(e.currentTarget, e);
  10709. }
  10710. },
  10711. /**
  10712. * Invokes the provided method that provides
  10713. * results to a callback---which are then added
  10714. * as options to the control.
  10715. *
  10716. * @param {function} fn
  10717. */
  10718. load: function load(fn) {
  10719. var self = this;
  10720. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  10721. self.loading++;
  10722. fn.apply(self, [function (results) {
  10723. self.loading = Math.max(self.loading - 1, 0);
  10724. if (results && results.length) {
  10725. self.addOption(results);
  10726. self.refreshOptions(self.isFocused && !self.isInputHidden);
  10727. }
  10728. if (!self.loading) {
  10729. $wrapper.removeClass(self.settings.loadingClass);
  10730. }
  10731. self.trigger('load', results);
  10732. }]);
  10733. },
  10734. /**
  10735. * Sets the input field of the control to the specified value.
  10736. *
  10737. * @param {string} value
  10738. */
  10739. setTextboxValue: function setTextboxValue(value) {
  10740. var $input = this.$control_input;
  10741. var changed = $input.val() !== value;
  10742. if (changed) {
  10743. $input.val(value).triggerHandler('update');
  10744. this.lastValue = value;
  10745. }
  10746. },
  10747. /**
  10748. * Returns the value of the control. If multiple items
  10749. * can be selected (e.g. <select multiple>), this returns
  10750. * an array. If only one item can be selected, this
  10751. * returns a string.
  10752. *
  10753. * @returns {mixed}
  10754. */
  10755. getValue: function getValue() {
  10756. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  10757. return this.items;
  10758. } else {
  10759. return this.items.join(this.settings.delimiter);
  10760. }
  10761. },
  10762. /**
  10763. * Resets the selected items to the given value.
  10764. *
  10765. * @param {mixed} value
  10766. */
  10767. setValue: function setValue(value, silent) {
  10768. var events = silent ? [] : ['change'];
  10769. debounce_events(this, events, function () {
  10770. this.clear(silent);
  10771. this.addItems(value, silent);
  10772. });
  10773. },
  10774. /**
  10775. * Sets the selected item.
  10776. *
  10777. * @param {object} $item
  10778. * @param {object} e (optional)
  10779. */
  10780. setActiveItem: function setActiveItem($item, e) {
  10781. var self = this;
  10782. var eventName;
  10783. var i, idx, begin, end, item, swap;
  10784. var $last;
  10785. if (self.settings.mode === 'single') return;
  10786. $item = $($item);
  10787. // clear the active selection
  10788. if (!$item.length) {
  10789. $(self.$activeItems).removeClass('active');
  10790. self.$activeItems = [];
  10791. if (self.isFocused) {
  10792. self.showInput();
  10793. }
  10794. return;
  10795. }
  10796. // modify selection
  10797. eventName = e && e.type.toLowerCase();
  10798. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  10799. $last = self.$control.children('.active:last');
  10800. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  10801. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  10802. if (begin > end) {
  10803. swap = begin;
  10804. begin = end;
  10805. end = swap;
  10806. }
  10807. for (i = begin; i <= end; i++) {
  10808. item = self.$control[0].childNodes[i];
  10809. if (self.$activeItems.indexOf(item) === -1) {
  10810. $(item).addClass('active');
  10811. self.$activeItems.push(item);
  10812. }
  10813. }
  10814. e.preventDefault();
  10815. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  10816. if ($item.hasClass('active')) {
  10817. idx = self.$activeItems.indexOf($item[0]);
  10818. self.$activeItems.splice(idx, 1);
  10819. $item.removeClass('active');
  10820. } else {
  10821. self.$activeItems.push($item.addClass('active')[0]);
  10822. }
  10823. } else {
  10824. $(self.$activeItems).removeClass('active');
  10825. self.$activeItems = [$item.addClass('active')[0]];
  10826. }
  10827. // ensure control has focus
  10828. self.hideInput();
  10829. if (!this.isFocused) {
  10830. self.focus();
  10831. }
  10832. },
  10833. /**
  10834. * Sets the selected item in the dropdown menu
  10835. * of available options.
  10836. *
  10837. * @param {object} $object
  10838. * @param {boolean} scroll
  10839. * @param {boolean} animate
  10840. */
  10841. setActiveOption: function setActiveOption($option, scroll, animate) {
  10842. var height_menu, height_item, y;
  10843. var scroll_top, scroll_bottom;
  10844. var self = this;
  10845. if (self.$activeOption) self.$activeOption.removeClass('active');
  10846. self.$activeOption = null;
  10847. $option = $($option);
  10848. if (!$option.length) return;
  10849. self.$activeOption = $option.addClass('active');
  10850. if (scroll || !isset(scroll)) {
  10851. height_menu = self.$dropdown_content.height();
  10852. height_item = self.$activeOption.outerHeight(true);
  10853. scroll = self.$dropdown_content.scrollTop() || 0;
  10854. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  10855. scroll_top = y;
  10856. scroll_bottom = y - height_menu + height_item;
  10857. if (y + height_item > height_menu + scroll) {
  10858. self.$dropdown_content.stop().animate({ scrollTop: scroll_bottom }, animate ? self.settings.scrollDuration : 0);
  10859. } else if (y < scroll) {
  10860. self.$dropdown_content.stop().animate({ scrollTop: scroll_top }, animate ? self.settings.scrollDuration : 0);
  10861. }
  10862. }
  10863. },
  10864. /**
  10865. * Selects all items (CTRL + A).
  10866. */
  10867. selectAll: function selectAll() {
  10868. var self = this;
  10869. if (self.settings.mode === 'single') return;
  10870. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  10871. if (self.$activeItems.length) {
  10872. self.hideInput();
  10873. self.close();
  10874. }
  10875. self.focus();
  10876. },
  10877. /**
  10878. * Hides the input element out of view, while
  10879. * retaining its focus.
  10880. */
  10881. hideInput: function hideInput() {
  10882. var self = this;
  10883. self.setTextboxValue('');
  10884. self.$control_input.css({ opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000 });
  10885. self.isInputHidden = true;
  10886. },
  10887. /**
  10888. * Restores input visibility.
  10889. */
  10890. showInput: function showInput() {
  10891. this.$control_input.css({ opacity: 1, position: 'relative', left: 0 });
  10892. this.isInputHidden = false;
  10893. },
  10894. /**
  10895. * Gives the control focus.
  10896. */
  10897. focus: function focus() {
  10898. var self = this;
  10899. if (self.isDisabled) return;
  10900. self.ignoreFocus = true;
  10901. self.$control_input[0].focus();
  10902. window.setTimeout(function () {
  10903. self.ignoreFocus = false;
  10904. self.onFocus();
  10905. }, 0);
  10906. },
  10907. /**
  10908. * Forces the control out of focus.
  10909. *
  10910. * @param {Element} dest
  10911. */
  10912. blur: function blur(dest) {
  10913. this.$control_input[0].blur();
  10914. this.onBlur(null, dest);
  10915. },
  10916. /**
  10917. * Returns a function that scores an object
  10918. * to show how good of a match it is to the
  10919. * provided query.
  10920. *
  10921. * @param {string} query
  10922. * @param {object} options
  10923. * @return {function}
  10924. */
  10925. getScoreFunction: function getScoreFunction(query) {
  10926. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  10927. },
  10928. /**
  10929. * Returns search options for sifter (the system
  10930. * for scoring and sorting results).
  10931. *
  10932. * @see https://github.com/brianreavis/sifter.js
  10933. * @return {object}
  10934. */
  10935. getSearchOptions: function getSearchOptions() {
  10936. var settings = this.settings;
  10937. var sort = settings.sortField;
  10938. if (typeof sort === 'string') {
  10939. sort = [{ field: sort }];
  10940. }
  10941. return {
  10942. fields: settings.searchField,
  10943. conjunction: settings.searchConjunction,
  10944. sort: sort
  10945. };
  10946. },
  10947. /**
  10948. * Searches through available options and returns
  10949. * a sorted array of matches.
  10950. *
  10951. * Returns an object containing:
  10952. *
  10953. * - query {string}
  10954. * - tokens {array}
  10955. * - total {int}
  10956. * - items {array}
  10957. *
  10958. * @param {string} query
  10959. * @returns {object}
  10960. */
  10961. search: function search(query) {
  10962. var i, value, score, result, calculateScore;
  10963. var self = this;
  10964. var settings = self.settings;
  10965. var options = this.getSearchOptions();
  10966. // validate user-provided result scoring function
  10967. if (settings.score) {
  10968. calculateScore = self.settings.score.apply(this, [query]);
  10969. if (typeof calculateScore !== 'function') {
  10970. throw new Error('Selectize "score" setting must be a function that returns a function');
  10971. }
  10972. }
  10973. // perform search
  10974. if (query !== self.lastQuery) {
  10975. self.lastQuery = query;
  10976. result = self.sifter.search(query, $.extend(options, { score: calculateScore }));
  10977. self.currentResults = result;
  10978. } else {
  10979. result = $.extend(true, {}, self.currentResults);
  10980. }
  10981. // filter out selected items
  10982. if (settings.hideSelected) {
  10983. for (i = result.items.length - 1; i >= 0; i--) {
  10984. if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
  10985. result.items.splice(i, 1);
  10986. }
  10987. }
  10988. }
  10989. return result;
  10990. },
  10991. /**
  10992. * Refreshes the list of available options shown
  10993. * in the autocomplete dropdown menu.
  10994. *
  10995. * @param {boolean} triggerDropdown
  10996. */
  10997. refreshOptions: function refreshOptions(triggerDropdown) {
  10998. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  10999. var $active, $active_before, $create;
  11000. if (typeof triggerDropdown === 'undefined') {
  11001. triggerDropdown = true;
  11002. }
  11003. var self = this;
  11004. var query = $.trim(self.$control_input.val());
  11005. var results = self.search(query);
  11006. var $dropdown_content = self.$dropdown_content;
  11007. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  11008. // build markup
  11009. n = results.items.length;
  11010. if (typeof self.settings.maxOptions === 'number') {
  11011. n = Math.min(n, self.settings.maxOptions);
  11012. }
  11013. // render and group available options individually
  11014. groups = {};
  11015. groups_order = [];
  11016. for (i = 0; i < n; i++) {
  11017. option = self.options[results.items[i].id];
  11018. option_html = self.render('option', option);
  11019. optgroup = option[self.settings.optgroupField] || '';
  11020. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11021. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11022. optgroup = optgroups[j];
  11023. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11024. optgroup = '';
  11025. }
  11026. if (!groups.hasOwnProperty(optgroup)) {
  11027. groups[optgroup] = document.createDocumentFragment();
  11028. groups_order.push(optgroup);
  11029. }
  11030. groups[optgroup].appendChild(option_html);
  11031. }
  11032. }
  11033. // sort optgroups
  11034. if (this.settings.lockOptgroupOrder) {
  11035. groups_order.sort(function (a, b) {
  11036. var a_order = self.optgroups[a].$order || 0;
  11037. var b_order = self.optgroups[b].$order || 0;
  11038. return a_order - b_order;
  11039. });
  11040. }
  11041. // render optgroup headers & join groups
  11042. html = document.createDocumentFragment();
  11043. for (i = 0, n = groups_order.length; i < n; i++) {
  11044. optgroup = groups_order[i];
  11045. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11046. // render the optgroup header and options within it,
  11047. // then pass it to the wrapper template
  11048. html_children = document.createDocumentFragment();
  11049. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11050. html_children.appendChild(groups[optgroup]);
  11051. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11052. html: domToString(html_children),
  11053. dom: html_children
  11054. })));
  11055. } else {
  11056. html.appendChild(groups[optgroup]);
  11057. }
  11058. }
  11059. $dropdown_content.html(html);
  11060. // highlight matching terms inline
  11061. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11062. $dropdown_content.removeHighlight();
  11063. for (i = 0, n = results.tokens.length; i < n; i++) {
  11064. highlight($dropdown_content, results.tokens[i].regex);
  11065. }
  11066. }
  11067. // add "selected" class to selected options
  11068. if (!self.settings.hideSelected) {
  11069. for (i = 0, n = self.items.length; i < n; i++) {
  11070. self.getOption(self.items[i]).addClass('selected');
  11071. }
  11072. }
  11073. // add create option
  11074. has_create_option = self.canCreate(query);
  11075. if (has_create_option) {
  11076. $dropdown_content.prepend(self.render('option_create', { input: query }));
  11077. $create = $($dropdown_content[0].childNodes[0]);
  11078. }
  11079. // activate
  11080. self.hasOptions = results.items.length > 0 || has_create_option;
  11081. if (self.hasOptions) {
  11082. if (results.items.length > 0) {
  11083. $active_before = active_before && self.getOption(active_before);
  11084. if ($active_before && $active_before.length) {
  11085. $active = $active_before;
  11086. } else if (self.settings.mode === 'single' && self.items.length) {
  11087. $active = self.getOption(self.items[0]);
  11088. }
  11089. if (!$active || !$active.length) {
  11090. if ($create && !self.settings.addPrecedence) {
  11091. $active = self.getAdjacentOption($create, 1);
  11092. } else {
  11093. $active = $dropdown_content.find('[data-selectable]:first');
  11094. }
  11095. }
  11096. } else {
  11097. $active = $create;
  11098. }
  11099. self.setActiveOption($active);
  11100. if (triggerDropdown && !self.isOpen) {
  11101. self.open();
  11102. }
  11103. } else {
  11104. self.setActiveOption(null);
  11105. if (triggerDropdown && self.isOpen) {
  11106. self.close();
  11107. }
  11108. }
  11109. },
  11110. /**
  11111. * Adds an available option. If it already exists,
  11112. * nothing will happen. Note: this does not refresh
  11113. * the options list dropdown (use `refreshOptions`
  11114. * for that).
  11115. *
  11116. * Usage:
  11117. *
  11118. * this.addOption(data)
  11119. *
  11120. * @param {object|array} data
  11121. */
  11122. addOption: function addOption(data) {
  11123. var i,
  11124. n,
  11125. value,
  11126. self = this;
  11127. if ($.isArray(data)) {
  11128. for (i = 0, n = data.length; i < n; i++) {
  11129. self.addOption(data[i]);
  11130. }
  11131. return;
  11132. }
  11133. if (value = self.registerOption(data)) {
  11134. self.userOptions[value] = true;
  11135. self.lastQuery = null;
  11136. self.trigger('option_add', value, data);
  11137. }
  11138. },
  11139. /**
  11140. * Registers an option to the pool of options.
  11141. *
  11142. * @param {object} data
  11143. * @return {boolean|string}
  11144. */
  11145. registerOption: function registerOption(data) {
  11146. var key = hash_key(data[this.settings.valueField]);
  11147. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
  11148. data.$order = data.$order || ++this.order;
  11149. this.options[key] = data;
  11150. return key;
  11151. },
  11152. /**
  11153. * Registers an option group to the pool of option groups.
  11154. *
  11155. * @param {object} data
  11156. * @return {boolean|string}
  11157. */
  11158. registerOptionGroup: function registerOptionGroup(data) {
  11159. var key = hash_key(data[this.settings.optgroupValueField]);
  11160. if (!key) return false;
  11161. data.$order = data.$order || ++this.order;
  11162. this.optgroups[key] = data;
  11163. return key;
  11164. },
  11165. /**
  11166. * Registers a new optgroup for options
  11167. * to be bucketed into.
  11168. *
  11169. * @param {string} id
  11170. * @param {object} data
  11171. */
  11172. addOptionGroup: function addOptionGroup(id, data) {
  11173. data[this.settings.optgroupValueField] = id;
  11174. if (id = this.registerOptionGroup(data)) {
  11175. this.trigger('optgroup_add', id, data);
  11176. }
  11177. },
  11178. /**
  11179. * Removes an existing option group.
  11180. *
  11181. * @param {string} id
  11182. */
  11183. removeOptionGroup: function removeOptionGroup(id) {
  11184. if (this.optgroups.hasOwnProperty(id)) {
  11185. delete this.optgroups[id];
  11186. this.renderCache = {};
  11187. this.trigger('optgroup_remove', id);
  11188. }
  11189. },
  11190. /**
  11191. * Clears all existing option groups.
  11192. */
  11193. clearOptionGroups: function clearOptionGroups() {
  11194. this.optgroups = {};
  11195. this.renderCache = {};
  11196. this.trigger('optgroup_clear');
  11197. },
  11198. /**
  11199. * Updates an option available for selection. If
  11200. * it is visible in the selected items or options
  11201. * dropdown, it will be re-rendered automatically.
  11202. *
  11203. * @param {string} value
  11204. * @param {object} data
  11205. */
  11206. updateOption: function updateOption(value, data) {
  11207. var self = this;
  11208. var $item, $item_new;
  11209. var value_new, index_item, cache_items, cache_options, order_old;
  11210. value = hash_key(value);
  11211. value_new = hash_key(data[self.settings.valueField]);
  11212. // sanity checks
  11213. if (value === null) return;
  11214. if (!self.options.hasOwnProperty(value)) return;
  11215. if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
  11216. order_old = self.options[value].$order;
  11217. // update references
  11218. if (value_new !== value) {
  11219. delete self.options[value];
  11220. index_item = self.items.indexOf(value);
  11221. if (index_item !== -1) {
  11222. self.items.splice(index_item, 1, value_new);
  11223. }
  11224. }
  11225. data.$order = data.$order || order_old;
  11226. self.options[value_new] = data;
  11227. // invalidate render cache
  11228. cache_items = self.renderCache['item'];
  11229. cache_options = self.renderCache['option'];
  11230. if (cache_items) {
  11231. delete cache_items[value];
  11232. delete cache_items[value_new];
  11233. }
  11234. if (cache_options) {
  11235. delete cache_options[value];
  11236. delete cache_options[value_new];
  11237. }
  11238. // update the item if it's selected
  11239. if (self.items.indexOf(value_new) !== -1) {
  11240. $item = self.getItem(value);
  11241. $item_new = $(self.render('item', data));
  11242. if ($item.hasClass('active')) $item_new.addClass('active');
  11243. $item.replaceWith($item_new);
  11244. }
  11245. // invalidate last query because we might have updated the sortField
  11246. self.lastQuery = null;
  11247. // update dropdown contents
  11248. if (self.isOpen) {
  11249. self.refreshOptions(false);
  11250. }
  11251. },
  11252. /**
  11253. * Removes a single option.
  11254. *
  11255. * @param {string} value
  11256. * @param {boolean} silent
  11257. */
  11258. removeOption: function removeOption(value, silent) {
  11259. var self = this;
  11260. value = hash_key(value);
  11261. var cache_items = self.renderCache['item'];
  11262. var cache_options = self.renderCache['option'];
  11263. if (cache_items) delete cache_items[value];
  11264. if (cache_options) delete cache_options[value];
  11265. delete self.userOptions[value];
  11266. delete self.options[value];
  11267. self.lastQuery = null;
  11268. self.trigger('option_remove', value);
  11269. self.removeItem(value, silent);
  11270. },
  11271. /**
  11272. * Clears all options.
  11273. */
  11274. clearOptions: function clearOptions() {
  11275. var self = this;
  11276. self.loadedSearches = {};
  11277. self.userOptions = {};
  11278. self.renderCache = {};
  11279. self.options = self.sifter.items = {};
  11280. self.lastQuery = null;
  11281. self.trigger('option_clear');
  11282. self.clear();
  11283. },
  11284. /**
  11285. * Returns the jQuery element of the option
  11286. * matching the given value.
  11287. *
  11288. * @param {string} value
  11289. * @returns {object}
  11290. */
  11291. getOption: function getOption(value) {
  11292. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  11293. },
  11294. /**
  11295. * Returns the jQuery element of the next or
  11296. * previous selectable option.
  11297. *
  11298. * @param {object} $option
  11299. * @param {int} direction can be 1 for next or -1 for previous
  11300. * @return {object}
  11301. */
  11302. getAdjacentOption: function getAdjacentOption($option, direction) {
  11303. var $options = this.$dropdown.find('[data-selectable]');
  11304. var index = $options.index($option) + direction;
  11305. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  11306. },
  11307. /**
  11308. * Finds the first element with a "data-value" attribute
  11309. * that matches the given value.
  11310. *
  11311. * @param {mixed} value
  11312. * @param {object} $els
  11313. * @return {object}
  11314. */
  11315. getElementWithValue: function getElementWithValue(value, $els) {
  11316. value = hash_key(value);
  11317. if (typeof value !== 'undefined' && value !== null) {
  11318. for (var i = 0, n = $els.length; i < n; i++) {
  11319. if ($els[i].getAttribute('data-value') === value) {
  11320. return $($els[i]);
  11321. }
  11322. }
  11323. }
  11324. return $();
  11325. },
  11326. /**
  11327. * Returns the jQuery element of the item
  11328. * matching the given value.
  11329. *
  11330. * @param {string} value
  11331. * @returns {object}
  11332. */
  11333. getItem: function getItem(value) {
  11334. return this.getElementWithValue(value, this.$control.children());
  11335. },
  11336. /**
  11337. * "Selects" multiple items at once. Adds them to the list
  11338. * at the current caret position.
  11339. *
  11340. * @param {string} value
  11341. * @param {boolean} silent
  11342. */
  11343. addItems: function addItems(values, silent) {
  11344. var items = $.isArray(values) ? values : [values];
  11345. for (var i = 0, n = items.length; i < n; i++) {
  11346. this.isPending = i < n - 1;
  11347. this.addItem(items[i], silent);
  11348. }
  11349. },
  11350. /**
  11351. * "Selects" an item. Adds it to the list
  11352. * at the current caret position.
  11353. *
  11354. * @param {string} value
  11355. * @param {boolean} silent
  11356. */
  11357. addItem: function addItem(value, silent) {
  11358. var events = silent ? [] : ['change'];
  11359. debounce_events(this, events, function () {
  11360. var $item, $option, $options;
  11361. var self = this;
  11362. var inputMode = self.settings.mode;
  11363. var i, active, value_next, wasFull;
  11364. value = hash_key(value);
  11365. if (self.items.indexOf(value) !== -1) {
  11366. if (inputMode === 'single') self.close();
  11367. return;
  11368. }
  11369. if (!self.options.hasOwnProperty(value)) return;
  11370. if (inputMode === 'single') self.clear(silent);
  11371. if (inputMode === 'multi' && self.isFull()) return;
  11372. $item = $(self.render('item', self.options[value]));
  11373. wasFull = self.isFull();
  11374. self.items.splice(self.caretPos, 0, value);
  11375. self.insertAtCaret($item);
  11376. if (!self.isPending || !wasFull && self.isFull()) {
  11377. self.refreshState();
  11378. }
  11379. if (self.isSetup) {
  11380. $options = self.$dropdown_content.find('[data-selectable]');
  11381. // update menu / remove the option (if this is not one item being added as part of series)
  11382. if (!self.isPending) {
  11383. $option = self.getOption(value);
  11384. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  11385. self.refreshOptions(self.isFocused && inputMode !== 'single');
  11386. if (value_next) {
  11387. self.setActiveOption(self.getOption(value_next));
  11388. }
  11389. }
  11390. // hide the menu if the maximum number of items have been selected or no options are left
  11391. if (!$options.length || self.isFull()) {
  11392. self.close();
  11393. } else {
  11394. self.positionDropdown();
  11395. }
  11396. self.updatePlaceholder();
  11397. self.trigger('item_add', value, $item);
  11398. self.updateOriginalInput({ silent: silent });
  11399. }
  11400. });
  11401. },
  11402. /**
  11403. * Removes the selected item matching
  11404. * the provided value.
  11405. *
  11406. * @param {string} value
  11407. */
  11408. removeItem: function removeItem(value, silent) {
  11409. var self = this;
  11410. var $item, i, idx;
  11411. $item = value instanceof $ ? value : self.getItem(value);
  11412. value = hash_key($item.attr('data-value'));
  11413. i = self.items.indexOf(value);
  11414. if (i !== -1) {
  11415. $item.remove();
  11416. if ($item.hasClass('active')) {
  11417. idx = self.$activeItems.indexOf($item[0]);
  11418. self.$activeItems.splice(idx, 1);
  11419. }
  11420. self.items.splice(i, 1);
  11421. self.lastQuery = null;
  11422. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  11423. self.removeOption(value, silent);
  11424. }
  11425. if (i < self.caretPos) {
  11426. self.setCaret(self.caretPos - 1);
  11427. }
  11428. self.refreshState();
  11429. self.updatePlaceholder();
  11430. self.updateOriginalInput({ silent: silent });
  11431. self.positionDropdown();
  11432. self.trigger('item_remove', value, $item);
  11433. }
  11434. },
  11435. /**
  11436. * Invokes the `create` method provided in the
  11437. * selectize options that should provide the data
  11438. * for the new item, given the user input.
  11439. *
  11440. * Once this completes, it will be added
  11441. * to the item list.
  11442. *
  11443. * @param {string} value
  11444. * @param {boolean} [triggerDropdown]
  11445. * @param {function} [callback]
  11446. * @return {boolean}
  11447. */
  11448. createItem: function createItem(input, triggerDropdown) {
  11449. var self = this;
  11450. var caret = self.caretPos;
  11451. input = input || $.trim(self.$control_input.val() || '');
  11452. var callback = arguments[arguments.length - 1];
  11453. if (typeof callback !== 'function') callback = function callback() {};
  11454. if (typeof triggerDropdown !== 'boolean') {
  11455. triggerDropdown = true;
  11456. }
  11457. if (!self.canCreate(input)) {
  11458. callback();
  11459. return false;
  11460. }
  11461. self.lock();
  11462. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  11463. var data = {};
  11464. data[self.settings.labelField] = input;
  11465. data[self.settings.valueField] = input;
  11466. return data;
  11467. };
  11468. var create = once(function (data) {
  11469. self.unlock();
  11470. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return callback();
  11471. var value = hash_key(data[self.settings.valueField]);
  11472. if (typeof value !== 'string') return callback();
  11473. self.setTextboxValue('');
  11474. self.addOption(data);
  11475. self.setCaret(caret);
  11476. self.addItem(value);
  11477. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  11478. callback(data);
  11479. });
  11480. var output = setup.apply(this, [input, create]);
  11481. if (typeof output !== 'undefined') {
  11482. create(output);
  11483. }
  11484. return true;
  11485. },
  11486. /**
  11487. * Re-renders the selected item lists.
  11488. */
  11489. refreshItems: function refreshItems() {
  11490. this.lastQuery = null;
  11491. if (this.isSetup) {
  11492. this.addItem(this.items);
  11493. }
  11494. this.refreshState();
  11495. this.updateOriginalInput();
  11496. },
  11497. /**
  11498. * Updates all state-dependent attributes
  11499. * and CSS classes.
  11500. */
  11501. refreshState: function refreshState() {
  11502. this.refreshValidityState();
  11503. this.refreshClasses();
  11504. },
  11505. /**
  11506. * Update the `required` attribute of both input and control input.
  11507. *
  11508. * The `required` property needs to be activated on the control input
  11509. * for the error to be displayed at the right place. `required` also
  11510. * needs to be temporarily deactivated on the input since the input is
  11511. * hidden and can't show errors.
  11512. */
  11513. refreshValidityState: function refreshValidityState() {
  11514. if (!this.isRequired) return false;
  11515. var invalid = !this.items.length;
  11516. this.isInvalid = invalid;
  11517. this.$control_input.prop('required', invalid);
  11518. this.$input.prop('required', !invalid);
  11519. },
  11520. /**
  11521. * Updates all state-dependent CSS classes.
  11522. */
  11523. refreshClasses: function refreshClasses() {
  11524. var self = this;
  11525. var isFull = self.isFull();
  11526. var isLocked = self.isLocked;
  11527. self.$wrapper.toggleClass('rtl', self.rtl);
  11528. 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);
  11529. self.$control_input.data('grow', !isFull && !isLocked);
  11530. },
  11531. /**
  11532. * Determines whether or not more items can be added
  11533. * to the control without exceeding the user-defined maximum.
  11534. *
  11535. * @returns {boolean}
  11536. */
  11537. isFull: function isFull() {
  11538. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  11539. },
  11540. /**
  11541. * Refreshes the original <select> or <input>
  11542. * element to reflect the current state.
  11543. */
  11544. updateOriginalInput: function updateOriginalInput(opts) {
  11545. var i,
  11546. n,
  11547. options,
  11548. label,
  11549. self = this;
  11550. opts = opts || {};
  11551. if (self.tagType === TAG_SELECT) {
  11552. options = [];
  11553. for (i = 0, n = self.items.length; i < n; i++) {
  11554. label = self.options[self.items[i]][self.settings.labelField] || '';
  11555. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  11556. }
  11557. if (!options.length && !this.$input.attr('multiple')) {
  11558. options.push('<option value="" selected="selected"></option>');
  11559. }
  11560. self.$input.html(options.join(''));
  11561. } else {
  11562. self.$input.val(self.getValue());
  11563. self.$input.attr('value', self.$input.val());
  11564. }
  11565. if (self.isSetup) {
  11566. if (!opts.silent) {
  11567. self.trigger('change', self.$input.val());
  11568. }
  11569. }
  11570. },
  11571. /**
  11572. * Shows/hide the input placeholder depending
  11573. * on if there items in the list already.
  11574. */
  11575. updatePlaceholder: function updatePlaceholder() {
  11576. if (!this.settings.placeholder) return;
  11577. var $input = this.$control_input;
  11578. if (this.items.length) {
  11579. $input.removeAttr('placeholder');
  11580. } else {
  11581. $input.attr('placeholder', this.settings.placeholder);
  11582. }
  11583. $input.triggerHandler('update', { force: true });
  11584. },
  11585. /**
  11586. * Shows the autocomplete dropdown containing
  11587. * the available options.
  11588. */
  11589. open: function open() {
  11590. var self = this;
  11591. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull()) return;
  11592. self.focus();
  11593. self.isOpen = true;
  11594. self.refreshState();
  11595. self.$dropdown.css({ visibility: 'hidden', display: 'block' });
  11596. self.positionDropdown();
  11597. self.$dropdown.css({ visibility: 'visible' });
  11598. self.trigger('dropdown_open', self.$dropdown);
  11599. },
  11600. /**
  11601. * Closes the autocomplete dropdown menu.
  11602. */
  11603. close: function close() {
  11604. var self = this;
  11605. var trigger = self.isOpen;
  11606. if (self.settings.mode === 'single' && self.items.length) {
  11607. self.hideInput();
  11608. self.$control_input.blur(); // close keyboard on iOS
  11609. }
  11610. self.isOpen = false;
  11611. self.$dropdown.hide();
  11612. self.setActiveOption(null);
  11613. self.refreshState();
  11614. if (trigger) self.trigger('dropdown_close', self.$dropdown);
  11615. },
  11616. /**
  11617. * Calculates and applies the appropriate
  11618. * position of the dropdown.
  11619. */
  11620. positionDropdown: function positionDropdown() {
  11621. var $control = this.$control;
  11622. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  11623. offset.top += $control.outerHeight(true);
  11624. this.$dropdown.css({
  11625. width: $control.outerWidth(),
  11626. top: offset.top,
  11627. left: offset.left
  11628. });
  11629. },
  11630. /**
  11631. * Resets / clears all selected items
  11632. * from the control.
  11633. *
  11634. * @param {boolean} silent
  11635. */
  11636. clear: function clear(silent) {
  11637. var self = this;
  11638. if (!self.items.length) return;
  11639. self.$control.children(':not(input)').remove();
  11640. self.items = [];
  11641. self.lastQuery = null;
  11642. self.setCaret(0);
  11643. self.setActiveItem(null);
  11644. self.updatePlaceholder();
  11645. self.updateOriginalInput({ silent: silent });
  11646. self.refreshState();
  11647. self.showInput();
  11648. self.trigger('clear');
  11649. },
  11650. /**
  11651. * A helper method for inserting an element
  11652. * at the current caret position.
  11653. *
  11654. * @param {object} $el
  11655. */
  11656. insertAtCaret: function insertAtCaret($el) {
  11657. var caret = Math.min(this.caretPos, this.items.length);
  11658. if (caret === 0) {
  11659. this.$control.prepend($el);
  11660. } else {
  11661. $(this.$control[0].childNodes[caret]).before($el);
  11662. }
  11663. this.setCaret(caret + 1);
  11664. },
  11665. /**
  11666. * Removes the current selected item(s).
  11667. *
  11668. * @param {object} e (optional)
  11669. * @returns {boolean}
  11670. */
  11671. deleteSelection: function deleteSelection(e) {
  11672. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  11673. var self = this;
  11674. direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;
  11675. selection = getSelection(self.$control_input[0]);
  11676. if (self.$activeOption && !self.settings.hideSelected) {
  11677. option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
  11678. }
  11679. // determine items that will be removed
  11680. values = [];
  11681. if (self.$activeItems.length) {
  11682. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  11683. caret = self.$control.children(':not(input)').index($tail);
  11684. if (direction > 0) {
  11685. caret++;
  11686. }
  11687. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  11688. values.push($(self.$activeItems[i]).attr('data-value'));
  11689. }
  11690. if (e) {
  11691. e.preventDefault();
  11692. e.stopPropagation();
  11693. }
  11694. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  11695. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  11696. values.push(self.items[self.caretPos - 1]);
  11697. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  11698. values.push(self.items[self.caretPos]);
  11699. }
  11700. }
  11701. // allow the callback to abort
  11702. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  11703. return false;
  11704. }
  11705. // perform removal
  11706. if (typeof caret !== 'undefined') {
  11707. self.setCaret(caret);
  11708. }
  11709. while (values.length) {
  11710. self.removeItem(values.pop());
  11711. }
  11712. self.showInput();
  11713. self.positionDropdown();
  11714. self.refreshOptions(true);
  11715. // select previous option
  11716. if (option_select) {
  11717. $option_select = self.getOption(option_select);
  11718. if ($option_select.length) {
  11719. self.setActiveOption($option_select);
  11720. }
  11721. }
  11722. return true;
  11723. },
  11724. /**
  11725. * Selects the previous / next item (depending
  11726. * on the `direction` argument).
  11727. *
  11728. * > 0 - right
  11729. * < 0 - left
  11730. *
  11731. * @param {int} direction
  11732. * @param {object} e (optional)
  11733. */
  11734. advanceSelection: function advanceSelection(direction, e) {
  11735. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  11736. var self = this;
  11737. if (direction === 0) return;
  11738. if (self.rtl) direction *= -1;
  11739. tail = direction > 0 ? 'last' : 'first';
  11740. selection = getSelection(self.$control_input[0]);
  11741. if (self.isFocused && !self.isInputHidden) {
  11742. valueLength = self.$control_input.val().length;
  11743. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  11744. if (cursorAtEdge && !valueLength) {
  11745. self.advanceCaret(direction, e);
  11746. }
  11747. } else {
  11748. $tail = self.$control.children('.active:' + tail);
  11749. if ($tail.length) {
  11750. idx = self.$control.children(':not(input)').index($tail);
  11751. self.setActiveItem(null);
  11752. self.setCaret(direction > 0 ? idx + 1 : idx);
  11753. }
  11754. }
  11755. },
  11756. /**
  11757. * Moves the caret left / right.
  11758. *
  11759. * @param {int} direction
  11760. * @param {object} e (optional)
  11761. */
  11762. advanceCaret: function advanceCaret(direction, e) {
  11763. var self = this,
  11764. fn,
  11765. $adj;
  11766. if (direction === 0) return;
  11767. fn = direction > 0 ? 'next' : 'prev';
  11768. if (self.isShiftDown) {
  11769. $adj = self.$control_input[fn]();
  11770. if ($adj.length) {
  11771. self.hideInput();
  11772. self.setActiveItem($adj);
  11773. e && e.preventDefault();
  11774. }
  11775. } else {
  11776. self.setCaret(self.caretPos + direction);
  11777. }
  11778. },
  11779. /**
  11780. * Moves the caret to the specified index.
  11781. *
  11782. * @param {int} i
  11783. */
  11784. setCaret: function setCaret(i) {
  11785. var self = this;
  11786. if (self.settings.mode === 'single') {
  11787. i = self.items.length;
  11788. } else {
  11789. i = Math.max(0, Math.min(self.items.length, i));
  11790. }
  11791. if (!self.isPending) {
  11792. // the input must be moved by leaving it in place and moving the
  11793. // siblings, due to the fact that focus cannot be restored once lost
  11794. // on mobile webkit devices
  11795. var j, n, fn, $children, $child;
  11796. $children = self.$control.children(':not(input)');
  11797. for (j = 0, n = $children.length; j < n; j++) {
  11798. $child = $($children[j]).detach();
  11799. if (j < i) {
  11800. self.$control_input.before($child);
  11801. } else {
  11802. self.$control.append($child);
  11803. }
  11804. }
  11805. }
  11806. self.caretPos = i;
  11807. },
  11808. /**
  11809. * Disables user input on the control. Used while
  11810. * items are being asynchronously created.
  11811. */
  11812. lock: function lock() {
  11813. this.close();
  11814. this.isLocked = true;
  11815. this.refreshState();
  11816. },
  11817. /**
  11818. * Re-enables user input on the control.
  11819. */
  11820. unlock: function unlock() {
  11821. this.isLocked = false;
  11822. this.refreshState();
  11823. },
  11824. /**
  11825. * Disables user input on the control completely.
  11826. * While disabled, it cannot receive focus.
  11827. */
  11828. disable: function disable() {
  11829. var self = this;
  11830. self.$input.prop('disabled', true);
  11831. self.$control_input.prop('disabled', true).prop('tabindex', -1);
  11832. self.isDisabled = true;
  11833. self.lock();
  11834. },
  11835. /**
  11836. * Enables the control so that it can respond
  11837. * to focus and user input.
  11838. */
  11839. enable: function enable() {
  11840. var self = this;
  11841. self.$input.prop('disabled', false);
  11842. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  11843. self.isDisabled = false;
  11844. self.unlock();
  11845. },
  11846. /**
  11847. * Completely destroys the control and
  11848. * unbinds all event listeners so that it can
  11849. * be garbage collected.
  11850. */
  11851. destroy: function destroy() {
  11852. var self = this;
  11853. var eventNS = self.eventNS;
  11854. var revertSettings = self.revertSettings;
  11855. self.trigger('destroy');
  11856. self.off();
  11857. self.$wrapper.remove();
  11858. self.$dropdown.remove();
  11859. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({ tabindex: revertSettings.tabindex }).show();
  11860. self.$control_input.removeData('grow');
  11861. self.$input.removeData('selectize');
  11862. $(window).off(eventNS);
  11863. $(document).off(eventNS);
  11864. $(document.body).off(eventNS);
  11865. delete self.$input[0].selectize;
  11866. },
  11867. /**
  11868. * A helper method for rendering "item" and
  11869. * "option" templates, given the data.
  11870. *
  11871. * @param {string} templateName
  11872. * @param {object} data
  11873. * @returns {string}
  11874. */
  11875. render: function render(templateName, data) {
  11876. var value, id, label;
  11877. var html = '';
  11878. var cache = false;
  11879. var self = this;
  11880. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  11881. if (templateName === 'option' || templateName === 'item') {
  11882. value = hash_key(data[self.settings.valueField]);
  11883. cache = !!value;
  11884. }
  11885. // pull markup from cache if it exists
  11886. if (cache) {
  11887. if (!isset(self.renderCache[templateName])) {
  11888. self.renderCache[templateName] = {};
  11889. }
  11890. if (self.renderCache[templateName].hasOwnProperty(value)) {
  11891. return self.renderCache[templateName][value];
  11892. }
  11893. }
  11894. // render markup
  11895. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  11896. // add mandatory attributes
  11897. if (templateName === 'option' || templateName === 'option_create') {
  11898. html.attr('data-selectable', '');
  11899. } else if (templateName === 'optgroup') {
  11900. id = data[self.settings.optgroupValueField] || '';
  11901. html.attr('data-group', id);
  11902. }
  11903. if (templateName === 'option' || templateName === 'item') {
  11904. html.attr('data-value', value || '');
  11905. }
  11906. // update cache
  11907. if (cache) {
  11908. self.renderCache[templateName][value] = html[0];
  11909. }
  11910. return html[0];
  11911. },
  11912. /**
  11913. * Clears the render cache for a template. If
  11914. * no template is given, clears all render
  11915. * caches.
  11916. *
  11917. * @param {string} templateName
  11918. */
  11919. clearCache: function clearCache(templateName) {
  11920. var self = this;
  11921. if (typeof templateName === 'undefined') {
  11922. self.renderCache = {};
  11923. } else {
  11924. delete self.renderCache[templateName];
  11925. }
  11926. },
  11927. /**
  11928. * Determines whether or not to display the
  11929. * create item prompt, given a user input.
  11930. *
  11931. * @param {string} input
  11932. * @return {boolean}
  11933. */
  11934. canCreate: function canCreate(input) {
  11935. var self = this;
  11936. if (!self.settings.create) return false;
  11937. var filter = self.settings.createFilter;
  11938. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  11939. }
  11940. });
  11941. Selectize.count = 0;
  11942. Selectize.defaults = {
  11943. options: [],
  11944. optgroups: [],
  11945. plugins: [],
  11946. delimiter: ',',
  11947. splitOn: null, // regexp or string for splitting up values from a paste command
  11948. persist: true,
  11949. diacritics: true,
  11950. create: false,
  11951. createOnBlur: false,
  11952. createFilter: null,
  11953. highlight: true,
  11954. openOnFocus: true,
  11955. maxOptions: 1000,
  11956. maxItems: null,
  11957. hideSelected: null,
  11958. addPrecedence: false,
  11959. selectOnTab: false,
  11960. preload: false,
  11961. allowEmptyOption: false,
  11962. closeAfterSelect: false,
  11963. scrollDuration: 60,
  11964. loadThrottle: 300,
  11965. loadingClass: 'loading',
  11966. dataAttr: 'data-data',
  11967. optgroupField: 'optgroup',
  11968. valueField: 'value',
  11969. labelField: 'text',
  11970. optgroupLabelField: 'label',
  11971. optgroupValueField: 'value',
  11972. lockOptgroupOrder: false,
  11973. sortField: '$order',
  11974. searchField: ['text'],
  11975. searchConjunction: 'and',
  11976. mode: null,
  11977. wrapperClass: 'selectize-control',
  11978. inputClass: 'selectize-input',
  11979. dropdownClass: 'selectize-dropdown',
  11980. dropdownContentClass: 'selectize-dropdown-content',
  11981. dropdownParent: null,
  11982. copyClassesToDropdown: true,
  11983. /*
  11984. load : null, // function(query, callback) { ... }
  11985. score : null, // function(search) { ... }
  11986. onInitialize : null, // function() { ... }
  11987. onChange : null, // function(value) { ... }
  11988. onItemAdd : null, // function(value, $item) { ... }
  11989. onItemRemove : null, // function(value) { ... }
  11990. onClear : null, // function() { ... }
  11991. onOptionAdd : null, // function(value, data) { ... }
  11992. onOptionRemove : null, // function(value) { ... }
  11993. onOptionClear : null, // function() { ... }
  11994. onOptionGroupAdd : null, // function(id, data) { ... }
  11995. onOptionGroupRemove : null, // function(id) { ... }
  11996. onOptionGroupClear : null, // function() { ... }
  11997. onDropdownOpen : null, // function($dropdown) { ... }
  11998. onDropdownClose : null, // function($dropdown) { ... }
  11999. onType : null, // function(str) { ... }
  12000. onDelete : null, // function(values) { ... }
  12001. */
  12002. render: {
  12003. /*
  12004. item: null,
  12005. optgroup: null,
  12006. optgroup_header: null,
  12007. option: null,
  12008. option_create: null
  12009. */
  12010. }
  12011. };
  12012. $.fn.selectize = function (settings_user) {
  12013. var defaults = $.fn.selectize.defaults;
  12014. var settings = $.extend({}, defaults, settings_user);
  12015. var attr_data = settings.dataAttr;
  12016. var field_label = settings.labelField;
  12017. var field_value = settings.valueField;
  12018. var field_optgroup = settings.optgroupField;
  12019. var field_optgroup_label = settings.optgroupLabelField;
  12020. var field_optgroup_value = settings.optgroupValueField;
  12021. /**
  12022. * Initializes selectize from a <input type="text"> element.
  12023. *
  12024. * @param {object} $input
  12025. * @param {object} settings_element
  12026. */
  12027. var init_textbox = function init_textbox($input, settings_element) {
  12028. var i, n, values, option;
  12029. var data_raw = $input.attr(attr_data);
  12030. if (!data_raw) {
  12031. var value = $.trim($input.val() || '');
  12032. if (!settings.allowEmptyOption && !value.length) return;
  12033. values = value.split(settings.delimiter);
  12034. for (i = 0, n = values.length; i < n; i++) {
  12035. option = {};
  12036. option[field_label] = values[i];
  12037. option[field_value] = values[i];
  12038. settings_element.options.push(option);
  12039. }
  12040. settings_element.items = values;
  12041. } else {
  12042. settings_element.options = JSON.parse(data_raw);
  12043. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12044. settings_element.items.push(settings_element.options[i][field_value]);
  12045. }
  12046. }
  12047. };
  12048. /**
  12049. * Initializes selectize from a <select> element.
  12050. *
  12051. * @param {object} $input
  12052. * @param {object} settings_element
  12053. */
  12054. var init_select = function init_select($input, settings_element) {
  12055. var i,
  12056. n,
  12057. tagName,
  12058. $children,
  12059. order = 0;
  12060. var options = settings_element.options;
  12061. var optionsMap = {};
  12062. var readData = function readData($el) {
  12063. var data = attr_data && $el.attr(attr_data);
  12064. if (typeof data === 'string' && data.length) {
  12065. return JSON.parse(data);
  12066. }
  12067. return null;
  12068. };
  12069. var addOption = function addOption($option, group) {
  12070. $option = $($option);
  12071. var value = hash_key($option.val());
  12072. if (!value && !settings.allowEmptyOption) return;
  12073. // if the option already exists, it's probably been
  12074. // duplicated in another optgroup. in this case, push
  12075. // the current group to the "optgroup" property on the
  12076. // existing option so that it's rendered in both places.
  12077. if (optionsMap.hasOwnProperty(value)) {
  12078. if (group) {
  12079. var arr = optionsMap[value][field_optgroup];
  12080. if (!arr) {
  12081. optionsMap[value][field_optgroup] = group;
  12082. } else if (!$.isArray(arr)) {
  12083. optionsMap[value][field_optgroup] = [arr, group];
  12084. } else {
  12085. arr.push(group);
  12086. }
  12087. }
  12088. return;
  12089. }
  12090. var option = readData($option) || {};
  12091. option[field_label] = option[field_label] || $option.text();
  12092. option[field_value] = option[field_value] || value;
  12093. option[field_optgroup] = option[field_optgroup] || group;
  12094. optionsMap[value] = option;
  12095. options.push(option);
  12096. if ($option.is(':selected')) {
  12097. settings_element.items.push(value);
  12098. }
  12099. };
  12100. var addGroup = function addGroup($optgroup) {
  12101. var i, n, id, optgroup, $options;
  12102. $optgroup = $($optgroup);
  12103. id = $optgroup.attr('label');
  12104. if (id) {
  12105. optgroup = readData($optgroup) || {};
  12106. optgroup[field_optgroup_label] = id;
  12107. optgroup[field_optgroup_value] = id;
  12108. settings_element.optgroups.push(optgroup);
  12109. }
  12110. $options = $('option', $optgroup);
  12111. for (i = 0, n = $options.length; i < n; i++) {
  12112. addOption($options[i], id);
  12113. }
  12114. };
  12115. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  12116. $children = $input.children();
  12117. for (i = 0, n = $children.length; i < n; i++) {
  12118. tagName = $children[i].tagName.toLowerCase();
  12119. if (tagName === 'optgroup') {
  12120. addGroup($children[i]);
  12121. } else if (tagName === 'option') {
  12122. addOption($children[i]);
  12123. }
  12124. }
  12125. };
  12126. return this.each(function () {
  12127. if (this.selectize) return;
  12128. var instance;
  12129. var $input = $(this);
  12130. var tag_name = this.tagName.toLowerCase();
  12131. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  12132. if (!placeholder && !settings.allowEmptyOption) {
  12133. placeholder = $input.children('option[value=""]').text();
  12134. }
  12135. var settings_element = {
  12136. 'placeholder': placeholder,
  12137. 'options': [],
  12138. 'optgroups': [],
  12139. 'items': []
  12140. };
  12141. if (tag_name === 'select') {
  12142. init_select($input, settings_element);
  12143. } else {
  12144. init_textbox($input, settings_element);
  12145. }
  12146. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  12147. });
  12148. };
  12149. $.fn.selectize.defaults = Selectize.defaults;
  12150. $.fn.selectize.support = {
  12151. validity: SUPPORTS_VALIDITY_API
  12152. };
  12153. Selectize.define('drag_drop', function (options) {
  12154. if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  12155. if (this.settings.mode !== 'multi') return;
  12156. var self = this;
  12157. self.lock = function () {
  12158. var original = self.lock;
  12159. return function () {
  12160. var sortable = self.$control.data('sortable');
  12161. if (sortable) sortable.disable();
  12162. return original.apply(self, arguments);
  12163. };
  12164. }();
  12165. self.unlock = function () {
  12166. var original = self.unlock;
  12167. return function () {
  12168. var sortable = self.$control.data('sortable');
  12169. if (sortable) sortable.enable();
  12170. return original.apply(self, arguments);
  12171. };
  12172. }();
  12173. self.setup = function () {
  12174. var original = self.setup;
  12175. return function () {
  12176. original.apply(this, arguments);
  12177. var $control = self.$control.sortable({
  12178. items: '[data-value]',
  12179. forcePlaceholderSize: true,
  12180. disabled: self.isLocked,
  12181. start: function start(e, ui) {
  12182. ui.placeholder.css('width', ui.helper.css('width'));
  12183. $control.css({ overflow: 'visible' });
  12184. },
  12185. stop: function stop() {
  12186. $control.css({ overflow: 'hidden' });
  12187. var active = self.$activeItems ? self.$activeItems.slice() : null;
  12188. var values = [];
  12189. $control.children('[data-value]').each(function () {
  12190. values.push($(this).attr('data-value'));
  12191. });
  12192. self.setValue(values);
  12193. self.setActiveItem(active);
  12194. }
  12195. });
  12196. };
  12197. }();
  12198. });
  12199. Selectize.define('dropdown_header', function (options) {
  12200. var self = this;
  12201. options = $.extend({
  12202. title: 'Untitled',
  12203. headerClass: 'selectize-dropdown-header',
  12204. titleRowClass: 'selectize-dropdown-header-title',
  12205. labelClass: 'selectize-dropdown-header-label',
  12206. closeClass: 'selectize-dropdown-header-close',
  12207. html: function html(data) {
  12208. 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>';
  12209. }
  12210. }, options);
  12211. self.setup = function () {
  12212. var original = self.setup;
  12213. return function () {
  12214. original.apply(self, arguments);
  12215. self.$dropdown_header = $(options.html(options));
  12216. self.$dropdown.prepend(self.$dropdown_header);
  12217. };
  12218. }();
  12219. });
  12220. Selectize.define('optgroup_columns', function (options) {
  12221. var self = this;
  12222. options = $.extend({
  12223. equalizeWidth: true,
  12224. equalizeHeight: true
  12225. }, options);
  12226. this.getAdjacentOption = function ($option, direction) {
  12227. var $options = $option.closest('[data-group]').find('[data-selectable]');
  12228. var index = $options.index($option) + direction;
  12229. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12230. };
  12231. this.onKeyDown = function () {
  12232. var original = self.onKeyDown;
  12233. return function (e) {
  12234. var index, $option, $options, $optgroup;
  12235. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  12236. self.ignoreHover = true;
  12237. $optgroup = this.$activeOption.closest('[data-group]');
  12238. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  12239. if (e.keyCode === KEY_LEFT) {
  12240. $optgroup = $optgroup.prev('[data-group]');
  12241. } else {
  12242. $optgroup = $optgroup.next('[data-group]');
  12243. }
  12244. $options = $optgroup.find('[data-selectable]');
  12245. $option = $options.eq(Math.min($options.length - 1, index));
  12246. if ($option.length) {
  12247. this.setActiveOption($option);
  12248. }
  12249. return;
  12250. }
  12251. return original.apply(this, arguments);
  12252. };
  12253. }();
  12254. var getScrollbarWidth = function getScrollbarWidth() {
  12255. var div;
  12256. var width = getScrollbarWidth.width;
  12257. var doc = document;
  12258. if (typeof width === 'undefined') {
  12259. div = doc.createElement('div');
  12260. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  12261. div = div.firstChild;
  12262. doc.body.appendChild(div);
  12263. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  12264. doc.body.removeChild(div);
  12265. }
  12266. return width;
  12267. };
  12268. var equalizeSizes = function equalizeSizes() {
  12269. var i, n, height_max, width, width_last, width_parent, $optgroups;
  12270. $optgroups = $('[data-group]', self.$dropdown_content);
  12271. n = $optgroups.length;
  12272. if (!n || !self.$dropdown_content.width()) return;
  12273. if (options.equalizeHeight) {
  12274. height_max = 0;
  12275. for (i = 0; i < n; i++) {
  12276. height_max = Math.max(height_max, $optgroups.eq(i).height());
  12277. }
  12278. $optgroups.css({ height: height_max });
  12279. }
  12280. if (options.equalizeWidth) {
  12281. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  12282. width = Math.round(width_parent / n);
  12283. $optgroups.css({ width: width });
  12284. if (n > 1) {
  12285. width_last = width_parent - width * (n - 1);
  12286. $optgroups.eq(n - 1).css({ width: width_last });
  12287. }
  12288. }
  12289. };
  12290. if (options.equalizeHeight || options.equalizeWidth) {
  12291. hook.after(this, 'positionDropdown', equalizeSizes);
  12292. hook.after(this, 'refreshOptions', equalizeSizes);
  12293. }
  12294. });
  12295. Selectize.define('remove_button', function (options) {
  12296. options = $.extend({
  12297. label: '&times;',
  12298. title: 'Remove',
  12299. className: 'remove',
  12300. append: true
  12301. }, options);
  12302. var singleClose = function singleClose(thisRef, options) {
  12303. options.className = 'remove-single';
  12304. var self = thisRef;
  12305. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12306. /**
  12307. * Appends an element as a child (with raw HTML).
  12308. *
  12309. * @param {string} html_container
  12310. * @param {string} html_element
  12311. * @return {string}
  12312. */
  12313. var append = function append(html_container, html_element) {
  12314. return html_container + html_element;
  12315. };
  12316. thisRef.setup = function () {
  12317. var original = self.setup;
  12318. return function () {
  12319. // override the item rendering method to add the button to each
  12320. if (options.append) {
  12321. var id = $(self.$input.context).attr('id');
  12322. var selectizer = $('#' + id);
  12323. var render_item = self.settings.render.item;
  12324. self.settings.render.item = function (data) {
  12325. return append(render_item.apply(thisRef, arguments), html);
  12326. };
  12327. }
  12328. original.apply(thisRef, arguments);
  12329. // add event listener
  12330. thisRef.$control.on('click', '.' + options.className, function (e) {
  12331. e.preventDefault();
  12332. if (self.isLocked) return;
  12333. self.clear();
  12334. });
  12335. };
  12336. }();
  12337. };
  12338. var multiClose = function multiClose(thisRef, options) {
  12339. var self = thisRef;
  12340. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12341. /**
  12342. * Appends an element as a child (with raw HTML).
  12343. *
  12344. * @param {string} html_container
  12345. * @param {string} html_element
  12346. * @return {string}
  12347. */
  12348. var append = function append(html_container, html_element) {
  12349. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  12350. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  12351. };
  12352. thisRef.setup = function () {
  12353. var original = self.setup;
  12354. return function () {
  12355. // override the item rendering method to add the button to each
  12356. if (options.append) {
  12357. var render_item = self.settings.render.item;
  12358. self.settings.render.item = function (data) {
  12359. return append(render_item.apply(thisRef, arguments), html);
  12360. };
  12361. }
  12362. original.apply(thisRef, arguments);
  12363. // add event listener
  12364. thisRef.$control.on('click', '.' + options.className, function (e) {
  12365. e.preventDefault();
  12366. if (self.isLocked) return;
  12367. var $item = $(e.currentTarget).parent();
  12368. self.setActiveItem($item);
  12369. if (self.deleteSelection()) {
  12370. self.setCaret(self.items.length);
  12371. }
  12372. });
  12373. };
  12374. }();
  12375. };
  12376. if (this.settings.mode === 'single') {
  12377. singleClose(this, options);
  12378. return;
  12379. } else {
  12380. multiClose(this, options);
  12381. }
  12382. });
  12383. Selectize.define('restore_on_backspace', function (options) {
  12384. var self = this;
  12385. options.text = options.text || function (option) {
  12386. return option[this.settings.labelField];
  12387. };
  12388. this.onKeyDown = function () {
  12389. var original = self.onKeyDown;
  12390. return function (e) {
  12391. var index, option;
  12392. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  12393. index = this.caretPos - 1;
  12394. if (index >= 0 && index < this.items.length) {
  12395. option = this.options[this.items[index]];
  12396. if (this.deleteSelection(e)) {
  12397. this.setTextboxValue(options.text.apply(this, [option]));
  12398. this.refreshOptions(true);
  12399. }
  12400. e.preventDefault();
  12401. return;
  12402. }
  12403. }
  12404. return original.apply(this, arguments);
  12405. };
  12406. }();
  12407. });
  12408. return Selectize;
  12409. });
  12410. /***/ }),
  12411. /* 30 */
  12412. /***/ (function(module, exports, __webpack_require__) {
  12413. "use strict";
  12414. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12415. /*!
  12416. Autosize 4.0.0
  12417. license: MIT
  12418. http://www.jacklmoore.com/autosize
  12419. */
  12420. (function (global, factory) {
  12421. if (true) {
  12422. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12423. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12424. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12425. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12426. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  12427. factory(exports, module);
  12428. } else {
  12429. var mod = {
  12430. exports: {}
  12431. };
  12432. factory(mod.exports, mod);
  12433. global.autosize = mod.exports;
  12434. }
  12435. })(undefined, function (exports, module) {
  12436. 'use strict';
  12437. var map = typeof Map === "function" ? new Map() : function () {
  12438. var keys = [];
  12439. var values = [];
  12440. return {
  12441. has: function has(key) {
  12442. return keys.indexOf(key) > -1;
  12443. },
  12444. get: function get(key) {
  12445. return values[keys.indexOf(key)];
  12446. },
  12447. set: function set(key, value) {
  12448. if (keys.indexOf(key) === -1) {
  12449. keys.push(key);
  12450. values.push(value);
  12451. }
  12452. },
  12453. 'delete': function _delete(key) {
  12454. var index = keys.indexOf(key);
  12455. if (index > -1) {
  12456. keys.splice(index, 1);
  12457. values.splice(index, 1);
  12458. }
  12459. }
  12460. };
  12461. }();
  12462. var createEvent = function createEvent(name) {
  12463. return new Event(name, { bubbles: true });
  12464. };
  12465. try {
  12466. new Event('test');
  12467. } catch (e) {
  12468. // IE does not support `new Event()`
  12469. createEvent = function createEvent(name) {
  12470. var evt = document.createEvent('Event');
  12471. evt.initEvent(name, true, false);
  12472. return evt;
  12473. };
  12474. }
  12475. function assign(ta) {
  12476. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  12477. var heightOffset = null;
  12478. var clientWidth = ta.clientWidth;
  12479. var cachedHeight = null;
  12480. function init() {
  12481. var style = window.getComputedStyle(ta, null);
  12482. if (style.resize === 'vertical') {
  12483. ta.style.resize = 'none';
  12484. } else if (style.resize === 'both') {
  12485. ta.style.resize = 'horizontal';
  12486. }
  12487. if (style.boxSizing === 'content-box') {
  12488. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  12489. } else {
  12490. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  12491. }
  12492. // Fix when a textarea is not on document body and heightOffset is Not a Number
  12493. if (isNaN(heightOffset)) {
  12494. heightOffset = 0;
  12495. }
  12496. update();
  12497. }
  12498. function changeOverflow(value) {
  12499. {
  12500. // Chrome/Safari-specific fix:
  12501. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  12502. // made available by removing the scrollbar. The following forces the necessary text reflow.
  12503. var width = ta.style.width;
  12504. ta.style.width = '0px';
  12505. // Force reflow:
  12506. /* jshint ignore:start */
  12507. ta.offsetWidth;
  12508. /* jshint ignore:end */
  12509. ta.style.width = width;
  12510. }
  12511. ta.style.overflowY = value;
  12512. }
  12513. function getParentOverflows(el) {
  12514. var arr = [];
  12515. while (el && el.parentNode && el.parentNode instanceof Element) {
  12516. if (el.parentNode.scrollTop) {
  12517. arr.push({
  12518. node: el.parentNode,
  12519. scrollTop: el.parentNode.scrollTop
  12520. });
  12521. }
  12522. el = el.parentNode;
  12523. }
  12524. return arr;
  12525. }
  12526. function resize() {
  12527. var originalHeight = ta.style.height;
  12528. var overflows = getParentOverflows(ta);
  12529. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  12530. ta.style.height = '';
  12531. var endHeight = ta.scrollHeight + heightOffset;
  12532. if (ta.scrollHeight === 0) {
  12533. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  12534. ta.style.height = originalHeight;
  12535. return;
  12536. }
  12537. ta.style.height = endHeight + 'px';
  12538. // used to check if an update is actually necessary on window.resize
  12539. clientWidth = ta.clientWidth;
  12540. // prevents scroll-position jumping
  12541. overflows.forEach(function (el) {
  12542. el.node.scrollTop = el.scrollTop;
  12543. });
  12544. if (docTop) {
  12545. document.documentElement.scrollTop = docTop;
  12546. }
  12547. }
  12548. function update() {
  12549. resize();
  12550. var styleHeight = Math.round(parseFloat(ta.style.height));
  12551. var computed = window.getComputedStyle(ta, null);
  12552. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  12553. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  12554. // The actual height not matching the style height (set via the resize method) indicates that
  12555. // the max-height has been exceeded, in which case the overflow should be allowed.
  12556. if (actualHeight !== styleHeight) {
  12557. if (computed.overflowY === 'hidden') {
  12558. changeOverflow('scroll');
  12559. resize();
  12560. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12561. }
  12562. } else {
  12563. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  12564. if (computed.overflowY !== 'hidden') {
  12565. changeOverflow('hidden');
  12566. resize();
  12567. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12568. }
  12569. }
  12570. if (cachedHeight !== actualHeight) {
  12571. cachedHeight = actualHeight;
  12572. var evt = createEvent('autosize:resized');
  12573. try {
  12574. ta.dispatchEvent(evt);
  12575. } catch (err) {
  12576. // Firefox will throw an error on dispatchEvent for a detached element
  12577. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  12578. }
  12579. }
  12580. }
  12581. var pageResize = function pageResize() {
  12582. if (ta.clientWidth !== clientWidth) {
  12583. update();
  12584. }
  12585. };
  12586. var destroy = function (style) {
  12587. window.removeEventListener('resize', pageResize, false);
  12588. ta.removeEventListener('input', update, false);
  12589. ta.removeEventListener('keyup', update, false);
  12590. ta.removeEventListener('autosize:destroy', destroy, false);
  12591. ta.removeEventListener('autosize:update', update, false);
  12592. Object.keys(style).forEach(function (key) {
  12593. ta.style[key] = style[key];
  12594. });
  12595. map['delete'](ta);
  12596. }.bind(ta, {
  12597. height: ta.style.height,
  12598. resize: ta.style.resize,
  12599. overflowY: ta.style.overflowY,
  12600. overflowX: ta.style.overflowX,
  12601. wordWrap: ta.style.wordWrap
  12602. });
  12603. ta.addEventListener('autosize:destroy', destroy, false);
  12604. // IE9 does not fire onpropertychange or oninput for deletions,
  12605. // so binding to onkeyup to catch most of those events.
  12606. // There is no way that I know of to detect something like 'cut' in IE9.
  12607. if ('onpropertychange' in ta && 'oninput' in ta) {
  12608. ta.addEventListener('keyup', update, false);
  12609. }
  12610. window.addEventListener('resize', pageResize, false);
  12611. ta.addEventListener('input', update, false);
  12612. ta.addEventListener('autosize:update', update, false);
  12613. ta.style.overflowX = 'hidden';
  12614. ta.style.wordWrap = 'break-word';
  12615. map.set(ta, {
  12616. destroy: destroy,
  12617. update: update
  12618. });
  12619. init();
  12620. }
  12621. function destroy(ta) {
  12622. var methods = map.get(ta);
  12623. if (methods) {
  12624. methods.destroy();
  12625. }
  12626. }
  12627. function update(ta) {
  12628. var methods = map.get(ta);
  12629. if (methods) {
  12630. methods.update();
  12631. }
  12632. }
  12633. var autosize = null;
  12634. // Do nothing in Node.js environment and IE8 (or lower)
  12635. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  12636. autosize = function autosize(el) {
  12637. return el;
  12638. };
  12639. autosize.destroy = function (el) {
  12640. return el;
  12641. };
  12642. autosize.update = function (el) {
  12643. return el;
  12644. };
  12645. } else {
  12646. autosize = function autosize(el, options) {
  12647. if (el) {
  12648. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  12649. return assign(x, options);
  12650. });
  12651. }
  12652. return el;
  12653. };
  12654. autosize.destroy = function (el) {
  12655. if (el) {
  12656. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  12657. }
  12658. return el;
  12659. };
  12660. autosize.update = function (el) {
  12661. if (el) {
  12662. Array.prototype.forEach.call(el.length ? el : [el], update);
  12663. }
  12664. return el;
  12665. };
  12666. }
  12667. module.exports = autosize;
  12668. });
  12669. /***/ }),
  12670. /* 31 */
  12671. /***/ (function(module, exports, __webpack_require__) {
  12672. "use strict";
  12673. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;
  12674. 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; };
  12675. /*!
  12676. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  12677. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  12678. * License: MIT */
  12679. (function (f) {
  12680. if (( false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  12681. module.exports = f();
  12682. } else if (true) {
  12683. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  12684. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12685. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12686. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12687. } else {
  12688. var g;if (typeof window !== "undefined") {
  12689. g = window;
  12690. } else if (typeof global !== "undefined") {
  12691. g = global;
  12692. } else if (typeof self !== "undefined") {
  12693. g = self;
  12694. } else {
  12695. g = this;
  12696. }g.enquire = f();
  12697. }
  12698. })(function () {
  12699. var define, module, exports;return function e(t, n, r) {
  12700. function s(o, u) {
  12701. if (!n[o]) {
  12702. if (!t[o]) {
  12703. 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;
  12704. }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
  12705. var n = t[o][1][e];return s(n ? n : e);
  12706. }, l, l.exports, e, t, n, r);
  12707. }return n[o].exports;
  12708. }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
  12709. s(r[o]);
  12710. }return s;
  12711. }({ 1: [function (require, module, exports) {
  12712. var QueryHandler = require(3);
  12713. var each = require(4).each;
  12714. /**
  12715. * Represents a single media query, manages it's state and registered handlers for this query
  12716. *
  12717. * @constructor
  12718. * @param {string} query the media query string
  12719. * @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
  12720. */
  12721. function MediaQuery(query, isUnconditional) {
  12722. this.query = query;
  12723. this.isUnconditional = isUnconditional;
  12724. this.handlers = [];
  12725. this.mql = window.matchMedia(query);
  12726. var self = this;
  12727. this.listener = function (mql) {
  12728. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  12729. self.mql = mql.currentTarget || mql;
  12730. self.assess();
  12731. };
  12732. this.mql.addListener(this.listener);
  12733. }
  12734. MediaQuery.prototype = {
  12735. constuctor: MediaQuery,
  12736. /**
  12737. * add a handler for this query, triggering if already active
  12738. *
  12739. * @param {object} handler
  12740. * @param {function} handler.match callback for when query is activated
  12741. * @param {function} [handler.unmatch] callback for when query is deactivated
  12742. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  12743. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  12744. */
  12745. addHandler: function addHandler(handler) {
  12746. var qh = new QueryHandler(handler);
  12747. this.handlers.push(qh);
  12748. this.matches() && qh.on();
  12749. },
  12750. /**
  12751. * removes the given handler from the collection, and calls it's destroy methods
  12752. *
  12753. * @param {object || function} handler the handler to remove
  12754. */
  12755. removeHandler: function removeHandler(handler) {
  12756. var handlers = this.handlers;
  12757. each(handlers, function (h, i) {
  12758. if (h.equals(handler)) {
  12759. h.destroy();
  12760. return !handlers.splice(i, 1); //remove from array and exit each early
  12761. }
  12762. });
  12763. },
  12764. /**
  12765. * Determine whether the media query should be considered a match
  12766. *
  12767. * @return {Boolean} true if media query can be considered a match, false otherwise
  12768. */
  12769. matches: function matches() {
  12770. return this.mql.matches || this.isUnconditional;
  12771. },
  12772. /**
  12773. * Clears all handlers and unbinds events
  12774. */
  12775. clear: function clear() {
  12776. each(this.handlers, function (handler) {
  12777. handler.destroy();
  12778. });
  12779. this.mql.removeListener(this.listener);
  12780. this.handlers.length = 0; //clear array
  12781. },
  12782. /*
  12783. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  12784. */
  12785. assess: function assess() {
  12786. var action = this.matches() ? 'on' : 'off';
  12787. each(this.handlers, function (handler) {
  12788. handler[action]();
  12789. });
  12790. }
  12791. };
  12792. module.exports = MediaQuery;
  12793. }, { "3": 3, "4": 4 }], 2: [function (require, module, exports) {
  12794. var MediaQuery = require(1);
  12795. var Util = require(4);
  12796. var each = Util.each;
  12797. var isFunction = Util.isFunction;
  12798. var isArray = Util.isArray;
  12799. /**
  12800. * Allows for registration of query handlers.
  12801. * Manages the query handler's state and is responsible for wiring up browser events
  12802. *
  12803. * @constructor
  12804. */
  12805. function MediaQueryDispatch() {
  12806. if (!window.matchMedia) {
  12807. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  12808. }
  12809. this.queries = {};
  12810. this.browserIsIncapable = !window.matchMedia('only all').matches;
  12811. }
  12812. MediaQueryDispatch.prototype = {
  12813. constructor: MediaQueryDispatch,
  12814. /**
  12815. * Registers a handler for the given media query
  12816. *
  12817. * @param {string} q the media query
  12818. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  12819. * @param {function} options.match fired when query matched
  12820. * @param {function} [options.unmatch] fired when a query is no longer matched
  12821. * @param {function} [options.setup] fired when handler first triggered
  12822. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  12823. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  12824. */
  12825. register: function register(q, options, shouldDegrade) {
  12826. var queries = this.queries,
  12827. isUnconditional = shouldDegrade && this.browserIsIncapable;
  12828. if (!queries[q]) {
  12829. queries[q] = new MediaQuery(q, isUnconditional);
  12830. }
  12831. //normalise to object in an array
  12832. if (isFunction(options)) {
  12833. options = { match: options };
  12834. }
  12835. if (!isArray(options)) {
  12836. options = [options];
  12837. }
  12838. each(options, function (handler) {
  12839. if (isFunction(handler)) {
  12840. handler = { match: handler };
  12841. }
  12842. queries[q].addHandler(handler);
  12843. });
  12844. return this;
  12845. },
  12846. /**
  12847. * unregisters a query and all it's handlers, or a specific handler for a query
  12848. *
  12849. * @param {string} q the media query to target
  12850. * @param {object || function} [handler] specific handler to unregister
  12851. */
  12852. unregister: function unregister(q, handler) {
  12853. var query = this.queries[q];
  12854. if (query) {
  12855. if (handler) {
  12856. query.removeHandler(handler);
  12857. } else {
  12858. query.clear();
  12859. delete this.queries[q];
  12860. }
  12861. }
  12862. return this;
  12863. }
  12864. };
  12865. module.exports = MediaQueryDispatch;
  12866. }, { "1": 1, "4": 4 }], 3: [function (require, module, exports) {
  12867. /**
  12868. * Delegate to handle a media query being matched and unmatched.
  12869. *
  12870. * @param {object} options
  12871. * @param {function} options.match callback for when the media query is matched
  12872. * @param {function} [options.unmatch] callback for when the media query is unmatched
  12873. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  12874. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  12875. * @constructor
  12876. */
  12877. function QueryHandler(options) {
  12878. this.options = options;
  12879. !options.deferSetup && this.setup();
  12880. }
  12881. QueryHandler.prototype = {
  12882. constructor: QueryHandler,
  12883. /**
  12884. * coordinates setup of the handler
  12885. *
  12886. * @function
  12887. */
  12888. setup: function setup() {
  12889. if (this.options.setup) {
  12890. this.options.setup();
  12891. }
  12892. this.initialised = true;
  12893. },
  12894. /**
  12895. * coordinates setup and triggering of the handler
  12896. *
  12897. * @function
  12898. */
  12899. on: function on() {
  12900. !this.initialised && this.setup();
  12901. this.options.match && this.options.match();
  12902. },
  12903. /**
  12904. * coordinates the unmatch event for the handler
  12905. *
  12906. * @function
  12907. */
  12908. off: function off() {
  12909. this.options.unmatch && this.options.unmatch();
  12910. },
  12911. /**
  12912. * called when a handler is to be destroyed.
  12913. * delegates to the destroy or unmatch callbacks, depending on availability.
  12914. *
  12915. * @function
  12916. */
  12917. destroy: function destroy() {
  12918. this.options.destroy ? this.options.destroy() : this.off();
  12919. },
  12920. /**
  12921. * determines equality by reference.
  12922. * if object is supplied compare options, if function, compare match callback
  12923. *
  12924. * @function
  12925. * @param {object || function} [target] the target for comparison
  12926. */
  12927. equals: function equals(target) {
  12928. return this.options === target || this.options.match === target;
  12929. }
  12930. };
  12931. module.exports = QueryHandler;
  12932. }, {}], 4: [function (require, module, exports) {
  12933. /**
  12934. * Helper function for iterating over a collection
  12935. *
  12936. * @param collection
  12937. * @param fn
  12938. */
  12939. function each(collection, fn) {
  12940. var i = 0,
  12941. length = collection.length,
  12942. cont;
  12943. for (i; i < length; i++) {
  12944. cont = fn(collection[i], i);
  12945. if (cont === false) {
  12946. break; //allow early exit
  12947. }
  12948. }
  12949. }
  12950. /**
  12951. * Helper function for determining whether target object is an array
  12952. *
  12953. * @param target the object under test
  12954. * @return {Boolean} true if array, false otherwise
  12955. */
  12956. function isArray(target) {
  12957. return Object.prototype.toString.apply(target) === '[object Array]';
  12958. }
  12959. /**
  12960. * Helper function for determining whether target object is a function
  12961. *
  12962. * @param target the object under test
  12963. * @return {Boolean} true if function, false otherwise
  12964. */
  12965. function isFunction(target) {
  12966. return typeof target === 'function';
  12967. }
  12968. module.exports = {
  12969. isFunction: isFunction,
  12970. isArray: isArray,
  12971. each: each
  12972. };
  12973. }, {}], 5: [function (require, module, exports) {
  12974. var MediaQueryDispatch = require(2);
  12975. module.exports = new MediaQueryDispatch();
  12976. }, { "2": 2 }] }, {}, [5])(5);
  12977. });
  12978. /***/ }),
  12979. /* 32 */
  12980. /***/ (function(module, exports, __webpack_require__) {
  12981. "use strict";
  12982. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12983. /*! jQuery UI - v1.12.1 - 2017-03-23
  12984. * http://jqueryui.com
  12985. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  12986. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  12987. (function (factory) {
  12988. if (true) {
  12989. // AMD. Register as an anonymous module.
  12990. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12991. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12992. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12993. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12994. } else {
  12995. // Browser globals
  12996. factory(jQuery);
  12997. }
  12998. })(function ($) {
  12999. $.ui = $.ui || {};
  13000. var version = $.ui.version = "1.12.1";
  13001. /*!
  13002. * jQuery UI Widget 1.12.1
  13003. * http://jqueryui.com
  13004. *
  13005. * Copyright jQuery Foundation and other contributors
  13006. * Released under the MIT license.
  13007. * http://jquery.org/license
  13008. */
  13009. //>>label: Widget
  13010. //>>group: Core
  13011. //>>description: Provides a factory for creating stateful widgets with a common API.
  13012. //>>docs: http://api.jqueryui.com/jQuery.widget/
  13013. //>>demos: http://jqueryui.com/widget/
  13014. var widgetUuid = 0;
  13015. var widgetSlice = Array.prototype.slice;
  13016. $.cleanData = function (orig) {
  13017. return function (elems) {
  13018. var events, elem, i;
  13019. for (i = 0; (elem = elems[i]) != null; i++) {
  13020. try {
  13021. // Only trigger remove when necessary to save time
  13022. events = $._data(elem, "events");
  13023. if (events && events.remove) {
  13024. $(elem).triggerHandler("remove");
  13025. }
  13026. // Http://bugs.jquery.com/ticket/8235
  13027. } catch (e) {}
  13028. }
  13029. orig(elems);
  13030. };
  13031. }($.cleanData);
  13032. $.widget = function (name, base, prototype) {
  13033. var existingConstructor, constructor, basePrototype;
  13034. // ProxiedPrototype allows the provided prototype to remain unmodified
  13035. // so that it can be used as a mixin for multiple widgets (#8876)
  13036. var proxiedPrototype = {};
  13037. var namespace = name.split(".")[0];
  13038. name = name.split(".")[1];
  13039. var fullName = namespace + "-" + name;
  13040. if (!prototype) {
  13041. prototype = base;
  13042. base = $.Widget;
  13043. }
  13044. if ($.isArray(prototype)) {
  13045. prototype = $.extend.apply(null, [{}].concat(prototype));
  13046. }
  13047. // Create selector for plugin
  13048. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  13049. return !!$.data(elem, fullName);
  13050. };
  13051. $[namespace] = $[namespace] || {};
  13052. existingConstructor = $[namespace][name];
  13053. constructor = $[namespace][name] = function (options, element) {
  13054. // Allow instantiation without "new" keyword
  13055. if (!this._createWidget) {
  13056. return new constructor(options, element);
  13057. }
  13058. // Allow instantiation without initializing for simple inheritance
  13059. // must use "new" keyword (the code above always passes args)
  13060. if (arguments.length) {
  13061. this._createWidget(options, element);
  13062. }
  13063. };
  13064. // Extend with the existing constructor to carry over any static properties
  13065. $.extend(constructor, existingConstructor, {
  13066. version: prototype.version,
  13067. // Copy the object used to create the prototype in case we need to
  13068. // redefine the widget later
  13069. _proto: $.extend({}, prototype),
  13070. // Track widgets that inherit from this widget in case this widget is
  13071. // redefined after a widget inherits from it
  13072. _childConstructors: []
  13073. });
  13074. basePrototype = new base();
  13075. // We need to make the options hash a property directly on the new instance
  13076. // otherwise we'll modify the options hash on the prototype that we're
  13077. // inheriting from
  13078. basePrototype.options = $.widget.extend({}, basePrototype.options);
  13079. $.each(prototype, function (prop, value) {
  13080. if (!$.isFunction(value)) {
  13081. proxiedPrototype[prop] = value;
  13082. return;
  13083. }
  13084. proxiedPrototype[prop] = function () {
  13085. function _super() {
  13086. return base.prototype[prop].apply(this, arguments);
  13087. }
  13088. function _superApply(args) {
  13089. return base.prototype[prop].apply(this, args);
  13090. }
  13091. return function () {
  13092. var __super = this._super;
  13093. var __superApply = this._superApply;
  13094. var returnValue;
  13095. this._super = _super;
  13096. this._superApply = _superApply;
  13097. returnValue = value.apply(this, arguments);
  13098. this._super = __super;
  13099. this._superApply = __superApply;
  13100. return returnValue;
  13101. };
  13102. }();
  13103. });
  13104. constructor.prototype = $.widget.extend(basePrototype, {
  13105. // TODO: remove support for widgetEventPrefix
  13106. // always use the name + a colon as the prefix, e.g., draggable:start
  13107. // don't prefix for widgets that aren't DOM-based
  13108. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  13109. }, proxiedPrototype, {
  13110. constructor: constructor,
  13111. namespace: namespace,
  13112. widgetName: name,
  13113. widgetFullName: fullName
  13114. });
  13115. // If this widget is being redefined then we need to find all widgets that
  13116. // are inheriting from it and redefine all of them so that they inherit from
  13117. // the new version of this widget. We're essentially trying to replace one
  13118. // level in the prototype chain.
  13119. if (existingConstructor) {
  13120. $.each(existingConstructor._childConstructors, function (i, child) {
  13121. var childPrototype = child.prototype;
  13122. // Redefine the child widget using the same prototype that was
  13123. // originally used, but inherit from the new version of the base
  13124. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  13125. });
  13126. // Remove the list of existing child constructors from the old constructor
  13127. // so the old child constructors can be garbage collected
  13128. delete existingConstructor._childConstructors;
  13129. } else {
  13130. base._childConstructors.push(constructor);
  13131. }
  13132. $.widget.bridge(name, constructor);
  13133. return constructor;
  13134. };
  13135. $.widget.extend = function (target) {
  13136. var input = widgetSlice.call(arguments, 1);
  13137. var inputIndex = 0;
  13138. var inputLength = input.length;
  13139. var key;
  13140. var value;
  13141. for (; inputIndex < inputLength; inputIndex++) {
  13142. for (key in input[inputIndex]) {
  13143. value = input[inputIndex][key];
  13144. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  13145. // Clone objects
  13146. if ($.isPlainObject(value)) {
  13147. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  13148. // Don't extend strings, arrays, etc. with objects
  13149. $.widget.extend({}, value);
  13150. // Copy everything else by reference
  13151. } else {
  13152. target[key] = value;
  13153. }
  13154. }
  13155. }
  13156. }
  13157. return target;
  13158. };
  13159. $.widget.bridge = function (name, object) {
  13160. var fullName = object.prototype.widgetFullName || name;
  13161. $.fn[name] = function (options) {
  13162. var isMethodCall = typeof options === "string";
  13163. var args = widgetSlice.call(arguments, 1);
  13164. var returnValue = this;
  13165. if (isMethodCall) {
  13166. // If this is an empty collection, we need to have the instance method
  13167. // return undefined instead of the jQuery instance
  13168. if (!this.length && options === "instance") {
  13169. returnValue = undefined;
  13170. } else {
  13171. this.each(function () {
  13172. var methodValue;
  13173. var instance = $.data(this, fullName);
  13174. if (options === "instance") {
  13175. returnValue = instance;
  13176. return false;
  13177. }
  13178. if (!instance) {
  13179. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  13180. }
  13181. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  13182. return $.error("no such method '" + options + "' for " + name + " widget instance");
  13183. }
  13184. methodValue = instance[options].apply(instance, args);
  13185. if (methodValue !== instance && methodValue !== undefined) {
  13186. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  13187. return false;
  13188. }
  13189. });
  13190. }
  13191. } else {
  13192. // Allow multiple hashes to be passed on init
  13193. if (args.length) {
  13194. options = $.widget.extend.apply(null, [options].concat(args));
  13195. }
  13196. this.each(function () {
  13197. var instance = $.data(this, fullName);
  13198. if (instance) {
  13199. instance.option(options || {});
  13200. if (instance._init) {
  13201. instance._init();
  13202. }
  13203. } else {
  13204. $.data(this, fullName, new object(options, this));
  13205. }
  13206. });
  13207. }
  13208. return returnValue;
  13209. };
  13210. };
  13211. $.Widget = function () /* options, element */{};
  13212. $.Widget._childConstructors = [];
  13213. $.Widget.prototype = {
  13214. widgetName: "widget",
  13215. widgetEventPrefix: "",
  13216. defaultElement: "<div>",
  13217. options: {
  13218. classes: {},
  13219. disabled: false,
  13220. // Callbacks
  13221. create: null
  13222. },
  13223. _createWidget: function _createWidget(options, element) {
  13224. element = $(element || this.defaultElement || this)[0];
  13225. this.element = $(element);
  13226. this.uuid = widgetUuid++;
  13227. this.eventNamespace = "." + this.widgetName + this.uuid;
  13228. this.bindings = $();
  13229. this.hoverable = $();
  13230. this.focusable = $();
  13231. this.classesElementLookup = {};
  13232. if (element !== this) {
  13233. $.data(element, this.widgetFullName, this);
  13234. this._on(true, this.element, {
  13235. remove: function remove(event) {
  13236. if (event.target === element) {
  13237. this.destroy();
  13238. }
  13239. }
  13240. });
  13241. this.document = $(element.style ?
  13242. // Element within the document
  13243. element.ownerDocument :
  13244. // Element is window or document
  13245. element.document || element);
  13246. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  13247. }
  13248. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  13249. this._create();
  13250. if (this.options.disabled) {
  13251. this._setOptionDisabled(this.options.disabled);
  13252. }
  13253. this._trigger("create", null, this._getCreateEventData());
  13254. this._init();
  13255. },
  13256. _getCreateOptions: function _getCreateOptions() {
  13257. return {};
  13258. },
  13259. _getCreateEventData: $.noop,
  13260. _create: $.noop,
  13261. _init: $.noop,
  13262. destroy: function destroy() {
  13263. var that = this;
  13264. this._destroy();
  13265. $.each(this.classesElementLookup, function (key, value) {
  13266. that._removeClass(value, key);
  13267. });
  13268. // We can probably remove the unbind calls in 2.0
  13269. // all event bindings should go through this._on()
  13270. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  13271. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  13272. // Clean up events and states
  13273. this.bindings.off(this.eventNamespace);
  13274. },
  13275. _destroy: $.noop,
  13276. widget: function widget() {
  13277. return this.element;
  13278. },
  13279. option: function option(key, value) {
  13280. var options = key;
  13281. var parts;
  13282. var curOption;
  13283. var i;
  13284. if (arguments.length === 0) {
  13285. // Don't return a reference to the internal hash
  13286. return $.widget.extend({}, this.options);
  13287. }
  13288. if (typeof key === "string") {
  13289. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  13290. options = {};
  13291. parts = key.split(".");
  13292. key = parts.shift();
  13293. if (parts.length) {
  13294. curOption = options[key] = $.widget.extend({}, this.options[key]);
  13295. for (i = 0; i < parts.length - 1; i++) {
  13296. curOption[parts[i]] = curOption[parts[i]] || {};
  13297. curOption = curOption[parts[i]];
  13298. }
  13299. key = parts.pop();
  13300. if (arguments.length === 1) {
  13301. return curOption[key] === undefined ? null : curOption[key];
  13302. }
  13303. curOption[key] = value;
  13304. } else {
  13305. if (arguments.length === 1) {
  13306. return this.options[key] === undefined ? null : this.options[key];
  13307. }
  13308. options[key] = value;
  13309. }
  13310. }
  13311. this._setOptions(options);
  13312. return this;
  13313. },
  13314. _setOptions: function _setOptions(options) {
  13315. var key;
  13316. for (key in options) {
  13317. this._setOption(key, options[key]);
  13318. }
  13319. return this;
  13320. },
  13321. _setOption: function _setOption(key, value) {
  13322. if (key === "classes") {
  13323. this._setOptionClasses(value);
  13324. }
  13325. this.options[key] = value;
  13326. if (key === "disabled") {
  13327. this._setOptionDisabled(value);
  13328. }
  13329. return this;
  13330. },
  13331. _setOptionClasses: function _setOptionClasses(value) {
  13332. var classKey, elements, currentElements;
  13333. for (classKey in value) {
  13334. currentElements = this.classesElementLookup[classKey];
  13335. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  13336. continue;
  13337. }
  13338. // We are doing this to create a new jQuery object because the _removeClass() call
  13339. // on the next line is going to destroy the reference to the current elements being
  13340. // tracked. We need to save a copy of this collection so that we can add the new classes
  13341. // below.
  13342. elements = $(currentElements.get());
  13343. this._removeClass(currentElements, classKey);
  13344. // We don't use _addClass() here, because that uses this.options.classes
  13345. // for generating the string of classes. We want to use the value passed in from
  13346. // _setOption(), this is the new value of the classes option which was passed to
  13347. // _setOption(). We pass this value directly to _classes().
  13348. elements.addClass(this._classes({
  13349. element: elements,
  13350. keys: classKey,
  13351. classes: value,
  13352. add: true
  13353. }));
  13354. }
  13355. },
  13356. _setOptionDisabled: function _setOptionDisabled(value) {
  13357. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  13358. // If the widget is becoming disabled, then nothing is interactive
  13359. if (value) {
  13360. this._removeClass(this.hoverable, null, "ui-state-hover");
  13361. this._removeClass(this.focusable, null, "ui-state-focus");
  13362. }
  13363. },
  13364. enable: function enable() {
  13365. return this._setOptions({ disabled: false });
  13366. },
  13367. disable: function disable() {
  13368. return this._setOptions({ disabled: true });
  13369. },
  13370. _classes: function _classes(options) {
  13371. var full = [];
  13372. var that = this;
  13373. options = $.extend({
  13374. element: this.element,
  13375. classes: this.options.classes || {}
  13376. }, options);
  13377. function processClassString(classes, checkOption) {
  13378. var current, i;
  13379. for (i = 0; i < classes.length; i++) {
  13380. current = that.classesElementLookup[classes[i]] || $();
  13381. if (options.add) {
  13382. current = $($.unique(current.get().concat(options.element.get())));
  13383. } else {
  13384. current = $(current.not(options.element).get());
  13385. }
  13386. that.classesElementLookup[classes[i]] = current;
  13387. full.push(classes[i]);
  13388. if (checkOption && options.classes[classes[i]]) {
  13389. full.push(options.classes[classes[i]]);
  13390. }
  13391. }
  13392. }
  13393. this._on(options.element, {
  13394. "remove": "_untrackClassesElement"
  13395. });
  13396. if (options.keys) {
  13397. processClassString(options.keys.match(/\S+/g) || [], true);
  13398. }
  13399. if (options.extra) {
  13400. processClassString(options.extra.match(/\S+/g) || []);
  13401. }
  13402. return full.join(" ");
  13403. },
  13404. _untrackClassesElement: function _untrackClassesElement(event) {
  13405. var that = this;
  13406. $.each(that.classesElementLookup, function (key, value) {
  13407. if ($.inArray(event.target, value) !== -1) {
  13408. that.classesElementLookup[key] = $(value.not(event.target).get());
  13409. }
  13410. });
  13411. },
  13412. _removeClass: function _removeClass(element, keys, extra) {
  13413. return this._toggleClass(element, keys, extra, false);
  13414. },
  13415. _addClass: function _addClass(element, keys, extra) {
  13416. return this._toggleClass(element, keys, extra, true);
  13417. },
  13418. _toggleClass: function _toggleClass(element, keys, extra, add) {
  13419. add = typeof add === "boolean" ? add : extra;
  13420. var shift = typeof element === "string" || element === null,
  13421. options = {
  13422. extra: shift ? keys : extra,
  13423. keys: shift ? element : keys,
  13424. element: shift ? this.element : element,
  13425. add: add
  13426. };
  13427. options.element.toggleClass(this._classes(options), add);
  13428. return this;
  13429. },
  13430. _on: function _on(suppressDisabledCheck, element, handlers) {
  13431. var delegateElement;
  13432. var instance = this;
  13433. // No suppressDisabledCheck flag, shuffle arguments
  13434. if (typeof suppressDisabledCheck !== "boolean") {
  13435. handlers = element;
  13436. element = suppressDisabledCheck;
  13437. suppressDisabledCheck = false;
  13438. }
  13439. // No element argument, shuffle and use this.element
  13440. if (!handlers) {
  13441. handlers = element;
  13442. element = this.element;
  13443. delegateElement = this.widget();
  13444. } else {
  13445. element = delegateElement = $(element);
  13446. this.bindings = this.bindings.add(element);
  13447. }
  13448. $.each(handlers, function (event, handler) {
  13449. function handlerProxy() {
  13450. // Allow widgets to customize the disabled handling
  13451. // - disabled as an array instead of boolean
  13452. // - disabled class as method for disabling individual parts
  13453. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  13454. return;
  13455. }
  13456. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13457. }
  13458. // Copy the guid so direct unbinding works
  13459. if (typeof handler !== "string") {
  13460. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  13461. }
  13462. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  13463. var eventName = match[1] + instance.eventNamespace;
  13464. var selector = match[2];
  13465. if (selector) {
  13466. delegateElement.on(eventName, selector, handlerProxy);
  13467. } else {
  13468. element.on(eventName, handlerProxy);
  13469. }
  13470. });
  13471. },
  13472. _off: function _off(element, eventName) {
  13473. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  13474. element.off(eventName).off(eventName);
  13475. // Clear the stack to avoid memory leaks (#10056)
  13476. this.bindings = $(this.bindings.not(element).get());
  13477. this.focusable = $(this.focusable.not(element).get());
  13478. this.hoverable = $(this.hoverable.not(element).get());
  13479. },
  13480. _delay: function _delay(handler, delay) {
  13481. function handlerProxy() {
  13482. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13483. }
  13484. var instance = this;
  13485. return setTimeout(handlerProxy, delay || 0);
  13486. },
  13487. _hoverable: function _hoverable(element) {
  13488. this.hoverable = this.hoverable.add(element);
  13489. this._on(element, {
  13490. mouseenter: function mouseenter(event) {
  13491. this._addClass($(event.currentTarget), null, "ui-state-hover");
  13492. },
  13493. mouseleave: function mouseleave(event) {
  13494. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  13495. }
  13496. });
  13497. },
  13498. _focusable: function _focusable(element) {
  13499. this.focusable = this.focusable.add(element);
  13500. this._on(element, {
  13501. focusin: function focusin(event) {
  13502. this._addClass($(event.currentTarget), null, "ui-state-focus");
  13503. },
  13504. focusout: function focusout(event) {
  13505. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  13506. }
  13507. });
  13508. },
  13509. _trigger: function _trigger(type, event, data) {
  13510. var prop, orig;
  13511. var callback = this.options[type];
  13512. data = data || {};
  13513. event = $.Event(event);
  13514. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  13515. // The original event may come from any element
  13516. // so we need to reset the target on the new event
  13517. event.target = this.element[0];
  13518. // Copy original event properties over to the new event
  13519. orig = event.originalEvent;
  13520. if (orig) {
  13521. for (prop in orig) {
  13522. if (!(prop in event)) {
  13523. event[prop] = orig[prop];
  13524. }
  13525. }
  13526. }
  13527. this.element.trigger(event, data);
  13528. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  13529. }
  13530. };
  13531. $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
  13532. $.Widget.prototype["_" + method] = function (element, options, callback) {
  13533. if (typeof options === "string") {
  13534. options = { effect: options };
  13535. }
  13536. var hasOptions;
  13537. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  13538. options = options || {};
  13539. if (typeof options === "number") {
  13540. options = { duration: options };
  13541. }
  13542. hasOptions = !$.isEmptyObject(options);
  13543. options.complete = callback;
  13544. if (options.delay) {
  13545. element.delay(options.delay);
  13546. }
  13547. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  13548. element[method](options);
  13549. } else if (effectName !== method && element[effectName]) {
  13550. element[effectName](options.duration, options.easing, callback);
  13551. } else {
  13552. element.queue(function (next) {
  13553. $(this)[method]();
  13554. if (callback) {
  13555. callback.call(element[0]);
  13556. }
  13557. next();
  13558. });
  13559. }
  13560. };
  13561. });
  13562. var widget = $.widget;
  13563. /*!
  13564. * jQuery UI Keycode 1.12.1
  13565. * http://jqueryui.com
  13566. *
  13567. * Copyright jQuery Foundation and other contributors
  13568. * Released under the MIT license.
  13569. * http://jquery.org/license
  13570. */
  13571. //>>label: Keycode
  13572. //>>group: Core
  13573. //>>description: Provide keycodes as keynames
  13574. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  13575. var keycode = $.ui.keyCode = {
  13576. BACKSPACE: 8,
  13577. COMMA: 188,
  13578. DELETE: 46,
  13579. DOWN: 40,
  13580. END: 35,
  13581. ENTER: 13,
  13582. ESCAPE: 27,
  13583. HOME: 36,
  13584. LEFT: 37,
  13585. PAGE_DOWN: 34,
  13586. PAGE_UP: 33,
  13587. PERIOD: 190,
  13588. RIGHT: 39,
  13589. SPACE: 32,
  13590. TAB: 9,
  13591. UP: 38
  13592. };
  13593. // This file is deprecated
  13594. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  13595. /*!
  13596. * jQuery UI Mouse 1.12.1
  13597. * http://jqueryui.com
  13598. *
  13599. * Copyright jQuery Foundation and other contributors
  13600. * Released under the MIT license.
  13601. * http://jquery.org/license
  13602. */
  13603. //>>label: Mouse
  13604. //>>group: Widgets
  13605. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  13606. //>>docs: http://api.jqueryui.com/mouse/
  13607. var mouseHandled = false;
  13608. $(document).on("mouseup", function () {
  13609. mouseHandled = false;
  13610. });
  13611. var widgetsMouse = $.widget("ui.mouse", {
  13612. version: "1.12.1",
  13613. options: {
  13614. cancel: "input, textarea, button, select, option",
  13615. distance: 1,
  13616. delay: 0
  13617. },
  13618. _mouseInit: function _mouseInit() {
  13619. var that = this;
  13620. this.element.on("mousedown." + this.widgetName, function (event) {
  13621. return that._mouseDown(event);
  13622. }).on("click." + this.widgetName, function (event) {
  13623. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  13624. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  13625. event.stopImmediatePropagation();
  13626. return false;
  13627. }
  13628. });
  13629. this.started = false;
  13630. },
  13631. // TODO: make sure destroying one instance of mouse doesn't mess with
  13632. // other instances of mouse
  13633. _mouseDestroy: function _mouseDestroy() {
  13634. this.element.off("." + this.widgetName);
  13635. if (this._mouseMoveDelegate) {
  13636. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13637. }
  13638. },
  13639. _mouseDown: function _mouseDown(event) {
  13640. // don't let more than one widget handle mouseStart
  13641. if (mouseHandled) {
  13642. return;
  13643. }
  13644. this._mouseMoved = false;
  13645. // We may have missed mouseup (out of window)
  13646. this._mouseStarted && this._mouseUp(event);
  13647. this._mouseDownEvent = event;
  13648. var that = this,
  13649. btnIsLeft = event.which === 1,
  13650. // event.target.nodeName works around a bug in IE 8 with
  13651. // disabled inputs (#7620)
  13652. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  13653. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  13654. return true;
  13655. }
  13656. this.mouseDelayMet = !this.options.delay;
  13657. if (!this.mouseDelayMet) {
  13658. this._mouseDelayTimer = setTimeout(function () {
  13659. that.mouseDelayMet = true;
  13660. }, this.options.delay);
  13661. }
  13662. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13663. this._mouseStarted = this._mouseStart(event) !== false;
  13664. if (!this._mouseStarted) {
  13665. event.preventDefault();
  13666. return true;
  13667. }
  13668. }
  13669. // Click event may never have fired (Gecko & Opera)
  13670. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  13671. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  13672. }
  13673. // These delegates are required to keep context
  13674. this._mouseMoveDelegate = function (event) {
  13675. return that._mouseMove(event);
  13676. };
  13677. this._mouseUpDelegate = function (event) {
  13678. return that._mouseUp(event);
  13679. };
  13680. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  13681. event.preventDefault();
  13682. mouseHandled = true;
  13683. return true;
  13684. },
  13685. _mouseMove: function _mouseMove(event) {
  13686. // Only check for mouseups outside the document if you've moved inside the document
  13687. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  13688. // fire a mousemove event if content is placed under the cursor. See #7778
  13689. // Support: IE <9
  13690. if (this._mouseMoved) {
  13691. // IE mouseup check - mouseup happened when mouse was out of window
  13692. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  13693. return this._mouseUp(event);
  13694. // Iframe mouseup check - mouseup occurred in another document
  13695. } else if (!event.which) {
  13696. // Support: Safari <=8 - 9
  13697. // Safari sets which to 0 if you press any of the following keys
  13698. // during a drag (#14461)
  13699. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  13700. this.ignoreMissingWhich = true;
  13701. } else if (!this.ignoreMissingWhich) {
  13702. return this._mouseUp(event);
  13703. }
  13704. }
  13705. }
  13706. if (event.which || event.button) {
  13707. this._mouseMoved = true;
  13708. }
  13709. if (this._mouseStarted) {
  13710. this._mouseDrag(event);
  13711. return event.preventDefault();
  13712. }
  13713. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13714. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  13715. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  13716. }
  13717. return !this._mouseStarted;
  13718. },
  13719. _mouseUp: function _mouseUp(event) {
  13720. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13721. if (this._mouseStarted) {
  13722. this._mouseStarted = false;
  13723. if (event.target === this._mouseDownEvent.target) {
  13724. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  13725. }
  13726. this._mouseStop(event);
  13727. }
  13728. if (this._mouseDelayTimer) {
  13729. clearTimeout(this._mouseDelayTimer);
  13730. delete this._mouseDelayTimer;
  13731. }
  13732. this.ignoreMissingWhich = false;
  13733. mouseHandled = false;
  13734. event.preventDefault();
  13735. },
  13736. _mouseDistanceMet: function _mouseDistanceMet(event) {
  13737. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  13738. },
  13739. _mouseDelayMet: function _mouseDelayMet() /* event */{
  13740. return this.mouseDelayMet;
  13741. },
  13742. // These are placeholder methods, to be overriden by extending plugin
  13743. _mouseStart: function _mouseStart() /* event */{},
  13744. _mouseDrag: function _mouseDrag() /* event */{},
  13745. _mouseStop: function _mouseStop() /* event */{},
  13746. _mouseCapture: function _mouseCapture() /* event */{
  13747. return true;
  13748. }
  13749. });
  13750. /*!
  13751. * jQuery UI Slider 1.12.1
  13752. * http://jqueryui.com
  13753. *
  13754. * Copyright jQuery Foundation and other contributors
  13755. * Released under the MIT license.
  13756. * http://jquery.org/license
  13757. */
  13758. //>>label: Slider
  13759. //>>group: Widgets
  13760. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  13761. //>>docs: http://api.jqueryui.com/slider/
  13762. //>>demos: http://jqueryui.com/slider/
  13763. //>>css.structure: ../../themes/base/core.css
  13764. //>>css.structure: ../../themes/base/slider.css
  13765. //>>css.theme: ../../themes/base/theme.css
  13766. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  13767. version: "1.12.1",
  13768. widgetEventPrefix: "slide",
  13769. options: {
  13770. animate: false,
  13771. classes: {
  13772. "ui-slider": "ui-corner-all",
  13773. "ui-slider-handle": "ui-corner-all",
  13774. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  13775. // element, but worked best visually with a variety of themes
  13776. "ui-slider-range": "ui-corner-all ui-widget-header"
  13777. },
  13778. distance: 0,
  13779. max: 100,
  13780. min: 0,
  13781. orientation: "horizontal",
  13782. range: false,
  13783. step: 1,
  13784. value: 0,
  13785. values: null,
  13786. // Callbacks
  13787. change: null,
  13788. slide: null,
  13789. start: null,
  13790. stop: null
  13791. },
  13792. // Number of pages in a slider
  13793. // (how many times can you page up/down to go through the whole range)
  13794. numPages: 5,
  13795. _create: function _create() {
  13796. this._keySliding = false;
  13797. this._mouseSliding = false;
  13798. this._animateOff = true;
  13799. this._handleIndex = null;
  13800. this._detectOrientation();
  13801. this._mouseInit();
  13802. this._calculateNewMax();
  13803. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  13804. this._refresh();
  13805. this._animateOff = false;
  13806. },
  13807. _refresh: function _refresh() {
  13808. this._createRange();
  13809. this._createHandles();
  13810. this._setupEvents();
  13811. this._refreshValue();
  13812. },
  13813. _createHandles: function _createHandles() {
  13814. var i,
  13815. handleCount,
  13816. options = this.options,
  13817. existingHandles = this.element.find(".ui-slider-handle"),
  13818. handle = "<span tabindex='0'></span>",
  13819. handles = [];
  13820. handleCount = options.values && options.values.length || 1;
  13821. if (existingHandles.length > handleCount) {
  13822. existingHandles.slice(handleCount).remove();
  13823. existingHandles = existingHandles.slice(0, handleCount);
  13824. }
  13825. for (i = existingHandles.length; i < handleCount; i++) {
  13826. handles.push(handle);
  13827. }
  13828. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  13829. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  13830. this.handle = this.handles.eq(0);
  13831. this.handles.each(function (i) {
  13832. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  13833. });
  13834. },
  13835. _createRange: function _createRange() {
  13836. var options = this.options;
  13837. if (options.range) {
  13838. if (options.range === true) {
  13839. if (!options.values) {
  13840. options.values = [this._valueMin(), this._valueMin()];
  13841. } else if (options.values.length && options.values.length !== 2) {
  13842. options.values = [options.values[0], options.values[0]];
  13843. } else if ($.isArray(options.values)) {
  13844. options.values = options.values.slice(0);
  13845. }
  13846. }
  13847. if (!this.range || !this.range.length) {
  13848. this.range = $("<div>").appendTo(this.element);
  13849. this._addClass(this.range, "ui-slider-range");
  13850. } else {
  13851. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  13852. // Handle range switching from true to min/max
  13853. this.range.css({
  13854. "left": "",
  13855. "bottom": ""
  13856. });
  13857. }
  13858. if (options.range === "min" || options.range === "max") {
  13859. this._addClass(this.range, "ui-slider-range-" + options.range);
  13860. }
  13861. } else {
  13862. if (this.range) {
  13863. this.range.remove();
  13864. }
  13865. this.range = null;
  13866. }
  13867. },
  13868. _setupEvents: function _setupEvents() {
  13869. this._off(this.handles);
  13870. this._on(this.handles, this._handleEvents);
  13871. this._hoverable(this.handles);
  13872. this._focusable(this.handles);
  13873. },
  13874. _destroy: function _destroy() {
  13875. this.handles.remove();
  13876. if (this.range) {
  13877. this.range.remove();
  13878. }
  13879. this._mouseDestroy();
  13880. },
  13881. _mouseCapture: function _mouseCapture(event) {
  13882. var position,
  13883. normValue,
  13884. distance,
  13885. closestHandle,
  13886. index,
  13887. allowed,
  13888. offset,
  13889. mouseOverHandle,
  13890. that = this,
  13891. o = this.options;
  13892. if (o.disabled) {
  13893. return false;
  13894. }
  13895. this.elementSize = {
  13896. width: this.element.outerWidth(),
  13897. height: this.element.outerHeight()
  13898. };
  13899. this.elementOffset = this.element.offset();
  13900. position = { x: event.pageX, y: event.pageY };
  13901. normValue = this._normValueFromMouse(position);
  13902. distance = this._valueMax() - this._valueMin() + 1;
  13903. this.handles.each(function (i) {
  13904. var thisDistance = Math.abs(normValue - that.values(i));
  13905. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  13906. distance = thisDistance;
  13907. closestHandle = $(this);
  13908. index = i;
  13909. }
  13910. });
  13911. allowed = this._start(event, index);
  13912. if (allowed === false) {
  13913. return false;
  13914. }
  13915. this._mouseSliding = true;
  13916. this._handleIndex = index;
  13917. this._addClass(closestHandle, null, "ui-state-active");
  13918. closestHandle.trigger("focus");
  13919. offset = closestHandle.offset();
  13920. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  13921. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  13922. left: event.pageX - offset.left - closestHandle.width() / 2,
  13923. 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)
  13924. };
  13925. if (!this.handles.hasClass("ui-state-hover")) {
  13926. this._slide(event, index, normValue);
  13927. }
  13928. this._animateOff = true;
  13929. return true;
  13930. },
  13931. _mouseStart: function _mouseStart() {
  13932. return true;
  13933. },
  13934. _mouseDrag: function _mouseDrag(event) {
  13935. var position = { x: event.pageX, y: event.pageY },
  13936. normValue = this._normValueFromMouse(position);
  13937. this._slide(event, this._handleIndex, normValue);
  13938. return false;
  13939. },
  13940. _mouseStop: function _mouseStop(event) {
  13941. this._removeClass(this.handles, null, "ui-state-active");
  13942. this._mouseSliding = false;
  13943. this._stop(event, this._handleIndex);
  13944. this._change(event, this._handleIndex);
  13945. this._handleIndex = null;
  13946. this._clickOffset = null;
  13947. this._animateOff = false;
  13948. return false;
  13949. },
  13950. _detectOrientation: function _detectOrientation() {
  13951. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  13952. },
  13953. _normValueFromMouse: function _normValueFromMouse(position) {
  13954. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  13955. if (this.orientation === "horizontal") {
  13956. pixelTotal = this.elementSize.width;
  13957. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  13958. } else {
  13959. pixelTotal = this.elementSize.height;
  13960. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  13961. }
  13962. percentMouse = pixelMouse / pixelTotal;
  13963. if (percentMouse > 1) {
  13964. percentMouse = 1;
  13965. }
  13966. if (percentMouse < 0) {
  13967. percentMouse = 0;
  13968. }
  13969. if (this.orientation === "vertical") {
  13970. percentMouse = 1 - percentMouse;
  13971. }
  13972. valueTotal = this._valueMax() - this._valueMin();
  13973. valueMouse = this._valueMin() + percentMouse * valueTotal;
  13974. return this._trimAlignValue(valueMouse);
  13975. },
  13976. _uiHash: function _uiHash(index, value, values) {
  13977. var uiHash = {
  13978. handle: this.handles[index],
  13979. handleIndex: index,
  13980. value: value !== undefined ? value : this.value()
  13981. };
  13982. if (this._hasMultipleValues()) {
  13983. uiHash.value = value !== undefined ? value : this.values(index);
  13984. uiHash.values = values || this.values();
  13985. }
  13986. return uiHash;
  13987. },
  13988. _hasMultipleValues: function _hasMultipleValues() {
  13989. return this.options.values && this.options.values.length;
  13990. },
  13991. _start: function _start(event, index) {
  13992. return this._trigger("start", event, this._uiHash(index));
  13993. },
  13994. _slide: function _slide(event, index, newVal) {
  13995. var allowed,
  13996. otherVal,
  13997. currentValue = this.value(),
  13998. newValues = this.values();
  13999. if (this._hasMultipleValues()) {
  14000. otherVal = this.values(index ? 0 : 1);
  14001. currentValue = this.values(index);
  14002. if (this.options.values.length === 2 && this.options.range === true) {
  14003. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  14004. }
  14005. newValues[index] = newVal;
  14006. }
  14007. if (newVal === currentValue) {
  14008. return;
  14009. }
  14010. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  14011. // A slide can be canceled by returning false from the slide callback
  14012. if (allowed === false) {
  14013. return;
  14014. }
  14015. if (this._hasMultipleValues()) {
  14016. this.values(index, newVal);
  14017. } else {
  14018. this.value(newVal);
  14019. }
  14020. },
  14021. _stop: function _stop(event, index) {
  14022. this._trigger("stop", event, this._uiHash(index));
  14023. },
  14024. _change: function _change(event, index) {
  14025. if (!this._keySliding && !this._mouseSliding) {
  14026. //store the last changed value index for reference when handles overlap
  14027. this._lastChangedValue = index;
  14028. this._trigger("change", event, this._uiHash(index));
  14029. }
  14030. },
  14031. value: function value(newValue) {
  14032. if (arguments.length) {
  14033. this.options.value = this._trimAlignValue(newValue);
  14034. this._refreshValue();
  14035. this._change(null, 0);
  14036. return;
  14037. }
  14038. return this._value();
  14039. },
  14040. values: function values(index, newValue) {
  14041. var vals, newValues, i;
  14042. if (arguments.length > 1) {
  14043. this.options.values[index] = this._trimAlignValue(newValue);
  14044. this._refreshValue();
  14045. this._change(null, index);
  14046. return;
  14047. }
  14048. if (arguments.length) {
  14049. if ($.isArray(arguments[0])) {
  14050. vals = this.options.values;
  14051. newValues = arguments[0];
  14052. for (i = 0; i < vals.length; i += 1) {
  14053. vals[i] = this._trimAlignValue(newValues[i]);
  14054. this._change(null, i);
  14055. }
  14056. this._refreshValue();
  14057. } else {
  14058. if (this._hasMultipleValues()) {
  14059. return this._values(index);
  14060. } else {
  14061. return this.value();
  14062. }
  14063. }
  14064. } else {
  14065. return this._values();
  14066. }
  14067. },
  14068. _setOption: function _setOption(key, value) {
  14069. var i,
  14070. valsLength = 0;
  14071. if (key === "range" && this.options.range === true) {
  14072. if (value === "min") {
  14073. this.options.value = this._values(0);
  14074. this.options.values = null;
  14075. } else if (value === "max") {
  14076. this.options.value = this._values(this.options.values.length - 1);
  14077. this.options.values = null;
  14078. }
  14079. }
  14080. if ($.isArray(this.options.values)) {
  14081. valsLength = this.options.values.length;
  14082. }
  14083. this._super(key, value);
  14084. switch (key) {
  14085. case "orientation":
  14086. this._detectOrientation();
  14087. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  14088. this._refreshValue();
  14089. if (this.options.range) {
  14090. this._refreshRange(value);
  14091. }
  14092. // Reset positioning from previous orientation
  14093. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  14094. break;
  14095. case "value":
  14096. this._animateOff = true;
  14097. this._refreshValue();
  14098. this._change(null, 0);
  14099. this._animateOff = false;
  14100. break;
  14101. case "values":
  14102. this._animateOff = true;
  14103. this._refreshValue();
  14104. // Start from the last handle to prevent unreachable handles (#9046)
  14105. for (i = valsLength - 1; i >= 0; i--) {
  14106. this._change(null, i);
  14107. }
  14108. this._animateOff = false;
  14109. break;
  14110. case "step":
  14111. case "min":
  14112. case "max":
  14113. this._animateOff = true;
  14114. this._calculateNewMax();
  14115. this._refreshValue();
  14116. this._animateOff = false;
  14117. break;
  14118. case "range":
  14119. this._animateOff = true;
  14120. this._refresh();
  14121. this._animateOff = false;
  14122. break;
  14123. }
  14124. },
  14125. _setOptionDisabled: function _setOptionDisabled(value) {
  14126. this._super(value);
  14127. this._toggleClass(null, "ui-state-disabled", !!value);
  14128. },
  14129. //internal value getter
  14130. // _value() returns value trimmed by min and max, aligned by step
  14131. _value: function _value() {
  14132. var val = this.options.value;
  14133. val = this._trimAlignValue(val);
  14134. return val;
  14135. },
  14136. //internal values getter
  14137. // _values() returns array of values trimmed by min and max, aligned by step
  14138. // _values( index ) returns single value trimmed by min and max, aligned by step
  14139. _values: function _values(index) {
  14140. var val, vals, i;
  14141. if (arguments.length) {
  14142. val = this.options.values[index];
  14143. val = this._trimAlignValue(val);
  14144. return val;
  14145. } else if (this._hasMultipleValues()) {
  14146. // .slice() creates a copy of the array
  14147. // this copy gets trimmed by min and max and then returned
  14148. vals = this.options.values.slice();
  14149. for (i = 0; i < vals.length; i += 1) {
  14150. vals[i] = this._trimAlignValue(vals[i]);
  14151. }
  14152. return vals;
  14153. } else {
  14154. return [];
  14155. }
  14156. },
  14157. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  14158. _trimAlignValue: function _trimAlignValue(val) {
  14159. if (val <= this._valueMin()) {
  14160. return this._valueMin();
  14161. }
  14162. if (val >= this._valueMax()) {
  14163. return this._valueMax();
  14164. }
  14165. var step = this.options.step > 0 ? this.options.step : 1,
  14166. valModStep = (val - this._valueMin()) % step,
  14167. alignValue = val - valModStep;
  14168. if (Math.abs(valModStep) * 2 >= step) {
  14169. alignValue += valModStep > 0 ? step : -step;
  14170. }
  14171. // Since JavaScript has problems with large floats, round
  14172. // the final value to 5 digits after the decimal point (see #4124)
  14173. return parseFloat(alignValue.toFixed(5));
  14174. },
  14175. _calculateNewMax: function _calculateNewMax() {
  14176. var max = this.options.max,
  14177. min = this._valueMin(),
  14178. step = this.options.step,
  14179. aboveMin = Math.round((max - min) / step) * step;
  14180. max = aboveMin + min;
  14181. if (max > this.options.max) {
  14182. //If max is not divisible by step, rounding off may increase its value
  14183. max -= step;
  14184. }
  14185. this.max = parseFloat(max.toFixed(this._precision()));
  14186. },
  14187. _precision: function _precision() {
  14188. var precision = this._precisionOf(this.options.step);
  14189. if (this.options.min !== null) {
  14190. precision = Math.max(precision, this._precisionOf(this.options.min));
  14191. }
  14192. return precision;
  14193. },
  14194. _precisionOf: function _precisionOf(num) {
  14195. var str = num.toString(),
  14196. decimal = str.indexOf(".");
  14197. return decimal === -1 ? 0 : str.length - decimal - 1;
  14198. },
  14199. _valueMin: function _valueMin() {
  14200. return this.options.min;
  14201. },
  14202. _valueMax: function _valueMax() {
  14203. return this.max;
  14204. },
  14205. _refreshRange: function _refreshRange(orientation) {
  14206. if (orientation === "vertical") {
  14207. this.range.css({ "width": "", "left": "" });
  14208. }
  14209. if (orientation === "horizontal") {
  14210. this.range.css({ "height": "", "bottom": "" });
  14211. }
  14212. },
  14213. _refreshValue: function _refreshValue() {
  14214. var lastValPercent,
  14215. valPercent,
  14216. value,
  14217. valueMin,
  14218. valueMax,
  14219. oRange = this.options.range,
  14220. o = this.options,
  14221. that = this,
  14222. animate = !this._animateOff ? o.animate : false,
  14223. _set = {};
  14224. if (this._hasMultipleValues()) {
  14225. this.handles.each(function (i) {
  14226. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  14227. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14228. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14229. if (that.options.range === true) {
  14230. if (that.orientation === "horizontal") {
  14231. if (i === 0) {
  14232. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14233. left: valPercent + "%"
  14234. }, o.animate);
  14235. }
  14236. if (i === 1) {
  14237. that.range[animate ? "animate" : "css"]({
  14238. width: valPercent - lastValPercent + "%"
  14239. }, {
  14240. queue: false,
  14241. duration: o.animate
  14242. });
  14243. }
  14244. } else {
  14245. if (i === 0) {
  14246. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14247. bottom: valPercent + "%"
  14248. }, o.animate);
  14249. }
  14250. if (i === 1) {
  14251. that.range[animate ? "animate" : "css"]({
  14252. height: valPercent - lastValPercent + "%"
  14253. }, {
  14254. queue: false,
  14255. duration: o.animate
  14256. });
  14257. }
  14258. }
  14259. }
  14260. lastValPercent = valPercent;
  14261. });
  14262. } else {
  14263. value = this.value();
  14264. valueMin = this._valueMin();
  14265. valueMax = this._valueMax();
  14266. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  14267. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14268. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14269. if (oRange === "min" && this.orientation === "horizontal") {
  14270. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14271. width: valPercent + "%"
  14272. }, o.animate);
  14273. }
  14274. if (oRange === "max" && this.orientation === "horizontal") {
  14275. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14276. width: 100 - valPercent + "%"
  14277. }, o.animate);
  14278. }
  14279. if (oRange === "min" && this.orientation === "vertical") {
  14280. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14281. height: valPercent + "%"
  14282. }, o.animate);
  14283. }
  14284. if (oRange === "max" && this.orientation === "vertical") {
  14285. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14286. height: 100 - valPercent + "%"
  14287. }, o.animate);
  14288. }
  14289. }
  14290. },
  14291. _handleEvents: {
  14292. keydown: function keydown(event) {
  14293. var allowed,
  14294. curVal,
  14295. newVal,
  14296. step,
  14297. index = $(event.target).data("ui-slider-handle-index");
  14298. switch (event.keyCode) {
  14299. case $.ui.keyCode.HOME:
  14300. case $.ui.keyCode.END:
  14301. case $.ui.keyCode.PAGE_UP:
  14302. case $.ui.keyCode.PAGE_DOWN:
  14303. case $.ui.keyCode.UP:
  14304. case $.ui.keyCode.RIGHT:
  14305. case $.ui.keyCode.DOWN:
  14306. case $.ui.keyCode.LEFT:
  14307. event.preventDefault();
  14308. if (!this._keySliding) {
  14309. this._keySliding = true;
  14310. this._addClass($(event.target), null, "ui-state-active");
  14311. allowed = this._start(event, index);
  14312. if (allowed === false) {
  14313. return;
  14314. }
  14315. }
  14316. break;
  14317. }
  14318. step = this.options.step;
  14319. if (this._hasMultipleValues()) {
  14320. curVal = newVal = this.values(index);
  14321. } else {
  14322. curVal = newVal = this.value();
  14323. }
  14324. switch (event.keyCode) {
  14325. case $.ui.keyCode.HOME:
  14326. newVal = this._valueMin();
  14327. break;
  14328. case $.ui.keyCode.END:
  14329. newVal = this._valueMax();
  14330. break;
  14331. case $.ui.keyCode.PAGE_UP:
  14332. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  14333. break;
  14334. case $.ui.keyCode.PAGE_DOWN:
  14335. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  14336. break;
  14337. case $.ui.keyCode.UP:
  14338. case $.ui.keyCode.RIGHT:
  14339. if (curVal === this._valueMax()) {
  14340. return;
  14341. }
  14342. newVal = this._trimAlignValue(curVal + step);
  14343. break;
  14344. case $.ui.keyCode.DOWN:
  14345. case $.ui.keyCode.LEFT:
  14346. if (curVal === this._valueMin()) {
  14347. return;
  14348. }
  14349. newVal = this._trimAlignValue(curVal - step);
  14350. break;
  14351. }
  14352. this._slide(event, index, newVal);
  14353. },
  14354. keyup: function keyup(event) {
  14355. var index = $(event.target).data("ui-slider-handle-index");
  14356. if (this._keySliding) {
  14357. this._keySliding = false;
  14358. this._stop(event, index);
  14359. this._change(event, index);
  14360. this._removeClass($(event.target), null, "ui-state-active");
  14361. }
  14362. }
  14363. }
  14364. });
  14365. });
  14366. /***/ }),
  14367. /* 33 */
  14368. /***/ (function(module, exports, __webpack_require__) {
  14369. "use strict";
  14370. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14371. 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; };
  14372. (function (global, factory) {
  14373. ( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14374. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14375. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14376. __WEBPACK_AMD_DEFINE_FACTORY__),
  14377. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  14378. })(undefined, function () {
  14379. 'use strict';
  14380. var _createClass = function () {
  14381. function defineProperties(target, props) {
  14382. for (var i = 0; i < props.length; i++) {
  14383. 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);
  14384. }
  14385. }return function (Constructor, protoProps, staticProps) {
  14386. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14387. };
  14388. }();
  14389. function _classCallCheck(instance, Constructor) {
  14390. if (!(instance instanceof Constructor)) {
  14391. throw new TypeError("Cannot call a class as a function");
  14392. }
  14393. }
  14394. /**
  14395. * Sticky Sidebar JavaScript Plugin.
  14396. * @version 3.2.0
  14397. * @author Ahmed Bouhuolia <a.bouhuolia@gmail.com>
  14398. * @license The MIT License (MIT)
  14399. */
  14400. var StickySidebar = function () {
  14401. // ---------------------------------
  14402. // # Define Constants
  14403. // ---------------------------------
  14404. //
  14405. var EVENT_KEY = '.stickySidebar';
  14406. var DEFAULTS = {
  14407. /**
  14408. * Additional top spacing of the element when it becomes sticky.
  14409. * @type {Numeric|Function}
  14410. */
  14411. topSpacing: 0,
  14412. /**
  14413. * Additional bottom spacing of the element when it becomes sticky.
  14414. * @type {Numeric|Function}
  14415. */
  14416. bottomSpacing: 0,
  14417. /**
  14418. * Container sidebar selector to know what the beginning and end of sticky element.
  14419. * @type {String|False}
  14420. */
  14421. containerSelector: false,
  14422. /**
  14423. * Inner wrapper selector.
  14424. * @type {String}
  14425. */
  14426. innerWrapperSelector: '.inner-wrapper-sticky',
  14427. /**
  14428. * The name of CSS class to apply to elements when they have become stuck.
  14429. * @type {String|False}
  14430. */
  14431. stickyClass: 'is-affixed',
  14432. /**
  14433. * Detect when sidebar and its container change height so re-calculate their dimensions.
  14434. * @type {Boolean}
  14435. */
  14436. resizeSensor: true,
  14437. /**
  14438. * The sidebar returns to its normal position if its width below this value.
  14439. * @type {Numeric}
  14440. */
  14441. minWidth: false
  14442. };
  14443. // ---------------------------------
  14444. // # Class Definition
  14445. // ---------------------------------
  14446. //
  14447. /**
  14448. * Sticky Sidebar Class.
  14449. * @public
  14450. */
  14451. var StickySidebar = function () {
  14452. /**
  14453. * Sticky Sidebar Constructor.
  14454. * @constructor
  14455. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  14456. * @param {Object} options - The options of sticky sidebar.
  14457. */
  14458. function StickySidebar(sidebar) {
  14459. var _this = this;
  14460. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  14461. _classCallCheck(this, StickySidebar);
  14462. this.options = StickySidebar.extend(DEFAULTS, options);
  14463. // Sidebar element query if there's no one, throw error.
  14464. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  14465. if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
  14466. this.sidebarInner = false;
  14467. this.container = this.sidebar.parentElement;
  14468. // Current Affix Type of sidebar element.
  14469. this.affixedType = 'STATIC';
  14470. this.direction = 'down';
  14471. this.support = {
  14472. transform: false,
  14473. transform3d: false
  14474. };
  14475. this._initialized = false;
  14476. this._breakpoint = false;
  14477. this._resizeListeners = [];
  14478. // Dimenstions of sidebar, container and screen viewport.
  14479. this.dimensions = {
  14480. translateY: 0,
  14481. topSpacing: 0,
  14482. bottomSpacing: 0,
  14483. sidebarHeight: 0,
  14484. sidebarWidth: 0,
  14485. containerTop: 0,
  14486. containerHeight: 0,
  14487. viewportHeight: 0,
  14488. viewportTop: 0,
  14489. lastViewportTop: 0
  14490. };
  14491. // Bind event handlers for referencability.
  14492. ['handleEvent'].forEach(function (method) {
  14493. _this[method] = _this[method].bind(_this);
  14494. });
  14495. // Initialize sticky sidebar for first time.
  14496. this.initialize();
  14497. }
  14498. /**
  14499. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  14500. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  14501. * @private
  14502. */
  14503. _createClass(StickySidebar, [{
  14504. key: 'initialize',
  14505. value: function initialize() {
  14506. var _this2 = this;
  14507. this._setSupportFeatures();
  14508. // Get sticky sidebar inner wrapper, if not found, will create one.
  14509. if (this.options.innerWrapperSelector) {
  14510. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  14511. if (null === this.sidebarInner) this.sidebarInner = false;
  14512. }
  14513. if (!this.sidebarInner) {
  14514. var wrapper = document.createElement('div');
  14515. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  14516. this.sidebar.appendChild(wrapper);
  14517. while (this.sidebar.firstChild != wrapper) {
  14518. wrapper.appendChild(this.sidebar.firstChild);
  14519. }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  14520. }
  14521. // Container wrapper of the sidebar.
  14522. if (this.options.containerSelector) {
  14523. var containers = document.querySelectorAll(this.options.containerSelector);
  14524. containers = Array.prototype.slice.call(containers);
  14525. containers.forEach(function (container, item) {
  14526. if (!container.contains(_this2.sidebar)) return;
  14527. _this2.container = container;
  14528. });
  14529. if (!containers.length) throw new Error("The container does not contains on the sidebar.");
  14530. }
  14531. // If top/bottom spacing is not function parse value to integer.
  14532. if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  14533. if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  14534. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  14535. this._widthBreakpoint();
  14536. // Calculate dimensions of sidebar, container and viewport.
  14537. this.calcDimensions();
  14538. // Affix sidebar in proper position.
  14539. this.stickyPosition();
  14540. // Bind all events.
  14541. this.bindEvents();
  14542. // Inform other properties the sticky sidebar is initialized.
  14543. this._initialized = true;
  14544. }
  14545. /**
  14546. * Bind all events of sticky sidebar plugin.
  14547. * @protected
  14548. */
  14549. }, {
  14550. key: 'bindEvents',
  14551. value: function bindEvents() {
  14552. window.addEventListener('resize', this, { passive: true });
  14553. window.addEventListener('scroll', this, { passive: true });
  14554. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  14555. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14556. new ResizeSensor(this.sidebarInner, this.handleEvent);
  14557. new ResizeSensor(this.container, this.handleEvent);
  14558. }
  14559. }
  14560. /**
  14561. * Handles all events of the plugin.
  14562. * @param {Object} event - Event object passed from listener.
  14563. */
  14564. }, {
  14565. key: 'handleEvent',
  14566. value: function handleEvent(event) {
  14567. this.updateSticky(event);
  14568. }
  14569. /**
  14570. * Calculates dimesntions of sidebar, container and screen viewpoint
  14571. * @public
  14572. */
  14573. }, {
  14574. key: 'calcDimensions',
  14575. value: function calcDimensions() {
  14576. if (this._breakpoint) return;
  14577. var dims = this.dimensions;
  14578. // Container of sticky sidebar dimensions.
  14579. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  14580. dims.containerHeight = this.container.clientHeight;
  14581. dims.containerBottom = dims.containerTop + dims.containerHeight;
  14582. // Sidebar dimensions.
  14583. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  14584. dims.sidebarWidth = this.sidebar.offsetWidth;
  14585. // Screen viewport dimensions.
  14586. dims.viewportHeight = window.innerHeight;
  14587. this._calcDimensionsWithScroll();
  14588. }
  14589. /**
  14590. * Some dimensions values need to be up-to-date when scrolling the page.
  14591. * @private
  14592. */
  14593. }, {
  14594. key: '_calcDimensionsWithScroll',
  14595. value: function _calcDimensionsWithScroll() {
  14596. var dims = this.dimensions;
  14597. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  14598. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  14599. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  14600. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  14601. dims.topSpacing = this.options.topSpacing;
  14602. dims.bottomSpacing = this.options.bottomSpacing;
  14603. if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  14604. if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  14605. }
  14606. /**
  14607. * Detarmine wheather the sidebar is bigger than viewport.
  14608. * @public
  14609. * @return {Boolean}
  14610. */
  14611. }, {
  14612. key: 'isSidebarFitsViewport',
  14613. value: function isSidebarFitsViewport() {
  14614. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  14615. }
  14616. /**
  14617. * Observe browser scrolling direction top and down.
  14618. */
  14619. }, {
  14620. key: 'observeScrollDir',
  14621. value: function observeScrollDir() {
  14622. var dims = this.dimensions;
  14623. if (dims.lastViewportTop === dims.viewportTop) return;
  14624. var furthest = 'down' === this.direction ? Math.min : Math.max;
  14625. // If the browser is scrolling not in the same direction.
  14626. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
  14627. }
  14628. /**
  14629. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  14630. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  14631. * is bigger than viewport and vice versa.
  14632. * @public
  14633. * @return {String|False} - Proper affix type.
  14634. */
  14635. }, {
  14636. key: 'getAffixType',
  14637. value: function getAffixType() {
  14638. var dims = this.dimensions,
  14639. affixType = false;
  14640. this._calcDimensionsWithScroll();
  14641. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  14642. var colliderTop = dims.viewportTop + dims.topSpacing;
  14643. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  14644. // When browser is scrolling top.
  14645. if ('up' === this.direction) {
  14646. if (colliderTop <= dims.containerTop) {
  14647. dims.translateY = 0;
  14648. affixType = 'STATIC';
  14649. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  14650. dims.translateY = colliderTop - dims.containerTop;
  14651. affixType = 'VIEWPORT-TOP';
  14652. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  14653. affixType = 'VIEWPORT-UNBOTTOM';
  14654. }
  14655. // When browser is scrolling up.
  14656. } else {
  14657. // When sidebar element is not bigger than screen viewport.
  14658. if (this.isSidebarFitsViewport()) {
  14659. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  14660. dims.translateY = dims.containerBottom - sidebarBottom;
  14661. affixType = 'CONTAINER-BOTTOM';
  14662. } else if (colliderTop >= dims.containerTop) {
  14663. dims.translateY = colliderTop - dims.containerTop;
  14664. affixType = 'VIEWPORT-TOP';
  14665. }
  14666. // When sidebar element is bigger than screen viewport.
  14667. } else {
  14668. if (dims.containerBottom <= colliderBottom) {
  14669. dims.translateY = dims.containerBottom - sidebarBottom;
  14670. affixType = 'CONTAINER-BOTTOM';
  14671. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  14672. dims.translateY = colliderBottom - sidebarBottom;
  14673. affixType = 'VIEWPORT-BOTTOM';
  14674. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  14675. affixType = 'VIEWPORT-UNBOTTOM';
  14676. }
  14677. }
  14678. }
  14679. // Make sure the translate Y is not bigger than container height.
  14680. dims.translateY = Math.max(0, dims.translateY);
  14681. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  14682. dims.lastViewportTop = dims.viewportTop;
  14683. return affixType;
  14684. }
  14685. /**
  14686. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  14687. * to its affix type.
  14688. * @private
  14689. * @param {String} affixType - Affix type of sticky sidebar.
  14690. * @return {Object}
  14691. */
  14692. }, {
  14693. key: '_getStyle',
  14694. value: function _getStyle(affixType) {
  14695. if ('undefined' === typeof affixType) return;
  14696. var style = { inner: {}, outer: {} };
  14697. var dims = this.dimensions;
  14698. switch (affixType) {
  14699. case 'VIEWPORT-TOP':
  14700. style.inner = { position: 'fixed', top: this.options.topSpacing,
  14701. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
  14702. break;
  14703. case 'VIEWPORT-BOTTOM':
  14704. style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  14705. bottom: this.options.bottomSpacing, width: dims.sidebarWidth };
  14706. break;
  14707. case 'CONTAINER-BOTTOM':
  14708. case 'VIEWPORT-UNBOTTOM':
  14709. var translate = this._getTranslate(0, dims.translateY + 'px');
  14710. if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
  14711. break;
  14712. }
  14713. switch (affixType) {
  14714. case 'VIEWPORT-TOP':
  14715. case 'VIEWPORT-BOTTOM':
  14716. case 'VIEWPORT-UNBOTTOM':
  14717. case 'CONTAINER-BOTTOM':
  14718. style.outer = { height: dims.sidebarHeight, position: 'relative' };
  14719. break;
  14720. }
  14721. style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
  14722. style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
  14723. bottom: '', width: '', transform: this._getTranslate() }, style.inner);
  14724. return style;
  14725. }
  14726. /**
  14727. * Cause the sidebar to be sticky according to affix type by adding inline
  14728. * style, adding helper class and trigger events.
  14729. * @function
  14730. * @protected
  14731. * @param {string} force - Update sticky sidebar position by force.
  14732. */
  14733. }, {
  14734. key: 'stickyPosition',
  14735. value: function stickyPosition(force) {
  14736. if (this._breakpoint) return;
  14737. force = force || false;
  14738. var affixType = this.getAffixType();
  14739. var style = this._getStyle(affixType);
  14740. if ((this.affixedType != affixType || force) && affixType) {
  14741. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  14742. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  14743. if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  14744. for (var key in style.outer) {
  14745. this.sidebar.style[key] = style.outer[key];
  14746. }
  14747. for (var _key in style.inner) {
  14748. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  14749. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  14750. }
  14751. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  14752. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  14753. } else {
  14754. if (this._initialized) this.sidebarInner.style.left = style.inner.left;
  14755. }
  14756. this.affixedType = affixType;
  14757. }
  14758. /**
  14759. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  14760. * @protected
  14761. */
  14762. }, {
  14763. key: '_widthBreakpoint',
  14764. value: function _widthBreakpoint() {
  14765. if (window.innerWidth <= this.options.minWidth) {
  14766. this._breakpoint = true;
  14767. this.affixedType = 'STATIC';
  14768. this.sidebar.removeAttribute('style');
  14769. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  14770. this.sidebarInner.removeAttribute('style');
  14771. } else {
  14772. this._breakpoint = false;
  14773. }
  14774. }
  14775. /**
  14776. * Switchs between functions stack for each event type, if there's no
  14777. * event, it will re-initialize sticky sidebar.
  14778. * @public
  14779. */
  14780. }, {
  14781. key: 'updateSticky',
  14782. value: function updateSticky() {
  14783. var _this3 = this;
  14784. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14785. if (this._running) return;
  14786. this._running = true;
  14787. (function (eventType) {
  14788. requestAnimationFrame(function () {
  14789. switch (eventType) {
  14790. // When browser is scrolling and re-calculate just dimensions
  14791. // within scroll.
  14792. case 'scroll':
  14793. _this3._calcDimensionsWithScroll();
  14794. _this3.observeScrollDir();
  14795. _this3.stickyPosition();
  14796. break;
  14797. // When browser is resizing or there's no event, observe width
  14798. // breakpoint and re-calculate dimensions.
  14799. case 'resize':
  14800. default:
  14801. _this3._widthBreakpoint();
  14802. _this3.calcDimensions();
  14803. _this3.stickyPosition(true);
  14804. break;
  14805. }
  14806. _this3._running = false;
  14807. });
  14808. })(event.type);
  14809. }
  14810. /**
  14811. * Set browser support features to the public property.
  14812. * @private
  14813. */
  14814. }, {
  14815. key: '_setSupportFeatures',
  14816. value: function _setSupportFeatures() {
  14817. var support = this.support;
  14818. support.transform = StickySidebar.supportTransform();
  14819. support.transform3d = StickySidebar.supportTransform(true);
  14820. }
  14821. /**
  14822. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  14823. * and the same with translate. if browser doesn't support both return false.
  14824. * @param {Number} y - Value of Y-axis.
  14825. * @param {Number} x - Value of X-axis.
  14826. * @param {Number} z - Value of Z-axis.
  14827. * @return {String|False}
  14828. */
  14829. }, {
  14830. key: '_getTranslate',
  14831. value: function _getTranslate() {
  14832. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  14833. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  14834. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  14835. if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
  14836. }
  14837. /**
  14838. * Destroy sticky sidebar plugin.
  14839. * @public
  14840. */
  14841. }, {
  14842. key: 'destroy',
  14843. value: function destroy() {
  14844. window.removeEventListener('resize', this);
  14845. window.removeEventListener('scroll', this);
  14846. this.sidebar.classList.remove(this.options.stickyClass);
  14847. this.sidebar.style.minHeight = '';
  14848. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  14849. var styleReset = { inner: {}, outer: {} };
  14850. styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
  14851. styleReset.outer = { height: '', position: '' };
  14852. for (var key in styleReset.outer) {
  14853. this.sidebar.style[key] = styleReset.outer[key];
  14854. }for (var _key2 in styleReset.inner) {
  14855. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  14856. }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14857. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  14858. ResizeSensor.detach(this.container, this.handleEvent);
  14859. }
  14860. }
  14861. /**
  14862. * Detarmine if the browser supports CSS transfrom feature.
  14863. * @function
  14864. * @static
  14865. * @param {Boolean} transform3d - Detect transform with translate3d.
  14866. * @return {String}
  14867. */
  14868. }], [{
  14869. key: 'supportTransform',
  14870. value: function supportTransform(transform3d) {
  14871. var result = false,
  14872. property = transform3d ? 'perspective' : 'transform',
  14873. upper = property.charAt(0).toUpperCase() + property.slice(1),
  14874. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  14875. support = document.createElement('support'),
  14876. style = support.style;
  14877. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  14878. if (style[property] !== undefined) {
  14879. result = property;
  14880. return false;
  14881. }
  14882. });
  14883. return result;
  14884. }
  14885. /**
  14886. * Trigger custom event.
  14887. * @static
  14888. * @param {DOMObject} element - Target element on the DOM.
  14889. * @param {String} eventName - Event name.
  14890. * @param {Object} data -
  14891. */
  14892. }, {
  14893. key: 'eventTrigger',
  14894. value: function eventTrigger(element, eventName, data) {
  14895. try {
  14896. var event = new CustomEvent(eventName, { detail: data });
  14897. } catch (e) {
  14898. var event = document.createEvent('CustomEvent');
  14899. event.initCustomEvent(eventName, true, true, data);
  14900. }
  14901. element.dispatchEvent(event);
  14902. }
  14903. /**
  14904. * Extend options object with defaults.
  14905. * @function
  14906. * @static
  14907. */
  14908. }, {
  14909. key: 'extend',
  14910. value: function extend(defaults, options) {
  14911. var results = {};
  14912. for (var key in defaults) {
  14913. if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
  14914. }
  14915. return results;
  14916. }
  14917. /**
  14918. * Get current coordinates left and top of specific element.
  14919. * @static
  14920. */
  14921. }, {
  14922. key: 'offsetRelative',
  14923. value: function offsetRelative(element) {
  14924. var result = { left: 0, top: 0 };
  14925. do {
  14926. var offsetTop = element.offsetTop;
  14927. var offsetLeft = element.offsetLeft;
  14928. if (!isNaN(offsetTop)) result.top += offsetTop;
  14929. if (!isNaN(offsetLeft)) result.left += offsetLeft;
  14930. } while (element = element.offsetParent);
  14931. return result;
  14932. }
  14933. /**
  14934. * Add specific class name to specific element.
  14935. * @static
  14936. * @param {ObjectDOM} element
  14937. * @param {String} className
  14938. */
  14939. }, {
  14940. key: 'addClass',
  14941. value: function addClass(element, className) {
  14942. if (!StickySidebar.hasClass(element, className)) {
  14943. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  14944. }
  14945. }
  14946. /**
  14947. * Remove specific class name to specific element
  14948. * @static
  14949. * @param {ObjectDOM} element
  14950. * @param {String} className
  14951. */
  14952. }, {
  14953. key: 'removeClass',
  14954. value: function removeClass(element, className) {
  14955. if (StickySidebar.hasClass(element, className)) {
  14956. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  14957. }
  14958. }
  14959. /**
  14960. * Detarmine weather the element has specific class name.
  14961. * @static
  14962. * @param {ObjectDOM} element
  14963. * @param {String} className
  14964. */
  14965. }, {
  14966. key: 'hasClass',
  14967. value: function hasClass(element, className) {
  14968. if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  14969. }
  14970. }]);
  14971. return StickySidebar;
  14972. }();
  14973. return StickySidebar;
  14974. }();
  14975. // Global
  14976. // -------------------------
  14977. window.StickySidebar = StickySidebar;
  14978. return StickySidebar;
  14979. });
  14980. //# sourceMappingURL=sticky-sidebar.js.map
  14981. /***/ }),
  14982. /* 34 */
  14983. /***/ (function(module, exports, __webpack_require__) {
  14984. "use strict";
  14985. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14986. 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; };
  14987. /*! tether 1.4.0 */
  14988. (function (root, factory) {
  14989. if (true) {
  14990. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14991. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14992. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14993. __WEBPACK_AMD_DEFINE_FACTORY__),
  14994. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14995. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  14996. module.exports = factory(require, exports, module);
  14997. } else {
  14998. root.Tether = factory();
  14999. }
  15000. })(undefined, function (require, exports, module) {
  15001. 'use strict';
  15002. var _createClass = function () {
  15003. function defineProperties(target, props) {
  15004. for (var i = 0; i < props.length; i++) {
  15005. 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);
  15006. }
  15007. }return function (Constructor, protoProps, staticProps) {
  15008. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15009. };
  15010. }();
  15011. function _classCallCheck(instance, Constructor) {
  15012. if (!(instance instanceof Constructor)) {
  15013. throw new TypeError('Cannot call a class as a function');
  15014. }
  15015. }
  15016. var TetherBase = undefined;
  15017. if (typeof TetherBase === 'undefined') {
  15018. TetherBase = { modules: [] };
  15019. }
  15020. var zeroElement = null;
  15021. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  15022. // if the element lies within a nested document (<frame> or <iframe>-like).
  15023. function getActualBoundingClientRect(node) {
  15024. var boundingRect = node.getBoundingClientRect();
  15025. // The original object returned by getBoundingClientRect is immutable, so we clone it
  15026. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  15027. var rect = {};
  15028. for (var k in boundingRect) {
  15029. rect[k] = boundingRect[k];
  15030. }
  15031. if (node.ownerDocument !== document) {
  15032. var _frameElement = node.ownerDocument.defaultView.frameElement;
  15033. if (_frameElement) {
  15034. var frameRect = getActualBoundingClientRect(_frameElement);
  15035. rect.top += frameRect.top;
  15036. rect.bottom += frameRect.top;
  15037. rect.left += frameRect.left;
  15038. rect.right += frameRect.left;
  15039. }
  15040. }
  15041. return rect;
  15042. }
  15043. function getScrollParents(el) {
  15044. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  15045. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  15046. var computedStyle = getComputedStyle(el) || {};
  15047. var position = computedStyle.position;
  15048. var parents = [];
  15049. if (position === 'fixed') {
  15050. return [el];
  15051. }
  15052. var parent = el;
  15053. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  15054. var style = undefined;
  15055. try {
  15056. style = getComputedStyle(parent);
  15057. } catch (err) {}
  15058. if (typeof style === 'undefined' || style === null) {
  15059. parents.push(parent);
  15060. return parents;
  15061. }
  15062. var _style = style;
  15063. var overflow = _style.overflow;
  15064. var overflowX = _style.overflowX;
  15065. var overflowY = _style.overflowY;
  15066. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  15067. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  15068. parents.push(parent);
  15069. }
  15070. }
  15071. }
  15072. parents.push(el.ownerDocument.body);
  15073. // If the node is within a frame, account for the parent window scroll
  15074. if (el.ownerDocument !== document) {
  15075. parents.push(el.ownerDocument.defaultView);
  15076. }
  15077. return parents;
  15078. }
  15079. var uniqueId = function () {
  15080. var id = 0;
  15081. return function () {
  15082. return ++id;
  15083. };
  15084. }();
  15085. var zeroPosCache = {};
  15086. var getOrigin = function getOrigin() {
  15087. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  15088. // jitter as the user scrolls that messes with our ability to detect if two positions
  15089. // are equivilant or not. We place an element at the top left of the page that will
  15090. // get the same jitter, so we can cancel the two out.
  15091. var node = zeroElement;
  15092. if (!node || !document.body.contains(node)) {
  15093. node = document.createElement('div');
  15094. node.setAttribute('data-tether-id', uniqueId());
  15095. extend(node.style, {
  15096. top: 0,
  15097. left: 0,
  15098. position: 'absolute'
  15099. });
  15100. document.body.appendChild(node);
  15101. zeroElement = node;
  15102. }
  15103. var id = node.getAttribute('data-tether-id');
  15104. if (typeof zeroPosCache[id] === 'undefined') {
  15105. zeroPosCache[id] = getActualBoundingClientRect(node);
  15106. // Clear the cache when this position call is done
  15107. defer(function () {
  15108. delete zeroPosCache[id];
  15109. });
  15110. }
  15111. return zeroPosCache[id];
  15112. };
  15113. function removeUtilElements() {
  15114. if (zeroElement) {
  15115. document.body.removeChild(zeroElement);
  15116. }
  15117. zeroElement = null;
  15118. };
  15119. function getBounds(el) {
  15120. var doc = undefined;
  15121. if (el === document) {
  15122. doc = document;
  15123. el = document.documentElement;
  15124. } else {
  15125. doc = el.ownerDocument;
  15126. }
  15127. var docEl = doc.documentElement;
  15128. var box = getActualBoundingClientRect(el);
  15129. var origin = getOrigin();
  15130. box.top -= origin.top;
  15131. box.left -= origin.left;
  15132. if (typeof box.width === 'undefined') {
  15133. box.width = document.body.scrollWidth - box.left - box.right;
  15134. }
  15135. if (typeof box.height === 'undefined') {
  15136. box.height = document.body.scrollHeight - box.top - box.bottom;
  15137. }
  15138. box.top = box.top - docEl.clientTop;
  15139. box.left = box.left - docEl.clientLeft;
  15140. box.right = doc.body.clientWidth - box.width - box.left;
  15141. box.bottom = doc.body.clientHeight - box.height - box.top;
  15142. return box;
  15143. }
  15144. function getOffsetParent(el) {
  15145. return el.offsetParent || document.documentElement;
  15146. }
  15147. var _scrollBarSize = null;
  15148. function getScrollBarSize() {
  15149. if (_scrollBarSize) {
  15150. return _scrollBarSize;
  15151. }
  15152. var inner = document.createElement('div');
  15153. inner.style.width = '100%';
  15154. inner.style.height = '200px';
  15155. var outer = document.createElement('div');
  15156. extend(outer.style, {
  15157. position: 'absolute',
  15158. top: 0,
  15159. left: 0,
  15160. pointerEvents: 'none',
  15161. visibility: 'hidden',
  15162. width: '200px',
  15163. height: '150px',
  15164. overflow: 'hidden'
  15165. });
  15166. outer.appendChild(inner);
  15167. document.body.appendChild(outer);
  15168. var widthContained = inner.offsetWidth;
  15169. outer.style.overflow = 'scroll';
  15170. var widthScroll = inner.offsetWidth;
  15171. if (widthContained === widthScroll) {
  15172. widthScroll = outer.clientWidth;
  15173. }
  15174. document.body.removeChild(outer);
  15175. var width = widthContained - widthScroll;
  15176. _scrollBarSize = { width: width, height: width };
  15177. return _scrollBarSize;
  15178. }
  15179. function extend() {
  15180. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  15181. var args = [];
  15182. Array.prototype.push.apply(args, arguments);
  15183. args.slice(1).forEach(function (obj) {
  15184. if (obj) {
  15185. for (var key in obj) {
  15186. if ({}.hasOwnProperty.call(obj, key)) {
  15187. out[key] = obj[key];
  15188. }
  15189. }
  15190. }
  15191. });
  15192. return out;
  15193. }
  15194. function removeClass(el, name) {
  15195. if (typeof el.classList !== 'undefined') {
  15196. name.split(' ').forEach(function (cls) {
  15197. if (cls.trim()) {
  15198. el.classList.remove(cls);
  15199. }
  15200. });
  15201. } else {
  15202. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  15203. var className = getClassName(el).replace(regex, ' ');
  15204. setClassName(el, className);
  15205. }
  15206. }
  15207. function addClass(el, name) {
  15208. if (typeof el.classList !== 'undefined') {
  15209. name.split(' ').forEach(function (cls) {
  15210. if (cls.trim()) {
  15211. el.classList.add(cls);
  15212. }
  15213. });
  15214. } else {
  15215. removeClass(el, name);
  15216. var cls = getClassName(el) + (' ' + name);
  15217. setClassName(el, cls);
  15218. }
  15219. }
  15220. function hasClass(el, name) {
  15221. if (typeof el.classList !== 'undefined') {
  15222. return el.classList.contains(name);
  15223. }
  15224. var className = getClassName(el);
  15225. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  15226. }
  15227. function getClassName(el) {
  15228. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  15229. // completely separately SVGAnimatedString base classes
  15230. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  15231. return el.className.baseVal;
  15232. }
  15233. return el.className;
  15234. }
  15235. function setClassName(el, className) {
  15236. el.setAttribute('class', className);
  15237. }
  15238. function updateClasses(el, add, all) {
  15239. // Of the set of 'all' classes, we need the 'add' classes, and only the
  15240. // 'add' classes to be set.
  15241. all.forEach(function (cls) {
  15242. if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
  15243. removeClass(el, cls);
  15244. }
  15245. });
  15246. add.forEach(function (cls) {
  15247. if (!hasClass(el, cls)) {
  15248. addClass(el, cls);
  15249. }
  15250. });
  15251. }
  15252. var deferred = [];
  15253. var defer = function defer(fn) {
  15254. deferred.push(fn);
  15255. };
  15256. var flush = function flush() {
  15257. var fn = undefined;
  15258. while (fn = deferred.pop()) {
  15259. fn();
  15260. }
  15261. };
  15262. var Evented = function () {
  15263. function Evented() {
  15264. _classCallCheck(this, Evented);
  15265. }
  15266. _createClass(Evented, [{
  15267. key: 'on',
  15268. value: function on(event, handler, ctx) {
  15269. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  15270. if (typeof this.bindings === 'undefined') {
  15271. this.bindings = {};
  15272. }
  15273. if (typeof this.bindings[event] === 'undefined') {
  15274. this.bindings[event] = [];
  15275. }
  15276. this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
  15277. }
  15278. }, {
  15279. key: 'once',
  15280. value: function once(event, handler, ctx) {
  15281. this.on(event, handler, ctx, true);
  15282. }
  15283. }, {
  15284. key: 'off',
  15285. value: function off(event, handler) {
  15286. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  15287. return;
  15288. }
  15289. if (typeof handler === 'undefined') {
  15290. delete this.bindings[event];
  15291. } else {
  15292. var i = 0;
  15293. while (i < this.bindings[event].length) {
  15294. if (this.bindings[event][i].handler === handler) {
  15295. this.bindings[event].splice(i, 1);
  15296. } else {
  15297. ++i;
  15298. }
  15299. }
  15300. }
  15301. }
  15302. }, {
  15303. key: 'trigger',
  15304. value: function trigger(event) {
  15305. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  15306. var i = 0;
  15307. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15308. args[_key - 1] = arguments[_key];
  15309. }
  15310. while (i < this.bindings[event].length) {
  15311. var _bindings$event$i = this.bindings[event][i];
  15312. var handler = _bindings$event$i.handler;
  15313. var ctx = _bindings$event$i.ctx;
  15314. var once = _bindings$event$i.once;
  15315. var context = ctx;
  15316. if (typeof context === 'undefined') {
  15317. context = this;
  15318. }
  15319. handler.apply(context, args);
  15320. if (once) {
  15321. this.bindings[event].splice(i, 1);
  15322. } else {
  15323. ++i;
  15324. }
  15325. }
  15326. }
  15327. }
  15328. }]);
  15329. return Evented;
  15330. }();
  15331. TetherBase.Utils = {
  15332. getActualBoundingClientRect: getActualBoundingClientRect,
  15333. getScrollParents: getScrollParents,
  15334. getBounds: getBounds,
  15335. getOffsetParent: getOffsetParent,
  15336. extend: extend,
  15337. addClass: addClass,
  15338. removeClass: removeClass,
  15339. hasClass: hasClass,
  15340. updateClasses: updateClasses,
  15341. defer: defer,
  15342. flush: flush,
  15343. uniqueId: uniqueId,
  15344. Evented: Evented,
  15345. getScrollBarSize: getScrollBarSize,
  15346. removeUtilElements: removeUtilElements
  15347. };
  15348. /* globals TetherBase, performance */
  15349. 'use strict';
  15350. var _slicedToArray = function () {
  15351. function sliceIterator(arr, i) {
  15352. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  15353. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  15354. _arr.push(_s.value);if (i && _arr.length === i) break;
  15355. }
  15356. } catch (err) {
  15357. _d = true;_e = err;
  15358. } finally {
  15359. try {
  15360. if (!_n && _i['return']) _i['return']();
  15361. } finally {
  15362. if (_d) throw _e;
  15363. }
  15364. }return _arr;
  15365. }return function (arr, i) {
  15366. if (Array.isArray(arr)) {
  15367. return arr;
  15368. } else if (Symbol.iterator in Object(arr)) {
  15369. return sliceIterator(arr, i);
  15370. } else {
  15371. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  15372. }
  15373. };
  15374. }();
  15375. var _createClass = function () {
  15376. function defineProperties(target, props) {
  15377. for (var i = 0; i < props.length; i++) {
  15378. 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);
  15379. }
  15380. }return function (Constructor, protoProps, staticProps) {
  15381. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15382. };
  15383. }();
  15384. var _get = function get(_x6, _x7, _x8) {
  15385. var _again = true;_function: while (_again) {
  15386. var object = _x6,
  15387. property = _x7,
  15388. receiver = _x8;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  15389. var parent = Object.getPrototypeOf(object);if (parent === null) {
  15390. return undefined;
  15391. } else {
  15392. _x6 = parent;_x7 = property;_x8 = receiver;_again = true;desc = parent = undefined;continue _function;
  15393. }
  15394. } else if ('value' in desc) {
  15395. return desc.value;
  15396. } else {
  15397. var getter = desc.get;if (getter === undefined) {
  15398. return undefined;
  15399. }return getter.call(receiver);
  15400. }
  15401. }
  15402. };
  15403. function _classCallCheck(instance, Constructor) {
  15404. if (!(instance instanceof Constructor)) {
  15405. throw new TypeError('Cannot call a class as a function');
  15406. }
  15407. }
  15408. function _inherits(subClass, superClass) {
  15409. if (typeof superClass !== 'function' && superClass !== null) {
  15410. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  15411. }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;
  15412. }
  15413. if (typeof TetherBase === 'undefined') {
  15414. throw new Error('You must include the utils.js file before tether.js');
  15415. }
  15416. var _TetherBase$Utils = TetherBase.Utils;
  15417. var getScrollParents = _TetherBase$Utils.getScrollParents;
  15418. var getBounds = _TetherBase$Utils.getBounds;
  15419. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  15420. var extend = _TetherBase$Utils.extend;
  15421. var addClass = _TetherBase$Utils.addClass;
  15422. var removeClass = _TetherBase$Utils.removeClass;
  15423. var updateClasses = _TetherBase$Utils.updateClasses;
  15424. var defer = _TetherBase$Utils.defer;
  15425. var flush = _TetherBase$Utils.flush;
  15426. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  15427. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  15428. function within(a, b) {
  15429. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  15430. return a + diff >= b && b >= a - diff;
  15431. }
  15432. var transformKey = function () {
  15433. if (typeof document === 'undefined') {
  15434. return '';
  15435. }
  15436. var el = document.createElement('div');
  15437. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  15438. for (var i = 0; i < transforms.length; ++i) {
  15439. var key = transforms[i];
  15440. if (el.style[key] !== undefined) {
  15441. return key;
  15442. }
  15443. }
  15444. }();
  15445. var tethers = [];
  15446. var position = function position() {
  15447. tethers.forEach(function (tether) {
  15448. tether.position(false);
  15449. });
  15450. flush();
  15451. };
  15452. function now() {
  15453. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  15454. return performance.now();
  15455. }
  15456. return +new Date();
  15457. }
  15458. (function () {
  15459. var lastCall = null;
  15460. var lastDuration = null;
  15461. var pendingTimeout = null;
  15462. var tick = function tick() {
  15463. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  15464. // We voluntarily throttle ourselves if we can't manage 60fps
  15465. lastDuration = Math.min(lastDuration - 16, 250);
  15466. // Just in case this is the last event, remember to position just once more
  15467. pendingTimeout = setTimeout(tick, 250);
  15468. return;
  15469. }
  15470. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  15471. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  15472. return;
  15473. }
  15474. if (pendingTimeout != null) {
  15475. clearTimeout(pendingTimeout);
  15476. pendingTimeout = null;
  15477. }
  15478. lastCall = now();
  15479. position();
  15480. lastDuration = now() - lastCall;
  15481. };
  15482. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  15483. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  15484. window.addEventListener(event, tick);
  15485. });
  15486. }
  15487. })();
  15488. var MIRROR_LR = {
  15489. center: 'center',
  15490. left: 'right',
  15491. right: 'left'
  15492. };
  15493. var MIRROR_TB = {
  15494. middle: 'middle',
  15495. top: 'bottom',
  15496. bottom: 'top'
  15497. };
  15498. var OFFSET_MAP = {
  15499. top: 0,
  15500. left: 0,
  15501. middle: '50%',
  15502. center: '50%',
  15503. bottom: '100%',
  15504. right: '100%'
  15505. };
  15506. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  15507. var left = attachment.left;
  15508. var top = attachment.top;
  15509. if (left === 'auto') {
  15510. left = MIRROR_LR[relativeToAttachment.left];
  15511. }
  15512. if (top === 'auto') {
  15513. top = MIRROR_TB[relativeToAttachment.top];
  15514. }
  15515. return { left: left, top: top };
  15516. };
  15517. var attachmentToOffset = function attachmentToOffset(attachment) {
  15518. var left = attachment.left;
  15519. var top = attachment.top;
  15520. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  15521. left = OFFSET_MAP[attachment.left];
  15522. }
  15523. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  15524. top = OFFSET_MAP[attachment.top];
  15525. }
  15526. return { left: left, top: top };
  15527. };
  15528. function addOffset() {
  15529. var out = { top: 0, left: 0 };
  15530. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  15531. offsets[_key] = arguments[_key];
  15532. }
  15533. offsets.forEach(function (_ref) {
  15534. var top = _ref.top;
  15535. var left = _ref.left;
  15536. if (typeof top === 'string') {
  15537. top = parseFloat(top, 10);
  15538. }
  15539. if (typeof left === 'string') {
  15540. left = parseFloat(left, 10);
  15541. }
  15542. out.top += top;
  15543. out.left += left;
  15544. });
  15545. return out;
  15546. }
  15547. function offsetToPx(offset, size) {
  15548. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
  15549. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  15550. }
  15551. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
  15552. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  15553. }
  15554. return offset;
  15555. }
  15556. var parseOffset = function parseOffset(value) {
  15557. var _value$split = value.split(' ');
  15558. var _value$split2 = _slicedToArray(_value$split, 2);
  15559. var top = _value$split2[0];
  15560. var left = _value$split2[1];
  15561. return { top: top, left: left };
  15562. };
  15563. var parseAttachment = parseOffset;
  15564. var TetherClass = function (_Evented) {
  15565. _inherits(TetherClass, _Evented);
  15566. function TetherClass(options) {
  15567. var _this = this;
  15568. _classCallCheck(this, TetherClass);
  15569. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  15570. this.position = this.position.bind(this);
  15571. tethers.push(this);
  15572. this.history = [];
  15573. this.setOptions(options, false);
  15574. TetherBase.modules.forEach(function (module) {
  15575. if (typeof module.initialize !== 'undefined') {
  15576. module.initialize.call(_this);
  15577. }
  15578. });
  15579. this.position();
  15580. }
  15581. _createClass(TetherClass, [{
  15582. key: 'getClass',
  15583. value: function getClass() {
  15584. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  15585. var classes = this.options.classes;
  15586. if (typeof classes !== 'undefined' && classes[key]) {
  15587. return this.options.classes[key];
  15588. } else if (this.options.classPrefix) {
  15589. return this.options.classPrefix + '-' + key;
  15590. } else {
  15591. return key;
  15592. }
  15593. }
  15594. }, {
  15595. key: 'setOptions',
  15596. value: function setOptions(options) {
  15597. var _this2 = this;
  15598. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  15599. var defaults = {
  15600. offset: '0 0',
  15601. targetOffset: '0 0',
  15602. targetAttachment: 'auto auto',
  15603. classPrefix: 'tether'
  15604. };
  15605. this.options = extend(defaults, options);
  15606. var _options = this.options;
  15607. var element = _options.element;
  15608. var target = _options.target;
  15609. var targetModifier = _options.targetModifier;
  15610. this.element = element;
  15611. this.target = target;
  15612. this.targetModifier = targetModifier;
  15613. if (this.target === 'viewport') {
  15614. this.target = document.body;
  15615. this.targetModifier = 'visible';
  15616. } else if (this.target === 'scroll-handle') {
  15617. this.target = document.body;
  15618. this.targetModifier = 'scroll-handle';
  15619. }
  15620. ['element', 'target'].forEach(function (key) {
  15621. if (typeof _this2[key] === 'undefined') {
  15622. throw new Error('Tether Error: Both element and target must be defined');
  15623. }
  15624. if (typeof _this2[key].jquery !== 'undefined') {
  15625. _this2[key] = _this2[key][0];
  15626. } else if (typeof _this2[key] === 'string') {
  15627. _this2[key] = document.querySelector(_this2[key]);
  15628. }
  15629. });
  15630. addClass(this.element, this.getClass('element'));
  15631. if (!(this.options.addTargetClasses === false)) {
  15632. addClass(this.target, this.getClass('target'));
  15633. }
  15634. if (!this.options.attachment) {
  15635. throw new Error('Tether Error: You must provide an attachment');
  15636. }
  15637. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  15638. this.attachment = parseAttachment(this.options.attachment);
  15639. this.offset = parseOffset(this.options.offset);
  15640. this.targetOffset = parseOffset(this.options.targetOffset);
  15641. if (typeof this.scrollParents !== 'undefined') {
  15642. this.disable();
  15643. }
  15644. if (this.targetModifier === 'scroll-handle') {
  15645. this.scrollParents = [this.target];
  15646. } else {
  15647. this.scrollParents = getScrollParents(this.target);
  15648. }
  15649. if (!(this.options.enabled === false)) {
  15650. this.enable(pos);
  15651. }
  15652. }
  15653. }, {
  15654. key: 'getTargetBounds',
  15655. value: function getTargetBounds() {
  15656. if (typeof this.targetModifier !== 'undefined') {
  15657. if (this.targetModifier === 'visible') {
  15658. if (this.target === document.body) {
  15659. return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  15660. } else {
  15661. var bounds = getBounds(this.target);
  15662. var out = {
  15663. height: bounds.height,
  15664. width: bounds.width,
  15665. top: bounds.top,
  15666. left: bounds.left
  15667. };
  15668. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  15669. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  15670. out.height = Math.min(innerHeight, out.height);
  15671. out.height -= 2;
  15672. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  15673. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  15674. out.width = Math.min(innerWidth, out.width);
  15675. out.width -= 2;
  15676. if (out.top < pageYOffset) {
  15677. out.top = pageYOffset;
  15678. }
  15679. if (out.left < pageXOffset) {
  15680. out.left = pageXOffset;
  15681. }
  15682. return out;
  15683. }
  15684. } else if (this.targetModifier === 'scroll-handle') {
  15685. var bounds = undefined;
  15686. var target = this.target;
  15687. if (target === document.body) {
  15688. target = document.documentElement;
  15689. bounds = {
  15690. left: pageXOffset,
  15691. top: pageYOffset,
  15692. height: innerHeight,
  15693. width: innerWidth
  15694. };
  15695. } else {
  15696. bounds = getBounds(target);
  15697. }
  15698. var style = getComputedStyle(target);
  15699. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  15700. var scrollBottom = 0;
  15701. if (hasBottomScroll) {
  15702. scrollBottom = 15;
  15703. }
  15704. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  15705. var out = {
  15706. width: 15,
  15707. height: height * 0.975 * (height / target.scrollHeight),
  15708. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  15709. };
  15710. var fitAdj = 0;
  15711. if (height < 408 && this.target === document.body) {
  15712. fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  15713. }
  15714. if (this.target !== document.body) {
  15715. out.height = Math.max(out.height, 24);
  15716. }
  15717. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  15718. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  15719. if (this.target === document.body) {
  15720. out.height = Math.max(out.height, 24);
  15721. }
  15722. return out;
  15723. }
  15724. } else {
  15725. return getBounds(this.target);
  15726. }
  15727. }
  15728. }, {
  15729. key: 'clearCache',
  15730. value: function clearCache() {
  15731. this._cache = {};
  15732. }
  15733. }, {
  15734. key: 'cache',
  15735. value: function cache(k, getter) {
  15736. // More than one module will often need the same DOM info, so
  15737. // we keep a cache which is cleared on each position call
  15738. if (typeof this._cache === 'undefined') {
  15739. this._cache = {};
  15740. }
  15741. if (typeof this._cache[k] === 'undefined') {
  15742. this._cache[k] = getter.call(this);
  15743. }
  15744. return this._cache[k];
  15745. }
  15746. }, {
  15747. key: 'enable',
  15748. value: function enable() {
  15749. var _this3 = this;
  15750. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15751. if (!(this.options.addTargetClasses === false)) {
  15752. addClass(this.target, this.getClass('enabled'));
  15753. }
  15754. addClass(this.element, this.getClass('enabled'));
  15755. this.enabled = true;
  15756. this.scrollParents.forEach(function (parent) {
  15757. if (parent !== _this3.target.ownerDocument) {
  15758. parent.addEventListener('scroll', _this3.position);
  15759. }
  15760. });
  15761. if (pos) {
  15762. this.position();
  15763. }
  15764. }
  15765. }, {
  15766. key: 'disable',
  15767. value: function disable() {
  15768. var _this4 = this;
  15769. removeClass(this.target, this.getClass('enabled'));
  15770. removeClass(this.element, this.getClass('enabled'));
  15771. this.enabled = false;
  15772. if (typeof this.scrollParents !== 'undefined') {
  15773. this.scrollParents.forEach(function (parent) {
  15774. parent.removeEventListener('scroll', _this4.position);
  15775. });
  15776. }
  15777. }
  15778. }, {
  15779. key: 'destroy',
  15780. value: function destroy() {
  15781. var _this5 = this;
  15782. this.disable();
  15783. tethers.forEach(function (tether, i) {
  15784. if (tether === _this5) {
  15785. tethers.splice(i, 1);
  15786. }
  15787. });
  15788. // Remove any elements we were using for convenience from the DOM
  15789. if (tethers.length === 0) {
  15790. removeUtilElements();
  15791. }
  15792. }
  15793. }, {
  15794. key: 'updateAttachClasses',
  15795. value: function updateAttachClasses(elementAttach, targetAttach) {
  15796. var _this6 = this;
  15797. elementAttach = elementAttach || this.attachment;
  15798. targetAttach = targetAttach || this.targetAttachment;
  15799. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  15800. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  15801. // updateAttachClasses can be called more than once in a position call, so
  15802. // we need to clean up after ourselves such that when the last defer gets
  15803. // ran it doesn't add any extra classes from previous calls.
  15804. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  15805. }
  15806. if (typeof this._addAttachClasses === 'undefined') {
  15807. this._addAttachClasses = [];
  15808. }
  15809. var add = this._addAttachClasses;
  15810. if (elementAttach.top) {
  15811. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  15812. }
  15813. if (elementAttach.left) {
  15814. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  15815. }
  15816. if (targetAttach.top) {
  15817. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  15818. }
  15819. if (targetAttach.left) {
  15820. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  15821. }
  15822. var all = [];
  15823. sides.forEach(function (side) {
  15824. all.push(_this6.getClass('element-attached') + '-' + side);
  15825. all.push(_this6.getClass('target-attached') + '-' + side);
  15826. });
  15827. defer(function () {
  15828. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  15829. return;
  15830. }
  15831. updateClasses(_this6.element, _this6._addAttachClasses, all);
  15832. if (!(_this6.options.addTargetClasses === false)) {
  15833. updateClasses(_this6.target, _this6._addAttachClasses, all);
  15834. }
  15835. delete _this6._addAttachClasses;
  15836. });
  15837. }
  15838. }, {
  15839. key: 'position',
  15840. value: function position() {
  15841. var _this7 = this;
  15842. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15843. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  15844. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  15845. if (!this.enabled) {
  15846. return;
  15847. }
  15848. this.clearCache();
  15849. // Turn 'auto' attachments into the appropriate corner or edge
  15850. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  15851. this.updateAttachClasses(this.attachment, targetAttachment);
  15852. var elementPos = this.cache('element-bounds', function () {
  15853. return getBounds(_this7.element);
  15854. });
  15855. var width = elementPos.width;
  15856. var height = elementPos.height;
  15857. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  15858. var _lastSize = this.lastSize;
  15859. // We cache the height and width to make it possible to position elements that are
  15860. // getting hidden.
  15861. width = _lastSize.width;
  15862. height = _lastSize.height;
  15863. } else {
  15864. this.lastSize = { width: width, height: height };
  15865. }
  15866. var targetPos = this.cache('target-bounds', function () {
  15867. return _this7.getTargetBounds();
  15868. });
  15869. var targetSize = targetPos;
  15870. // Get an actual px offset from the attachment
  15871. var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
  15872. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  15873. var manualOffset = offsetToPx(this.offset, { width: width, height: height });
  15874. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  15875. // Add the manually provided offset
  15876. offset = addOffset(offset, manualOffset);
  15877. targetOffset = addOffset(targetOffset, manualTargetOffset);
  15878. // It's now our goal to make (element position + offset) == (target position + target offset)
  15879. var left = targetPos.left + targetOffset.left - offset.left;
  15880. var top = targetPos.top + targetOffset.top - offset.top;
  15881. for (var i = 0; i < TetherBase.modules.length; ++i) {
  15882. var _module2 = TetherBase.modules[i];
  15883. var ret = _module2.position.call(this, {
  15884. left: left,
  15885. top: top,
  15886. targetAttachment: targetAttachment,
  15887. targetPos: targetPos,
  15888. elementPos: elementPos,
  15889. offset: offset,
  15890. targetOffset: targetOffset,
  15891. manualOffset: manualOffset,
  15892. manualTargetOffset: manualTargetOffset,
  15893. scrollbarSize: scrollbarSize,
  15894. attachment: this.attachment
  15895. });
  15896. if (ret === false) {
  15897. return false;
  15898. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  15899. continue;
  15900. } else {
  15901. top = ret.top;
  15902. left = ret.left;
  15903. }
  15904. }
  15905. // We describe the position three different ways to give the optimizer
  15906. // a chance to decide the best possible way to position the element
  15907. // with the fewest repaints.
  15908. var next = {
  15909. // It's position relative to the page (absolute positioning when
  15910. // the element is a child of the body)
  15911. page: {
  15912. top: top,
  15913. left: left
  15914. },
  15915. // It's position relative to the viewport (fixed positioning)
  15916. viewport: {
  15917. top: top - pageYOffset,
  15918. bottom: pageYOffset - top - height + innerHeight,
  15919. left: left - pageXOffset,
  15920. right: pageXOffset - left - width + innerWidth
  15921. }
  15922. };
  15923. var doc = this.target.ownerDocument;
  15924. var win = doc.defaultView;
  15925. var scrollbarSize = undefined;
  15926. if (win.innerHeight > doc.documentElement.clientHeight) {
  15927. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15928. next.viewport.bottom -= scrollbarSize.height;
  15929. }
  15930. if (win.innerWidth > doc.documentElement.clientWidth) {
  15931. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15932. next.viewport.right -= scrollbarSize.width;
  15933. }
  15934. if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
  15935. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  15936. next.page.bottom = doc.body.scrollHeight - top - height;
  15937. next.page.right = doc.body.scrollWidth - left - width;
  15938. }
  15939. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  15940. (function () {
  15941. var offsetParent = _this7.cache('target-offsetparent', function () {
  15942. return getOffsetParent(_this7.target);
  15943. });
  15944. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  15945. return getBounds(offsetParent);
  15946. });
  15947. var offsetParentStyle = getComputedStyle(offsetParent);
  15948. var offsetParentSize = offsetPosition;
  15949. var offsetBorder = {};
  15950. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  15951. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  15952. });
  15953. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  15954. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  15955. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  15956. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  15957. // We're within the visible part of the target's scroll parent
  15958. var scrollTop = offsetParent.scrollTop;
  15959. var scrollLeft = offsetParent.scrollLeft;
  15960. // It's position relative to the target's offset parent (absolute positioning when
  15961. // the element is moved to be a child of the target's offset parent).
  15962. next.offset = {
  15963. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  15964. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  15965. };
  15966. }
  15967. }
  15968. })();
  15969. }
  15970. // We could also travel up the DOM and try each containing context, rather than only
  15971. // looking at the body, but we're gonna get diminishing returns.
  15972. this.move(next);
  15973. this.history.unshift(next);
  15974. if (this.history.length > 3) {
  15975. this.history.pop();
  15976. }
  15977. if (flushChanges) {
  15978. flush();
  15979. }
  15980. return true;
  15981. }
  15982. // THE ISSUE
  15983. }, {
  15984. key: 'move',
  15985. value: function move(pos) {
  15986. var _this8 = this;
  15987. if (!(typeof this.element.parentNode !== 'undefined')) {
  15988. return;
  15989. }
  15990. var same = {};
  15991. for (var type in pos) {
  15992. same[type] = {};
  15993. for (var key in pos[type]) {
  15994. var found = false;
  15995. for (var i = 0; i < this.history.length; ++i) {
  15996. var point = this.history[i];
  15997. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  15998. found = true;
  15999. break;
  16000. }
  16001. }
  16002. if (!found) {
  16003. same[type][key] = true;
  16004. }
  16005. }
  16006. }
  16007. var css = { top: '', left: '', right: '', bottom: '' };
  16008. var transcribe = function transcribe(_same, _pos) {
  16009. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  16010. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  16011. if (gpu !== false) {
  16012. var yPos = undefined,
  16013. xPos = undefined;
  16014. if (_same.top) {
  16015. css.top = 0;
  16016. yPos = _pos.top;
  16017. } else {
  16018. css.bottom = 0;
  16019. yPos = -_pos.bottom;
  16020. }
  16021. if (_same.left) {
  16022. css.left = 0;
  16023. xPos = _pos.left;
  16024. } else {
  16025. css.right = 0;
  16026. xPos = -_pos.right;
  16027. }
  16028. if (window.matchMedia) {
  16029. // HubSpot/tether#207
  16030. 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;
  16031. if (!retina) {
  16032. xPos = Math.round(xPos);
  16033. yPos = Math.round(yPos);
  16034. }
  16035. }
  16036. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  16037. if (transformKey !== 'msTransform') {
  16038. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  16039. // but IE9 doesn't support 3d transforms and will choke.
  16040. css[transformKey] += " translateZ(0)";
  16041. }
  16042. } else {
  16043. if (_same.top) {
  16044. css.top = _pos.top + 'px';
  16045. } else {
  16046. css.bottom = _pos.bottom + 'px';
  16047. }
  16048. if (_same.left) {
  16049. css.left = _pos.left + 'px';
  16050. } else {
  16051. css.right = _pos.right + 'px';
  16052. }
  16053. }
  16054. };
  16055. var moved = false;
  16056. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  16057. css.position = 'absolute';
  16058. transcribe(same.page, pos.page);
  16059. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  16060. css.position = 'fixed';
  16061. transcribe(same.viewport, pos.viewport);
  16062. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  16063. (function () {
  16064. css.position = 'absolute';
  16065. var offsetParent = _this8.cache('target-offsetparent', function () {
  16066. return getOffsetParent(_this8.target);
  16067. });
  16068. if (getOffsetParent(_this8.element) !== offsetParent) {
  16069. defer(function () {
  16070. _this8.element.parentNode.removeChild(_this8.element);
  16071. offsetParent.appendChild(_this8.element);
  16072. });
  16073. }
  16074. transcribe(same.offset, pos.offset);
  16075. moved = true;
  16076. })();
  16077. } else {
  16078. css.position = 'absolute';
  16079. transcribe({ top: true, left: true }, pos.page);
  16080. }
  16081. if (!moved) {
  16082. if (this.options.bodyElement) {
  16083. this.options.bodyElement.appendChild(this.element);
  16084. } else {
  16085. var offsetParentIsBody = true;
  16086. var currentNode = this.element.parentNode;
  16087. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  16088. if (getComputedStyle(currentNode).position !== 'static') {
  16089. offsetParentIsBody = false;
  16090. break;
  16091. }
  16092. currentNode = currentNode.parentNode;
  16093. }
  16094. if (!offsetParentIsBody) {
  16095. this.element.parentNode.removeChild(this.element);
  16096. this.element.ownerDocument.body.appendChild(this.element);
  16097. }
  16098. }
  16099. }
  16100. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  16101. var writeCSS = {};
  16102. var write = false;
  16103. for (var key in css) {
  16104. var val = css[key];
  16105. var elVal = this.element.style[key];
  16106. if (elVal !== val) {
  16107. write = true;
  16108. writeCSS[key] = val;
  16109. }
  16110. }
  16111. if (write) {
  16112. defer(function () {
  16113. extend(_this8.element.style, writeCSS);
  16114. _this8.trigger('repositioned');
  16115. });
  16116. }
  16117. }
  16118. }]);
  16119. return TetherClass;
  16120. }(Evented);
  16121. TetherClass.modules = [];
  16122. TetherBase.position = position;
  16123. var Tether = extend(TetherClass, TetherBase);
  16124. /* globals TetherBase */
  16125. 'use strict';
  16126. var _slicedToArray = function () {
  16127. function sliceIterator(arr, i) {
  16128. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16129. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16130. _arr.push(_s.value);if (i && _arr.length === i) break;
  16131. }
  16132. } catch (err) {
  16133. _d = true;_e = err;
  16134. } finally {
  16135. try {
  16136. if (!_n && _i['return']) _i['return']();
  16137. } finally {
  16138. if (_d) throw _e;
  16139. }
  16140. }return _arr;
  16141. }return function (arr, i) {
  16142. if (Array.isArray(arr)) {
  16143. return arr;
  16144. } else if (Symbol.iterator in Object(arr)) {
  16145. return sliceIterator(arr, i);
  16146. } else {
  16147. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16148. }
  16149. };
  16150. }();
  16151. var _TetherBase$Utils = TetherBase.Utils;
  16152. var getBounds = _TetherBase$Utils.getBounds;
  16153. var extend = _TetherBase$Utils.extend;
  16154. var updateClasses = _TetherBase$Utils.updateClasses;
  16155. var defer = _TetherBase$Utils.defer;
  16156. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  16157. function getBoundingRect(tether, to) {
  16158. if (to === 'scrollParent') {
  16159. to = tether.scrollParents[0];
  16160. } else if (to === 'window') {
  16161. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  16162. }
  16163. if (to === document) {
  16164. to = to.documentElement;
  16165. }
  16166. if (typeof to.nodeType !== 'undefined') {
  16167. (function () {
  16168. var node = to;
  16169. var size = getBounds(to);
  16170. var pos = size;
  16171. var style = getComputedStyle(to);
  16172. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  16173. // Account any parent Frames scroll offset
  16174. if (node.ownerDocument !== document) {
  16175. var win = node.ownerDocument.defaultView;
  16176. to[0] += win.pageXOffset;
  16177. to[1] += win.pageYOffset;
  16178. to[2] += win.pageXOffset;
  16179. to[3] += win.pageYOffset;
  16180. }
  16181. BOUNDS_FORMAT.forEach(function (side, i) {
  16182. side = side[0].toUpperCase() + side.substr(1);
  16183. if (side === 'Top' || side === 'Left') {
  16184. to[i] += parseFloat(style['border' + side + 'Width']);
  16185. } else {
  16186. to[i] -= parseFloat(style['border' + side + 'Width']);
  16187. }
  16188. });
  16189. })();
  16190. }
  16191. return to;
  16192. }
  16193. TetherBase.modules.push({
  16194. position: function position(_ref) {
  16195. var _this = this;
  16196. var top = _ref.top;
  16197. var left = _ref.left;
  16198. var targetAttachment = _ref.targetAttachment;
  16199. if (!this.options.constraints) {
  16200. return true;
  16201. }
  16202. var _cache = this.cache('element-bounds', function () {
  16203. return getBounds(_this.element);
  16204. });
  16205. var height = _cache.height;
  16206. var width = _cache.width;
  16207. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16208. var _lastSize = this.lastSize;
  16209. // Handle the item getting hidden as a result of our positioning without glitching
  16210. // the classes in and out
  16211. width = _lastSize.width;
  16212. height = _lastSize.height;
  16213. }
  16214. var targetSize = this.cache('target-bounds', function () {
  16215. return _this.getTargetBounds();
  16216. });
  16217. var targetHeight = targetSize.height;
  16218. var targetWidth = targetSize.width;
  16219. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  16220. this.options.constraints.forEach(function (constraint) {
  16221. var outOfBoundsClass = constraint.outOfBoundsClass;
  16222. var pinnedClass = constraint.pinnedClass;
  16223. if (outOfBoundsClass) {
  16224. allClasses.push(outOfBoundsClass);
  16225. }
  16226. if (pinnedClass) {
  16227. allClasses.push(pinnedClass);
  16228. }
  16229. });
  16230. allClasses.forEach(function (cls) {
  16231. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  16232. allClasses.push(cls + '-' + side);
  16233. });
  16234. });
  16235. var addClasses = [];
  16236. var tAttachment = extend({}, targetAttachment);
  16237. var eAttachment = extend({}, this.attachment);
  16238. this.options.constraints.forEach(function (constraint) {
  16239. var to = constraint.to;
  16240. var attachment = constraint.attachment;
  16241. var pin = constraint.pin;
  16242. if (typeof attachment === 'undefined') {
  16243. attachment = '';
  16244. }
  16245. var changeAttachX = undefined,
  16246. changeAttachY = undefined;
  16247. if (attachment.indexOf(' ') >= 0) {
  16248. var _attachment$split = attachment.split(' ');
  16249. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  16250. changeAttachY = _attachment$split2[0];
  16251. changeAttachX = _attachment$split2[1];
  16252. } else {
  16253. changeAttachX = changeAttachY = attachment;
  16254. }
  16255. var bounds = getBoundingRect(_this, to);
  16256. if (changeAttachY === 'target' || changeAttachY === 'both') {
  16257. if (top < bounds[1] && tAttachment.top === 'top') {
  16258. top += targetHeight;
  16259. tAttachment.top = 'bottom';
  16260. }
  16261. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  16262. top -= targetHeight;
  16263. tAttachment.top = 'top';
  16264. }
  16265. }
  16266. if (changeAttachY === 'together') {
  16267. if (tAttachment.top === 'top') {
  16268. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  16269. top += targetHeight;
  16270. tAttachment.top = 'bottom';
  16271. top += height;
  16272. eAttachment.top = 'top';
  16273. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  16274. top -= height - targetHeight;
  16275. tAttachment.top = 'bottom';
  16276. eAttachment.top = 'bottom';
  16277. }
  16278. }
  16279. if (tAttachment.top === 'bottom') {
  16280. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  16281. top -= targetHeight;
  16282. tAttachment.top = 'top';
  16283. top -= height;
  16284. eAttachment.top = 'bottom';
  16285. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  16286. top += height - targetHeight;
  16287. tAttachment.top = 'top';
  16288. eAttachment.top = 'top';
  16289. }
  16290. }
  16291. if (tAttachment.top === 'middle') {
  16292. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16293. top -= height;
  16294. eAttachment.top = 'bottom';
  16295. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  16296. top += height;
  16297. eAttachment.top = 'top';
  16298. }
  16299. }
  16300. }
  16301. if (changeAttachX === 'target' || changeAttachX === 'both') {
  16302. if (left < bounds[0] && tAttachment.left === 'left') {
  16303. left += targetWidth;
  16304. tAttachment.left = 'right';
  16305. }
  16306. if (left + width > bounds[2] && tAttachment.left === 'right') {
  16307. left -= targetWidth;
  16308. tAttachment.left = 'left';
  16309. }
  16310. }
  16311. if (changeAttachX === 'together') {
  16312. if (left < bounds[0] && tAttachment.left === 'left') {
  16313. if (eAttachment.left === 'right') {
  16314. left += targetWidth;
  16315. tAttachment.left = 'right';
  16316. left += width;
  16317. eAttachment.left = 'left';
  16318. } else if (eAttachment.left === 'left') {
  16319. left += targetWidth;
  16320. tAttachment.left = 'right';
  16321. left -= width;
  16322. eAttachment.left = 'right';
  16323. }
  16324. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  16325. if (eAttachment.left === 'left') {
  16326. left -= targetWidth;
  16327. tAttachment.left = 'left';
  16328. left -= width;
  16329. eAttachment.left = 'right';
  16330. } else if (eAttachment.left === 'right') {
  16331. left -= targetWidth;
  16332. tAttachment.left = 'left';
  16333. left += width;
  16334. eAttachment.left = 'left';
  16335. }
  16336. } else if (tAttachment.left === 'center') {
  16337. if (left + width > bounds[2] && eAttachment.left === 'left') {
  16338. left -= width;
  16339. eAttachment.left = 'right';
  16340. } else if (left < bounds[0] && eAttachment.left === 'right') {
  16341. left += width;
  16342. eAttachment.left = 'left';
  16343. }
  16344. }
  16345. }
  16346. if (changeAttachY === 'element' || changeAttachY === 'both') {
  16347. if (top < bounds[1] && eAttachment.top === 'bottom') {
  16348. top += height;
  16349. eAttachment.top = 'top';
  16350. }
  16351. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16352. top -= height;
  16353. eAttachment.top = 'bottom';
  16354. }
  16355. }
  16356. if (changeAttachX === 'element' || changeAttachX === 'both') {
  16357. if (left < bounds[0]) {
  16358. if (eAttachment.left === 'right') {
  16359. left += width;
  16360. eAttachment.left = 'left';
  16361. } else if (eAttachment.left === 'center') {
  16362. left += width / 2;
  16363. eAttachment.left = 'left';
  16364. }
  16365. }
  16366. if (left + width > bounds[2]) {
  16367. if (eAttachment.left === 'left') {
  16368. left -= width;
  16369. eAttachment.left = 'right';
  16370. } else if (eAttachment.left === 'center') {
  16371. left -= width / 2;
  16372. eAttachment.left = 'right';
  16373. }
  16374. }
  16375. }
  16376. if (typeof pin === 'string') {
  16377. pin = pin.split(',').map(function (p) {
  16378. return p.trim();
  16379. });
  16380. } else if (pin === true) {
  16381. pin = ['top', 'left', 'right', 'bottom'];
  16382. }
  16383. pin = pin || [];
  16384. var pinned = [];
  16385. var oob = [];
  16386. if (top < bounds[1]) {
  16387. if (pin.indexOf('top') >= 0) {
  16388. top = bounds[1];
  16389. pinned.push('top');
  16390. } else {
  16391. oob.push('top');
  16392. }
  16393. }
  16394. if (top + height > bounds[3]) {
  16395. if (pin.indexOf('bottom') >= 0) {
  16396. top = bounds[3] - height;
  16397. pinned.push('bottom');
  16398. } else {
  16399. oob.push('bottom');
  16400. }
  16401. }
  16402. if (left < bounds[0]) {
  16403. if (pin.indexOf('left') >= 0) {
  16404. left = bounds[0];
  16405. pinned.push('left');
  16406. } else {
  16407. oob.push('left');
  16408. }
  16409. }
  16410. if (left + width > bounds[2]) {
  16411. if (pin.indexOf('right') >= 0) {
  16412. left = bounds[2] - width;
  16413. pinned.push('right');
  16414. } else {
  16415. oob.push('right');
  16416. }
  16417. }
  16418. if (pinned.length) {
  16419. (function () {
  16420. var pinnedClass = undefined;
  16421. if (typeof _this.options.pinnedClass !== 'undefined') {
  16422. pinnedClass = _this.options.pinnedClass;
  16423. } else {
  16424. pinnedClass = _this.getClass('pinned');
  16425. }
  16426. addClasses.push(pinnedClass);
  16427. pinned.forEach(function (side) {
  16428. addClasses.push(pinnedClass + '-' + side);
  16429. });
  16430. })();
  16431. }
  16432. if (oob.length) {
  16433. (function () {
  16434. var oobClass = undefined;
  16435. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  16436. oobClass = _this.options.outOfBoundsClass;
  16437. } else {
  16438. oobClass = _this.getClass('out-of-bounds');
  16439. }
  16440. addClasses.push(oobClass);
  16441. oob.forEach(function (side) {
  16442. addClasses.push(oobClass + '-' + side);
  16443. });
  16444. })();
  16445. }
  16446. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  16447. eAttachment.left = tAttachment.left = false;
  16448. }
  16449. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  16450. eAttachment.top = tAttachment.top = false;
  16451. }
  16452. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  16453. _this.updateAttachClasses(eAttachment, tAttachment);
  16454. _this.trigger('update', {
  16455. attachment: eAttachment,
  16456. targetAttachment: tAttachment
  16457. });
  16458. }
  16459. });
  16460. defer(function () {
  16461. if (!(_this.options.addTargetClasses === false)) {
  16462. updateClasses(_this.target, addClasses, allClasses);
  16463. }
  16464. updateClasses(_this.element, addClasses, allClasses);
  16465. });
  16466. return { top: top, left: left };
  16467. }
  16468. });
  16469. /* globals TetherBase */
  16470. 'use strict';
  16471. var _TetherBase$Utils = TetherBase.Utils;
  16472. var getBounds = _TetherBase$Utils.getBounds;
  16473. var updateClasses = _TetherBase$Utils.updateClasses;
  16474. var defer = _TetherBase$Utils.defer;
  16475. TetherBase.modules.push({
  16476. position: function position(_ref) {
  16477. var _this = this;
  16478. var top = _ref.top;
  16479. var left = _ref.left;
  16480. var _cache = this.cache('element-bounds', function () {
  16481. return getBounds(_this.element);
  16482. });
  16483. var height = _cache.height;
  16484. var width = _cache.width;
  16485. var targetPos = this.getTargetBounds();
  16486. var bottom = top + height;
  16487. var right = left + width;
  16488. var abutted = [];
  16489. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  16490. ['left', 'right'].forEach(function (side) {
  16491. var targetPosSide = targetPos[side];
  16492. if (targetPosSide === left || targetPosSide === right) {
  16493. abutted.push(side);
  16494. }
  16495. });
  16496. }
  16497. if (left <= targetPos.right && right >= targetPos.left) {
  16498. ['top', 'bottom'].forEach(function (side) {
  16499. var targetPosSide = targetPos[side];
  16500. if (targetPosSide === top || targetPosSide === bottom) {
  16501. abutted.push(side);
  16502. }
  16503. });
  16504. }
  16505. var allClasses = [];
  16506. var addClasses = [];
  16507. var sides = ['left', 'top', 'right', 'bottom'];
  16508. allClasses.push(this.getClass('abutted'));
  16509. sides.forEach(function (side) {
  16510. allClasses.push(_this.getClass('abutted') + '-' + side);
  16511. });
  16512. if (abutted.length) {
  16513. addClasses.push(this.getClass('abutted'));
  16514. }
  16515. abutted.forEach(function (side) {
  16516. addClasses.push(_this.getClass('abutted') + '-' + side);
  16517. });
  16518. defer(function () {
  16519. if (!(_this.options.addTargetClasses === false)) {
  16520. updateClasses(_this.target, addClasses, allClasses);
  16521. }
  16522. updateClasses(_this.element, addClasses, allClasses);
  16523. });
  16524. return true;
  16525. }
  16526. });
  16527. /* globals TetherBase */
  16528. 'use strict';
  16529. var _slicedToArray = function () {
  16530. function sliceIterator(arr, i) {
  16531. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16532. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16533. _arr.push(_s.value);if (i && _arr.length === i) break;
  16534. }
  16535. } catch (err) {
  16536. _d = true;_e = err;
  16537. } finally {
  16538. try {
  16539. if (!_n && _i['return']) _i['return']();
  16540. } finally {
  16541. if (_d) throw _e;
  16542. }
  16543. }return _arr;
  16544. }return function (arr, i) {
  16545. if (Array.isArray(arr)) {
  16546. return arr;
  16547. } else if (Symbol.iterator in Object(arr)) {
  16548. return sliceIterator(arr, i);
  16549. } else {
  16550. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16551. }
  16552. };
  16553. }();
  16554. TetherBase.modules.push({
  16555. position: function position(_ref) {
  16556. var top = _ref.top;
  16557. var left = _ref.left;
  16558. if (!this.options.shift) {
  16559. return;
  16560. }
  16561. var shift = this.options.shift;
  16562. if (typeof this.options.shift === 'function') {
  16563. shift = this.options.shift.call(this, { top: top, left: left });
  16564. }
  16565. var shiftTop = undefined,
  16566. shiftLeft = undefined;
  16567. if (typeof shift === 'string') {
  16568. shift = shift.split(' ');
  16569. shift[1] = shift[1] || shift[0];
  16570. var _shift = shift;
  16571. var _shift2 = _slicedToArray(_shift, 2);
  16572. shiftTop = _shift2[0];
  16573. shiftLeft = _shift2[1];
  16574. shiftTop = parseFloat(shiftTop, 10);
  16575. shiftLeft = parseFloat(shiftLeft, 10);
  16576. } else {
  16577. shiftTop = shift.top;
  16578. shiftLeft = shift.left;
  16579. }
  16580. top += shiftTop;
  16581. left += shiftLeft;
  16582. return { top: top, left: left };
  16583. }
  16584. });
  16585. return Tether;
  16586. });
  16587. /***/ }),
  16588. /* 35 */
  16589. /***/ (function(module, exports, __webpack_require__) {
  16590. "use strict";
  16591. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  16592. /*
  16593. * Toastr
  16594. * Copyright 2012-2015
  16595. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  16596. * All Rights Reserved.
  16597. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  16598. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  16599. *
  16600. * ARIA Support: Greta Krafsig
  16601. *
  16602. * Project: https://github.com/CodeSeven/toastr
  16603. */
  16604. /* global define */
  16605. (function (define) {
  16606. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  16607. return function () {
  16608. var $container;
  16609. var listener;
  16610. var toastId = 0;
  16611. var toastType = {
  16612. error: 'error',
  16613. info: 'info',
  16614. success: 'success',
  16615. warning: 'warning'
  16616. };
  16617. var toastr = {
  16618. clear: clear,
  16619. remove: remove,
  16620. error: error,
  16621. getContainer: getContainer,
  16622. info: info,
  16623. options: {},
  16624. subscribe: subscribe,
  16625. success: success,
  16626. version: '2.1.3',
  16627. warning: warning
  16628. };
  16629. var previousToast;
  16630. return toastr;
  16631. ////////////////
  16632. function error(message, title, optionsOverride) {
  16633. return notify({
  16634. type: toastType.error,
  16635. iconClass: getOptions().iconClasses.error,
  16636. message: message,
  16637. optionsOverride: optionsOverride,
  16638. title: title
  16639. });
  16640. }
  16641. function getContainer(options, create) {
  16642. if (!options) {
  16643. options = getOptions();
  16644. }
  16645. $container = $('#' + options.containerId);
  16646. if ($container.length) {
  16647. return $container;
  16648. }
  16649. if (create) {
  16650. $container = createContainer(options);
  16651. }
  16652. return $container;
  16653. }
  16654. function info(message, title, optionsOverride) {
  16655. return notify({
  16656. type: toastType.info,
  16657. iconClass: getOptions().iconClasses.info,
  16658. message: message,
  16659. optionsOverride: optionsOverride,
  16660. title: title
  16661. });
  16662. }
  16663. function subscribe(callback) {
  16664. listener = callback;
  16665. }
  16666. function success(message, title, optionsOverride) {
  16667. return notify({
  16668. type: toastType.success,
  16669. iconClass: getOptions().iconClasses.success,
  16670. message: message,
  16671. optionsOverride: optionsOverride,
  16672. title: title
  16673. });
  16674. }
  16675. function warning(message, title, optionsOverride) {
  16676. return notify({
  16677. type: toastType.warning,
  16678. iconClass: getOptions().iconClasses.warning,
  16679. message: message,
  16680. optionsOverride: optionsOverride,
  16681. title: title
  16682. });
  16683. }
  16684. function clear($toastElement, clearOptions) {
  16685. var options = getOptions();
  16686. if (!$container) {
  16687. getContainer(options);
  16688. }
  16689. if (!clearToast($toastElement, options, clearOptions)) {
  16690. clearContainer(options);
  16691. }
  16692. }
  16693. function remove($toastElement) {
  16694. var options = getOptions();
  16695. if (!$container) {
  16696. getContainer(options);
  16697. }
  16698. if ($toastElement && $(':focus', $toastElement).length === 0) {
  16699. removeToast($toastElement);
  16700. return;
  16701. }
  16702. if ($container.children().length) {
  16703. $container.remove();
  16704. }
  16705. }
  16706. // internal functions
  16707. function clearContainer(options) {
  16708. var toastsToClear = $container.children();
  16709. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  16710. clearToast($(toastsToClear[i]), options);
  16711. }
  16712. }
  16713. function clearToast($toastElement, options, clearOptions) {
  16714. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  16715. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  16716. $toastElement[options.hideMethod]({
  16717. duration: options.hideDuration,
  16718. easing: options.hideEasing,
  16719. complete: function complete() {
  16720. removeToast($toastElement);
  16721. }
  16722. });
  16723. return true;
  16724. }
  16725. return false;
  16726. }
  16727. function createContainer(options) {
  16728. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  16729. $container.appendTo($(options.target));
  16730. return $container;
  16731. }
  16732. function getDefaults() {
  16733. return {
  16734. tapToDismiss: true,
  16735. toastClass: 'toast',
  16736. containerId: 'toast-container',
  16737. debug: false,
  16738. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  16739. showDuration: 300,
  16740. showEasing: 'swing', //swing and linear are built into jQuery
  16741. onShown: undefined,
  16742. hideMethod: 'fadeOut',
  16743. hideDuration: 1000,
  16744. hideEasing: 'swing',
  16745. onHidden: undefined,
  16746. closeMethod: false,
  16747. closeDuration: false,
  16748. closeEasing: false,
  16749. closeOnHover: true,
  16750. extendedTimeOut: 1000,
  16751. iconClasses: {
  16752. error: 'toast-error',
  16753. info: 'toast-info',
  16754. success: 'toast-success',
  16755. warning: 'toast-warning'
  16756. },
  16757. iconClass: 'toast-info',
  16758. positionClass: 'toast-top-right',
  16759. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  16760. titleClass: 'toast-title',
  16761. messageClass: 'toast-message',
  16762. escapeHtml: false,
  16763. target: 'body',
  16764. closeHtml: '<button type="button">&times;</button>',
  16765. closeClass: 'toast-close-button',
  16766. newestOnTop: true,
  16767. preventDuplicates: false,
  16768. progressBar: false,
  16769. progressClass: 'toast-progress',
  16770. rtl: false
  16771. };
  16772. }
  16773. function publish(args) {
  16774. if (!listener) {
  16775. return;
  16776. }
  16777. listener(args);
  16778. }
  16779. function notify(map) {
  16780. var options = getOptions();
  16781. var iconClass = map.iconClass || options.iconClass;
  16782. if (typeof map.optionsOverride !== 'undefined') {
  16783. options = $.extend(options, map.optionsOverride);
  16784. iconClass = map.optionsOverride.iconClass || iconClass;
  16785. }
  16786. if (shouldExit(options, map)) {
  16787. return;
  16788. }
  16789. toastId++;
  16790. $container = getContainer(options, true);
  16791. var intervalId = null;
  16792. var $toastElement = $('<div/>');
  16793. var $titleElement = $('<div/>');
  16794. var $messageElement = $('<div/>');
  16795. var $progressElement = $('<div/>');
  16796. var $closeElement = $(options.closeHtml);
  16797. var progressBar = {
  16798. intervalId: null,
  16799. hideEta: null,
  16800. maxHideTime: null
  16801. };
  16802. var response = {
  16803. toastId: toastId,
  16804. state: 'visible',
  16805. startTime: new Date(),
  16806. options: options,
  16807. map: map
  16808. };
  16809. personalizeToast();
  16810. displayToast();
  16811. handleEvents();
  16812. publish(response);
  16813. if (options.debug && console) {
  16814. console.log(response);
  16815. }
  16816. return $toastElement;
  16817. function escapeHtml(source) {
  16818. if (source == null) {
  16819. source = '';
  16820. }
  16821. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  16822. }
  16823. function personalizeToast() {
  16824. setIcon();
  16825. setTitle();
  16826. setMessage();
  16827. setCloseButton();
  16828. setProgressBar();
  16829. setRTL();
  16830. setSequence();
  16831. setAria();
  16832. }
  16833. function setAria() {
  16834. var ariaValue = '';
  16835. switch (map.iconClass) {
  16836. case 'toast-success':
  16837. case 'toast-info':
  16838. ariaValue = 'polite';
  16839. break;
  16840. default:
  16841. ariaValue = 'assertive';
  16842. }
  16843. $toastElement.attr('aria-live', ariaValue);
  16844. }
  16845. function handleEvents() {
  16846. if (options.closeOnHover) {
  16847. $toastElement.hover(stickAround, delayedHideToast);
  16848. }
  16849. if (!options.onclick && options.tapToDismiss) {
  16850. $toastElement.click(hideToast);
  16851. }
  16852. if (options.closeButton && $closeElement) {
  16853. $closeElement.click(function (event) {
  16854. if (event.stopPropagation) {
  16855. event.stopPropagation();
  16856. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  16857. event.cancelBubble = true;
  16858. }
  16859. if (options.onCloseClick) {
  16860. options.onCloseClick(event);
  16861. }
  16862. hideToast(true);
  16863. });
  16864. }
  16865. if (options.onclick) {
  16866. $toastElement.click(function (event) {
  16867. options.onclick(event);
  16868. hideToast();
  16869. });
  16870. }
  16871. }
  16872. function displayToast() {
  16873. $toastElement.hide();
  16874. $toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });
  16875. if (options.timeOut > 0) {
  16876. intervalId = setTimeout(hideToast, options.timeOut);
  16877. progressBar.maxHideTime = parseFloat(options.timeOut);
  16878. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16879. if (options.progressBar) {
  16880. progressBar.intervalId = setInterval(updateProgress, 10);
  16881. }
  16882. }
  16883. }
  16884. function setIcon() {
  16885. if (map.iconClass) {
  16886. $toastElement.addClass(options.toastClass).addClass(iconClass).addClass('mg-toast');
  16887. }
  16888. }
  16889. function setSequence() {
  16890. if (options.newestOnTop) {
  16891. $container.prepend($toastElement);
  16892. } else {
  16893. $container.append($toastElement);
  16894. }
  16895. }
  16896. function setTitle() {
  16897. if (map.title) {
  16898. var suffix = map.title;
  16899. if (options.escapeHtml) {
  16900. suffix = escapeHtml(map.title);
  16901. }
  16902. $titleElement.append(suffix).addClass(options.titleClass);
  16903. $toastElement.append($titleElement);
  16904. }
  16905. }
  16906. function setMessage() {
  16907. if (map.message) {
  16908. var suffix = map.message;
  16909. if (options.escapeHtml) {
  16910. suffix = escapeHtml(map.message);
  16911. }
  16912. $messageElement.append(suffix).addClass(options.messageClass);
  16913. $toastElement.append($messageElement);
  16914. }
  16915. }
  16916. function setCloseButton() {
  16917. if (options.closeButton) {
  16918. $closeElement.addClass(options.closeClass).attr('role', 'button');
  16919. $toastElement.prepend($closeElement);
  16920. }
  16921. }
  16922. function setProgressBar() {
  16923. if (options.progressBar) {
  16924. $progressElement.addClass(options.progressClass);
  16925. $toastElement.prepend($progressElement);
  16926. }
  16927. }
  16928. function setRTL() {
  16929. if (options.rtl) {
  16930. $toastElement.addClass('rtl');
  16931. }
  16932. }
  16933. function shouldExit(options, map) {
  16934. if (options.preventDuplicates) {
  16935. if (map.message === previousToast) {
  16936. return true;
  16937. } else {
  16938. previousToast = map.message;
  16939. }
  16940. }
  16941. return false;
  16942. }
  16943. function hideToast(override) {
  16944. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  16945. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  16946. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  16947. if ($(':focus', $toastElement).length && !override) {
  16948. return;
  16949. }
  16950. clearTimeout(progressBar.intervalId);
  16951. return $toastElement[method]({
  16952. duration: duration,
  16953. easing: easing,
  16954. complete: function complete() {
  16955. removeToast($toastElement);
  16956. clearTimeout(intervalId);
  16957. if (options.onHidden && response.state !== 'hidden') {
  16958. options.onHidden();
  16959. }
  16960. response.state = 'hidden';
  16961. response.endTime = new Date();
  16962. publish(response);
  16963. }
  16964. });
  16965. }
  16966. function delayedHideToast() {
  16967. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  16968. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  16969. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  16970. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16971. }
  16972. }
  16973. function stickAround() {
  16974. clearTimeout(intervalId);
  16975. progressBar.hideEta = 0;
  16976. $toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });
  16977. }
  16978. function updateProgress() {
  16979. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  16980. $progressElement.width(percentage + '%');
  16981. }
  16982. }
  16983. function getOptions() {
  16984. return $.extend({}, getDefaults(), toastr.options);
  16985. }
  16986. function removeToast($toastElement) {
  16987. if (!$container) {
  16988. $container = getContainer();
  16989. }
  16990. if ($toastElement.is(':visible')) {
  16991. return;
  16992. }
  16993. $toastElement.remove();
  16994. $toastElement = null;
  16995. if ($container.children().length === 0) {
  16996. $container.remove();
  16997. previousToast = undefined;
  16998. }
  16999. }
  17000. }();
  17001. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17002. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17003. })(__webpack_require__(36));
  17004. /***/ }),
  17005. /* 36 */
  17006. /***/ (function(module, exports) {
  17007. module.exports = function() {
  17008. throw new Error("define cannot be used indirect");
  17009. };
  17010. /***/ })
  17011. /******/ ]);